/* Feynman Technique Web Application - Main Styles */

:root {
    /* Original Design Color Palette */
    --primary-blue: #4A90E2;
    --primary-blue-light: #6BA3E8;
    --primary-blue-dark: #2E5A87;
    --sidebar-blue: #2E5A87;
    --sidebar-blue-light: #4A90E2;
    
    /* Card Border Colors */
    --card-red: #E74C3C;
    --card-blue: #4A90E2;
    --card-yellow: #F39C12;
    --card-orange: #E67E22;
    
    /* Supporting Colors */
    --neutral-50: #FAFBFC;
    --neutral-100: #F4F6F8;
    --neutral-200: #E1E8ED;
    --neutral-300: #C7D2D7;
    --neutral-400: #A0ADB8;
    --neutral-500: #8A9BA8;
    --neutral-600: #6C7B7F;
    --neutral-700: #5A6C75;
    --neutral-800: #3E4651;
    --neutral-900: #2C3E50;
    
    /* Semantic Colors */
    --success: #27AE60;
    --warning: #F39C12;
    --error: #E74C3C;
    --info: var(--primary-blue);
    
    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--neutral-100);
    color: var(--neutral-800);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for content areas */
.content-area,
.note-description,
.list-item-description,
.popup-container {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Smooth scrolling for all elements */
* {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: var(--sidebar-blue);
    border-right: none;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.sidebar-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    background: var(--neutral-100);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.logo-fallback {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    font-family: var(--font-mono);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.025em;
}

.app-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    margin-top: 2px;
}

.sidebar-section {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xs);
    transition: all 0.2s ease;
    position: relative;
}

.folder-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.folder-item.active {
    background: var(--sidebar-blue-light);
    color: white;
    box-shadow: var(--shadow-md);
}

.note-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    min-width: 20px;
    text-align: center;
}

.folder-item.active .note-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.sidebar-card {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-card.active {
    background: var(--sidebar-blue-light);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xs);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: white;
}

.card-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.card-description {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

.card-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-mono);
}

/* Knowledge Folders - Clean Simple Styling */
.create-folder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 2px dashed rgba(255, 255, 255, 0.4);
    margin-top: var(--space-md);
    transition: all 0.2s ease;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
}

.create-folder-btn:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateY(-1px);
}

.create-folder-btn .icon {
    width: 14px;
    height: 14px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area {
    flex: 1;
    padding: var(--space-xl);
    overflow-y: auto;
    background: var(--neutral-100);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--neutral-100);
    color: var(--neutral-700);
    border: 1px solid var(--neutral-200);
}

.btn-secondary:hover {
    background: var(--neutral-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Icons */
.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Authentication Header Styles */
.app-header {
    background: white;
    border-bottom: 1px solid var(--neutral-200);
    padding: 0 var(--space-xl);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
    color: var(--neutral-800);
}

.logo-link .logo {
    height: 32px;
    width: auto;
    border-radius: var(--radius-md);
}

.logo-link .app-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-800);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

/* User Menu Styles */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-greeting {
    font-size: 14px;
    color: var(--neutral-600);
    font-weight: 500;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.user-action {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--neutral-600);
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
}

.user-action:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.logout-btn {
    color: var(--error);
}

.logout-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* Auth Actions Styles */
.auth-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.auth-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--neutral-600);
    transition: all 0.2s ease;
}

.auth-link:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.auth-link.register {
    background: var(--primary-blue);
    color: white;
}

.auth-link.register:hover {
    background: var(--primary-blue-dark);
}

/* Authentication Form Styles */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group label {
    font-weight: 600;
    color: var(--neutral-800);
    font-size: 14px;
}

.form-group input {
    padding: var(--space-md);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: var(--font-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.auth-button {
    padding: var(--space-md) var(--space-lg);
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-primary);
}

.auth-button:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-button:disabled {
    background: var(--neutral-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-toggle {
    text-align: center;
    margin-top: var(--space-lg);
    color: var(--neutral-600);
    font-size: 14px;
}

.auth-toggle a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.error-message {
    color: var(--error);
    background: #ffebee;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 14px;
    border: 1px solid #ffcdd2;
}

.success-message {
    color: var(--success);
    background: #e8f5e8;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 14px;
    border: 1px solid #c8e6c9;
}

.password-requirements {
    font-size: 12px;
    color: var(--neutral-500);
    margin-top: var(--space-xs);
}

/* Search Feature Styles */
.search-section {
    margin-bottom: var(--space-2xl);
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto var(--space-lg);
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-xl);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.search-input-container:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1), var(--shadow-md);
    transform: translateY(-1px);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: var(--neutral-400);
    margin-right: var(--space-md);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: var(--font-primary);
    color: var(--neutral-800);
    background: transparent;
    padding: 0;
}

.search-input::placeholder {
    color: var(--neutral-400);
}

.search-clear-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: var(--neutral-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: var(--space-sm);
}

.search-clear-btn:hover {
    background: var(--neutral-200);
    transform: scale(1.1);
}

.search-clear-btn svg {
    width: 12px;
    height: 12px;
    color: var(--neutral-500);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: var(--space-xs);
    max-height: 300px;
    overflow-y: auto;
}

.search-suggestion {
    padding: var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--neutral-100);
    transition: background-color 0.2s ease;
}

