.paper-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.paper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left {
    flex: 1;
}

.header-center {
    flex: 1;
    justify-content: center;
}

.header-right {
    flex: 1;
    justify-content: flex-end;
}

.paper-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.paper-logo svg {
    color: var(--primary);
}

.paper-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sync-status.syncing .status-dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.sync-status.error .status-dot {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.paper-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px 24px;
    overflow-y: auto;
}

.paper-container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.paper-note {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

.note-content {
    padding: 32px;
    min-height: 400px;
    font-size: 16px;
    line-height: 1.7;
    outline: none;
}

.note-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-tertiary);
    pointer-events: none;
}

.note-content h1,
.note-content h2,
.note-content h3 {
    margin: 1em 0 0.5em;
    font-weight: 600;
}

.note-content h1 {
    font-size: 24px;
}

.note-content h2 {
    font-size: 20px;
}

.note-content h3 {
    font-size: 18px;
}

.note-content p {
    margin: 0 0 1em;
}

.note-content ul,
.note-content ol {
    margin: 0 0 1em;
    padding-left: 24px;
}

.note-content li {
    margin: 4px 0;
}

.note-content .checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
}

.note-content .checkbox-item input[type="checkbox"] {
    margin-top: 4px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.note-content .checkbox-item.checked span {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.format-popup {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.format-popup.hidden {
    display: none;
}

.format-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.format-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.format-btn.active {
    background: var(--primary);
    color: white;
}

.format-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.action-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 24px 24px;
    flex-shrink: 0;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark, #5a3fd4));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.action-button:active {
    transform: translateY(0);
}

.action-button svg {
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.action-hint {
    font-size: 13px;
    color: var(--text-tertiary);
}

.paper-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-text {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-text:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-results {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-header h3 svg {
    color: var(--primary);
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary:hover {
    background: var(--primary-dark, #5a3fd4);
}

.modal-processing {
    text-align: center;
    padding: 48px 24px;
}

.processing-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.processing-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    animation: sparkleRotate 3s linear infinite;
}

@keyframes sparkleRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.processing-spinner {
    position: absolute;
    inset: 0;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.modal-processing h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.modal-processing p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.results-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 14px;
}

.summary-item .count {
    font-weight: 600;
    color: var(--primary);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.15s;
}

.result-item:hover {
    background: var(--bg-primary);
}

.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
}

.result-icon.task {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.result-icon.event {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.result-icon.email {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.result-icon.file {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.result-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.history-item:hover {
    background: var(--bg-primary);
}

.history-item-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-item-preview {
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    font-size: 14px;
    color: var(--text-primary);
}

.setting-group select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

@media (max-width: 768px) {
    .paper-header {
        padding: 12px 16px;
    }

    .header-center {
        display: none;
    }

    .paper-main {
        padding: 16px;
    }

    .note-content {
        padding: 20px;
    }

    .paper-footer {
        padding: 10px 16px;
    }

    .footer-center {
        display: none;
    }

    .action-button {
        padding: 12px 24px;
        font-size: 15px;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 12px;
    }

    .results-summary {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .paper-logo span {
        display: none;
    }

    .sync-status .status-text {
        display: none;
    }

    .footer-left {
        gap: 8px;
    }

    .word-count,
    .char-count {
        font-size: 12px;
    }
}

@media (prefers-color-scheme: dark) {
    .paper-note {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .format-popup {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .modal-content {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    }
}
