/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --accent-hover: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-screen h2 {
    color: white;
    font-weight: 600;
    font-size: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-in {
    opacity: 0;
    animation: fadeIn var(--transition-normal) forwards;
}

.slide-up {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp var(--transition-normal) forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes slideUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(-100%);
        opacity: 0;
        height: 0;
        margin: 0;
        padding: 0;
    }
}

/* Authentication Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.auth-form {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 1rem;
    height: 1rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* App Layout */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Desktop Layout */
.desktop-layout {
    display: flex;
    height: 100vh;
}

/* Desktop Sidebar */
.desktop-sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: none; /* Hidden by default on mobile */
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    border-radius: 0;
}

.sidebar-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: var(--accent-primary-alpha);
    color: var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

.sidebar-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-item span {
    flex: 1;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1.5rem;
}

.desktop-nav .nav-item svg {
    width: 24px;
    height: 24px;
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item:hover {
    background-color: var(--bg-secondary);
}

.nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Special styling for the center Create Note button */
#note-tab.active {
    color: var(--accent-primary);
}

/* Desktop-specific improvements */
@media (min-width: 769px) {
    body {
        background: var(--bg-secondary);
    }
    
    .container {
        max-width: 1200px;
        margin: 0 auto;
        background: var(--bg-primary);
        min-height: 100vh;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
    
    .desktop-sidebar {
        display: flex; /* Show sidebar on desktop */
    }
    
    .main-content {
        margin-left: 280px; /* Make room for sidebar */
        width: calc(100% - 280px);
    }
    
    .bottom-nav {
        display: none; /* Hide mobile navigation on desktop */
    }
    
    /* Remove page transition animations on desktop */
    .section {
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    
    .section.active {
        transform: none !important;
        opacity: 1 !important;
    }
    
    .quick-note-container {
        background: var(--bg-primary);
        margin: 2rem auto;
        min-height: 500px;
    }
    
    .note-input-area {
        min-height: 400px;
    }
    
    #note-input {
        font-size: 1.1rem;
        line-height: 1.6;
        min-height: 300px;
    }
    
    .note-actions {
        justify-content: flex-end;
        gap: 1rem;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem; /* Desktop padding for proper spacing */
    max-width: 100%;
    margin: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem; /* Add back padding for desktop */
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    pointer-events: none;
}

.section.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.section.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.section.slide-out-right {
    transform: translateX(100%);
    opacity: 0;
}

.section.slide-in-left {
    transform: translateX(-100%);
    opacity: 0;
}

.section.slide-in-right {
    transform: translateX(100%);
    opacity: 0;
}

/* Quick Note Section */
.quick-note-container {
    max-width: 800px; /* Optimal reading width for desktop */
    width: 100%;
    height: 100%;
    margin: 0 auto; /* Center on desktop */
}

.note-input-area {
    background: var(--bg-primary);
    border: 2px solid var(--border-color); /* Add back border for desktop */
    border-radius: var(--radius-lg); /* Add back rounded corners for desktop */
    padding: 2rem; /* Better padding for desktop */
    width: 100%;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.note-input-area:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#note-input {
    width: 100%;
    min-height: 120px;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
    resize: vertical;
    margin-bottom: 1rem;
}

#note-input::placeholder {
    color: var(--text-muted);
}

/* Note Type Toggle */
.note-type-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 1rem;
    width: fit-content;
}

.note-type-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
}

.note-type-btn svg {
    width: 16px;
    height: 16px;
}

.note-type-btn:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.note-type-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Note Modes */
.note-mode {
    display: none;
    flex: 1;
    height: 100%;
}

.note-mode.active {
    display: flex;
    flex-direction: column;
}

/* List Mode Styles */
.list-input-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 200px;
    padding: 0.5rem 1rem 1rem 1rem; /* Reduced top padding from 1rem to 0.5rem */
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-height: 60vh;
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.list-item:hover {
    background: var(--bg-tertiary);
}