.search-suggestion:hover {
    background: var(--neutral-50);
}

.search-suggestion:last-child {
    border-bottom: none;
}

.suggestion-text {
    font-size: 14px;
    color: var(--neutral-700);
}

.suggestion-highlight {
    background: rgba(74, 144, 226, 0.2);
    color: var(--primary-blue);
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-results {
    margin-top: var(--space-lg);
}

.search-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--neutral-200);
}

.search-stats {
    font-size: 14px;
    color: var(--neutral-600);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cached-indicator {
    background: var(--success);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.search-result-item {
    background: white;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.search-result-item:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
}

.search-result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--neutral-800);
    margin-bottom: var(--space-xs);
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 12px;
    color: var(--neutral-500);
}

.search-result-type {
    background: var(--primary-blue);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
}

.search-result-score {
    background: var(--neutral-100);
    color: var(--neutral-600);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.search-result-content {
    font-size: 14px;
    color: var(--neutral-600);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.search-result-highlight {
    background: rgba(74, 144, 226, 0.15);
    color: var(--primary-blue);
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 3px;
}

.search-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--neutral-400);
}

.search-no-results {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--neutral-500);
}

.search-no-results-icon {
    width: 48px;
    height: 48px;
    color: var(--neutral-300);
    margin: 0 auto var(--space-lg);
}

.search-no-results-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-600);
    margin-bottom: var(--space-sm);
}

.search-no-results-text {
    font-size: 14px;
    color: var(--neutral-500);
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--neutral-500);
}

.search-loading-spinner,
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--neutral-200);
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: var(--space-md);
}

.matched-term {
    background: var(--primary-blue);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    margin-right: var(--space-xs);
}

.suggestion-highlight {
    background: rgba(74, 144, 226, 0.2);
    color: var(--primary-blue);
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: var(--error);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    margin-top: var(--space-lg);
}

.search-error-icon {
    width: 24px;
    height: 24px;
    margin: 0 auto var(--space-md);
}

/* Mobile-First Responsive Design */

/* Tablet and Desktop Layout */
@media (min-width: 769px) {
    .app-container {
        display: flex;
        height: 100vh;
    }
    
    .sidebar {
        width: 280px;
        flex-shrink: 0;
    }
    
    .main-content {
        flex: 1;
        overflow: hidden;
    }
    
    body {
        overflow: hidden;
    }
}

/* Mobile Layout */
@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }
    
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    /* Show new mobile navigation bar */
    .mobile-nav-bar {
        display: block;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        order: 2; /* Show sidebar after main content on mobile */
    }
    
    .main-content {
        order: 1;
        overflow: visible;
    }
    
    .content-area {
        overflow: visible;
    }
    
    /* Mobile Header Adjustments */
    .app-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
        border-bottom: 1px solid var(--neutral-200);
        box-shadow: var(--shadow-sm);
    }
    
    .header-content {
        padding: 0 var(--space-md);
        height: 56px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .header-left {
        flex: 1;
        display: flex;
        align-items: center;
    }
    
    .header-right {
        position: absolute;
        right: 55px; /* Position closer to hamburger menu */
        top: 50%;
        transform: translateY(-50%);
        z-index: 999;
    }
    
    .user-greeting {
        display: none;
    }
    
    /* Mobile auth actions positioning */
    .auth-actions {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        margin: 0;
    }
    
    .auth-link {
        padding: var(--space-xs) var(--space-sm);
        font-size: 13px;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }
    
    .auth-link.register {
        background: var(--primary-blue);
        color: white;
        font-weight: 600;
    }
    
    /* User menu mobile adjustments */
    .user-menu {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
    }
    
    .user-actions {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
    }
    
    .user-action {
        padding: var(--space-xs) var(--space-sm);
        font-size: 13px;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }
    
    .logo-link .logo {
        height: 28px;
        width: auto;
    }
    
    /* Mobile Sidebar Styling */
    .sidebar-header {
        padding: var(--space-md) var(--space-lg);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-section {
        padding: var(--space-md) var(--space-lg);
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .app-subtitle {
        font-size: 11px;
    }
    
    .folder-item {
        padding: var(--space-sm) var(--space-md);
        font-size: 13px;
    }
    
    .section-title {
        font-size: 10px;
        margin-bottom: var(--space-sm);
    }
    
    .sidebar-card {
        padding: var(--space-sm);
        margin-bottom: var(--space-xs);
    }
    
    .card-title {
        font-size: 12px;
    }
    
    .card-description {
        font-size: 11px;
    }
    
    .card-date {
        font-size: 10px;
    }
    
    .create-folder-btn {
        padding: var(--space-sm);
        font-size: 12px;
        margin-top: var(--space-sm);
    }
    
    .quiz-nav-btn,
    .analytics-nav-btn {
        padding: var(--space-sm);
        font-size: 12px;
        margin-top: var(--space-sm);
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .header-content {
        padding: 0 var(--space-md);
        height: 52px;
    }
    
    .logo-link .app-title {
        display: none;
    }
    
    .logo-link .logo {
        height: 24px;
        width: auto;
    }
    
    .sidebar-header {
        padding: var(--space-sm) var(--space-md);
    }
    
    .sidebar-section {
        padding: var(--space-sm) var(--space-md);
    }
    
    .logo {
        width: 36px;
        height: 36px;
    }
    
    .app-title {
        font-size: 15px;
    }
    
    .folder-item {
        padding: var(--space-xs) var(--space-sm);
        font-size: 12px;
    }
    
    .auth-container {
        margin: var(--space-md);
        padding: var(--space-md);
    }
    
    .auth-button {
        padding: var(--space-sm) var(--space-md);
        font-size: 13px;
    }
    
    .form-group input {
        padding: var(--space-sm);
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 360px) {
    .header-content {
        padding: 0 var(--space-sm);
    }
    
    .sidebar-header {
        padding: var(--space-xs) var(--space-sm);
    }
    
    .sidebar-section {
        padding: var(--space-xs) var(--space-sm);
    }
    
    .auth-container {
        margin: var(--space-sm);
        padding: var(--space-sm);
    }
}

/* Touch-Friendly Improvements for Mobile */
@media (hover: none) and (pointer: coarse) {
    .folder-item {
        min-height: 44px; /* iOS recommended touch target */
        padding: var(--space-sm) var(--space-md);
    }
    
    .sidebar-card {
        min-height: 44px;
    }
    
    .create-folder-btn {
        min-height: 44px;
    }
    
    .quiz-nav-btn,
    .analytics-nav-btn {
        min-height: 44px;
    }
    
    .user-action {
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
    }
    
    .auth-link {
        min-height: 44px;
        padding: var(--space-sm) var(--space-md);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Active states for touch feedback */
    .folder-item:active {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    .sidebar-card:active {
        background: rgba(255, 255, 255, 0.15);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    .create-folder-btn:active {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .app-container {
        flex-direction: row;
    }
    
    .sidebar {
        width: 240px;
        height: 100vh;
        order: 1;
        overflow-y: auto;
    }
    
    .main-content {
        order: 2;
        flex: 1;
        height: 100vh;
        overflow: hidden;
    }
    
    .content-area {
        overflow-y: auto;
        height: calc(100vh - 56px);
    }
    
    body {
        overflow: hidden;
    }
}

/* New Mobile Navigation Bar */
.mobile-nav-bar {
    display: block;
    background: white;
    border-bottom: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 var(--space-sm);
    max-width: 100vw;
    box-sizing: border-box;
}

.mobile-nav-left {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.mobile-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
}

.mobile-nav-logo {
    height: 48px;
    width: auto;
    max-width: 50vw;
    object-fit: contain;
    margin: 0;
    padding: 0;
}

.mobile-nav-right {
    display: flex;
    align-items: center;
    margin-left: var(--space-md);
    flex-shrink: 0;
}

.mobile-auth-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.mobile-auth-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--neutral-600);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mobile-auth-link:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.mobile-auth-link.mobile-register {
    background: var(--primary-blue);
    color: white;
}

.mobile-auth-link.mobile-register:hover {
    background: var(--primary-blue-dark);
}

.mobile-user-menu {
    display: flex;
    align-items: center;
}

.mobile-user-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.mobile-user-action {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--neutral-600);
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
}

.mobile-user-action:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.mobile-logout-btn {
    color: var(--error);
}

.mobile-logout-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

/* Mobile Navigation Styles */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 6px;
    right: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: var(--primary-blue);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--primary-blue-dark);
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

.mobile-close-btn {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.1);
}

/* Mobile Layout */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hide mobile menu for non-authenticated users */
    .no-auth .mobile-menu-toggle {
        display: none;
    }
    
    /* Adjust header-right positioning for non-authenticated users */
    .no-auth .header-right {
        position: absolute;
        right: 8px; /* Move closer to right corner when no hamburger menu */
        top: 50%;
        transform: translateY(-50%);
        z-index: 999;
    }
    
    .mobile-close-btn {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-menu-overlay.active {
        display: block;
    }
    
    .main-content {
        width: 100%;
        margin-left: 0;
    }
    
    .content-area {
        padding-top: 80px; /* Account for mobile menu toggle */
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .mobile-menu-toggle {
        top: 6px;
        right: 12px;
        width: 40px;
        height: 40px;
    }
    
    .hamburger-line {
        width: 18px;
    }
    
    .sidebar {
        width: 100%;
        left: -100%;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .mobile-close-btn {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
    }
    
    .content-area {
        padding-top: 70px;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 240px;
    }
    
    .mobile-menu-toggle {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    
    .hamburger-line {
        width: 16px;
    }
    
    .content-area {
        padding-top: 60px;
    }
}

/* High DPI Display Optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar {
        border-right: 0.5px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-section {
        border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    }
    
    .folder-item.active {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-menu-toggle {
        border: 0.5px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-close-btn {
        border-width: 0.5px;
    }
}