.list-item-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    background: var(--bg-primary);
    transition: all var(--transition-fast);
}

.list-item-checkbox.checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.list-item-checkbox.checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.list-item-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: all var(--transition-fast);
}

.list-item.completed .list-item-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.list-item-delete {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.list-item-delete:hover {
    background: var(--danger-color);
    color: white;
}

.list-item-delete svg {
    width: 16px;
    height: 16px;
}

.list-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.list-item-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.list-item-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Enhanced List Editing Styles */
.list-actions {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Editing List Item Styles */
.list-item-input.editing {
    transform: translateY(-10px);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    z-index: 10;
    position: relative;
    transition: all var(--transition-smooth);
}

.list-item-input.moved-to-list {
    position: absolute;
    z-index: 20;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: calc(100% - 80px);
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
}

.list-editing-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-primary);
    margin-bottom: 0.75rem;
    animation: slideIn 0.3s ease-out;
}

.list-editing-item .list-item-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.list-editing-item .editing-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 0;
    outline: none;
}

.list-editing-item .editing-actions {
    display: flex;
    gap: 0.5rem;
}

.list-input-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transform: translateX(10px);
    transition: all var(--transition-smooth);
    pointer-events: none;
}

.list-input-actions.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.btn-danger {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.list-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.note-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: auto;
}

/* Hide note-actions when in list mode */
#list-mode.active ~ .note-actions {
    display: none;
}

/* Success Message */
.success-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--success-color);
    color: white;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-weight: 500;
    animation: slideUp var(--transition-normal);
}

.success-message svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.dashboard-stats {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.note-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.clickable-note:hover .note-preview {
    color: var(--accent-primary);
}

.note-type-indicator {
    display: flex;
    align-items: center;
    margin-right: auto;
}

.note-type-indicator svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.note-preview {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-actions-card {
    display: flex;
    gap: 0.5rem;
}

.note-actions-card .btn {
    padding: 0.25rem;
    font-size: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Notifications */
.notifications-header {
    margin-bottom: 2rem;
}

.notifications-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.notification-item:hover {
    box-shadow: var(--shadow-md);
}

.notification-item.unread {
    border-left: 4px solid var(--accent-primary);
}

.notification-content {
    margin-bottom: 0.5rem;
}

.notification-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Saved Notes */
.saved-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.saved-notes-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.saved-notes-stats {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.notes-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.filter-btn:hover:not(.active) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.saved-notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* mFax */
.mfax-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mfax-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mfax-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.mfax-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 2rem;
}

.mfax-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mfax-tab.active {
    background: var(--accent-primary);
    color: white;
}

.mfax-tab:hover:not(.active) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.mfax-panel {
    display: none;
}

.mfax-panel.active {
    display: block;
}

.fax-form {
    max-width: 500px;
    margin: 0 auto;
}

.fax-form .input-group {
    margin-bottom: 1.5rem;
}

.fax-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.fax-form input,
.fax-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.fax-form input:focus,
.fax-form textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.fax-form textarea {
    resize: vertical;
    min-height: 100px;
}

.fax-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fax-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.fax-item:hover {
    box-shadow: var(--shadow-md);
}

.fax-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.fax-number {
    font-weight: 500;
    color: var(--text-primary);
}

.fax-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.fax-subject {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.fax-preview {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.fax-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.fax-status.sent {
    background: var(--success-color);
    color: white;
}

.fax-status.failed {
    background: var(--danger-color);
    color: white;
}

.fax-status.pending {
    background: var(--warning-color);
    color: white;
}

/* Chat */
.chat-header {
    margin-bottom: 2rem;
}

.chat-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    max-width: 70%;
}

.chat-message.own {
    background: var(--accent-primary);
    color: white;
    margin-left: auto;
    text-align: right;
}

.chat-message.other {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.chat-message-author {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.chat-message-content {
    font-size: 0.875rem;
    line-height: 1.4;
}

.chat-message-time {
    font-size: 0.6875rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Settings */
.settings-header {
    margin-bottom: 2rem;
}

.settings-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

.settings-content {
    max-width: 600px;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-group h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-item input[type="text"],
.setting-item input[type="file"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-width: 200px;
}

.theme-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.theme-option {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-option.active {
    background: var(--accent-primary);
    color: white;
}

.username-display {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-left: 1rem;
}

/* Scraped Paper */
.scraped-paper-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--warning-color);
}

.scraped-paper-actions {
    margin-bottom: 1.5rem;
    text-align: right;
}

.scraped-notes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.scraped-note-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: relative;
    border-left: 4px solid var(--danger-color);
}

.scraped-note-content {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scraped-note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.scraped-note-actions {
    display: flex;
    gap: 0.5rem;
}

.scraped-note-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal:not(.hidden) {
    opacity: 1;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

/* Share Modal */
.share-section {
    margin-bottom: 1.5rem;
}

.share-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-container input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.share-section select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.users-list h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.user-item {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Notification */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
}

.notification:not(.hidden) {
    transform: translateX(0);
}

.notification.error {
    background: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav {
        padding: 1rem;
    }

    .nav-actions {
        display: flex;
    }

    .desktop-nav {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .main-content {
        padding: 0; /* No padding on mobile for full screen */
        padding-bottom: 5rem; /* Just space for bottom nav */
    }
    
    .quick-note-container {
        max-width: none; /* Remove max-width on mobile */
        margin: 0; /* Remove centering on mobile */
    }
    
    .note-input-area {
        border: none; /* Remove border on mobile */
        border-radius: 0; /* Remove border-radius on mobile */
        padding: 1rem; /* Minimal padding on mobile */
        box-shadow: none; /* Remove shadow on mobile */
    }
    
    .section {
        padding: 0; /* Remove section padding on mobile */
    }

    .note-actions {
        flex-direction: column;
        position: sticky;
        bottom: 5rem; /* Above bottom navigation */
        background: var(--bg-primary);
        padding: 1rem;
        margin: 0 -1rem;
        border-top: 1px solid var(--border-color);
        z-index: 10;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .setting-item input[type="text"] {
        width: 100%;
        min-width: auto;
    }

    .share-link-container {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 1.5rem;
    }

    .main-content {
        padding: 0; /* No padding on small mobile */
        padding-bottom: 5rem;
    }
    
    .quick-note-container {
        max-width: none; /* Remove max-width on small mobile */
        margin: 0; /* Remove centering on small mobile */
    }
    
    .note-input-area {
        border: none; /* Remove border on small mobile */
        border-radius: 0; /* Remove border-radius on small mobile */
        padding: 1rem; /* Minimal padding on small mobile */
        box-shadow: none; /* Remove shadow on small mobile */
    }
    
    .section {
        padding: 0; /* Remove section padding on small mobile */
    }

    .note-input-area {
        padding: 1rem;
        padding-bottom: 6rem; /* Extra padding for bottom nav */
        height: calc(100vh - 140px); /* Full height minus top and bottom nav */
        display: flex;
        flex-direction: column;
    }
    
    #note-input {
        flex: 1;
        min-height: calc(100vh - 220px); /* Full available height */
        height: 100%;
    }
    
    .list-items {
        max-height: calc(100vh - 340px); /* Adjust for mobile + bottom nav */
        min-height: calc(100vh - 340px);
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Touch and swipe improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .nav-item {
        min-height: 44px;
    }

    .note-card {
        transition: none;
    }

    .note-card:active {
        transform: scale(0.98);
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Notification Styles */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
}

.notifications-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    background: var(--bg-primary);
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.notification-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.notification-item.unread {
    border-left: 4px solid var(--accent-primary);
    background: var(--bg-secondary);
}

.notification-content {
    flex: 1;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.notification-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.notification-time {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.notification-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.notification-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .notification-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .notification-actions {
        flex-direction: column;
    }
}
