/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Main content container */
#dynamic-content {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw; /* Prevent content from exceeding viewport width */
}

/* Container and layout */
.container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Desktop container improvements */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 3rem;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 800px;
        padding: 4rem;
    }
}

/* Typography */
h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

h2 {
    margin-bottom: 1rem;
    color: #34495e;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

button {
    width: 100%;
    padding: 0.75rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Links */
a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Enhanced error messages */
.error-message {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-radius: 4px;
    display: none;
    transition: all 0.3s ease;
    opacity: 0;
}

.error-message.show {
    display: block;
    opacity: 1;
}

.error-message.error {
    color: #e74c3c;
    background-color: #fdf2f2;
    border: 1px solid #fecaca;
}

.error-message.warning {
    color: #f39c12;
    background-color: #fef9e7;
    border: 1px solid #fde68a;
}

.error-message.critical {
    color: #c0392b;
    background-color: #fbeaea;
    border: 1px solid #f87171;
    font-weight: 600;
}

.error-message.success {
    color: #27ae60;
    background-color: #eafaf1;
    border: 1px solid #27ae60;
}

/* Field-specific error messages */
.field-error {
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Error state for form fields */
input.error,
select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

input.error:focus,
select.error:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.3);
}

/* View management with smooth transitions */
.view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.view.transitioning {
    opacity: 0;
}

/* Ensure smooth transitions between authentication states */
.view-transition {
    transition: all 0.3s ease-in-out;
}

/* Dashboard specific styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.dashboard-header h1 {
    margin: 0;
}

.dashboard-header button {
    width: auto;
    padding: 0.5rem 1rem;
    background-color: #e74c3c;
}

.dashboard-header button:hover {
    background-color: #c0392b;
}

.user-info {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.user-info p {
    margin-bottom: 0.5rem;
}

.user-info span {
    font-weight: 600;
    color: #2c3e50;
}

/* Loading spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .dashboard-header button {
        width: 100%;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.p-1 { padding: 1rem; }

/* Success message */
.success-message {
    color: #27ae60;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #f0f9f4;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    display: none;
}

.success-message.show {
    display: block;
}
/
* Progress Indicators and Educational Views */

/* Progress bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Subject cards */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.subject-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.subject-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.subject-icon {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.subject-icon img,
.icon-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.completion-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.subject-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.subject-meta {
    margin: 0.75rem 0;
}

.grade-info {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.progress-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.lessons-completed,
.points-earned {
    color: #495057;
}

.subject-arrow {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #6c757d;
}

/* Unit cards */
.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.unit-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.unit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.unit-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    position: relative;
    flex-shrink: 0;
}

.completion-check {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    font-size: 0.8rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.unit-content {
    flex: 1;
}

.unit-content h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.unit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.75rem 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.lessons-info,
.points-info {
    color: #495057;
}

.unit-arrow {
    font-size: 1.2rem;
    color: #6c757d;
    flex-shrink: 0;
}

/* Lesson cards */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.lesson-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.lesson-card.completed {
    border-left: 4px solid #28a745;
}

.lesson-card.resumable {
    border-left: 4px solid #ffc107;
}

.lesson-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    position: relative;
    flex-shrink: 0;
}

.resume-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ffc107;
    color: #212529;
    font-size: 0.8rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-content {
    flex: 1;
}

.lesson-content h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.lesson-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.75rem 0;
    font-size: 0.8rem;
    color: #6c757d;
}

.activities-completed,
.points-earned {
    color: #495057;
}

.lesson-arrow {
    font-size: 1.2rem;
    color: #6c757d;
    flex-shrink: 0;
}

/* Header and navigation */
.header {
    background: white;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
    width: 100%;
    box-sizing: border-box;
    top: 0;
}

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.separator {
    margin: 0 0.5rem;
    color: #6c757d;
}

.current {
    color: #6c757d;
}

.subject-header,
.unit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.subject-icon,
.unit-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.icon-text {
    font-size: 1.5rem;
}

.unit-number {
    font-size: 1.2rem;
}

.subject-info h1,
.unit-info h1 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.subject-info p,
.unit-info p {
    margin: 0 0 0.5rem 0;
    color: #6c757d;
}

.unit-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Loading and error states */
.loading {
    text-align: center;
    padding: 3rem;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #dc3545;
}

.no-units,
.no-lessons {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.retry-btn,
.back-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin: 0.5rem;
    text-decoration: none;
    display: inline-block;
}

.retry-btn:hover,
.back-btn:hover {
    background: #0056b3;
}

/* Responsive design for educational views */
@media (max-width: 768px) {
    .subjects-grid,
    .units-grid,
    .lessons-grid {
        grid-template-columns: 1fr;
        padding: 0.5rem;
    }
    
    .subject-card,
    .unit-card,
    .lesson-card {
        padding: 1rem;
    }
    
    .subject-header,
    .unit-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .unit-meta,
    .lesson-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}/* Sync 
Status Indicator */

.sync-status-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    min-width: 280px;
    max-width: 400px;
    z-index: 1000;
    transition: all 0.3s ease;
    transform: translateX(100%);
    opacity: 0;
}

.sync-status-indicator.visible {
    transform: translateX(0);
    opacity: 1;
}

.sync-status-indicator.hidden {
    transform: translateX(100%);
    opacity: 0;
}

.sync-status-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.sync-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sync-message {
    flex: 1;
    min-width: 0;
}

.sync-text {
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    margin-bottom: 2px;
}

.sync-progress-info {
    font-size: 0.75rem;
    color: #6c757d;
}

.sync-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sync-action-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
}

.sync-action-btn:hover {
    background: #f8f9fa;
}

.sync-now-btn,
.retry-btn {
    color: #007bff;
    border-color: #007bff;
}

.sync-now-btn:hover,
.retry-btn:hover {
    background: #007bff;
    color: white;
}

.dismiss-btn {
    color: #6c757d;
    border: none;
    padding: 4px 8px;
    font-size: 1rem;
    line-height: 1;
}

.dismiss-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Status-specific styles */
.sync-status-indicator.status-online {
    border-left: 4px solid #28a745;
}

.sync-status-indicator.status-offline {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
}

.sync-status-indicator.status-syncing {
    border-left: 4px solid #007bff;
}

.sync-status-indicator.status-success {
    border-left: 4px solid #28a745;
    background: #d4edda;
}

.sync-status-indicator.status-warning {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
}

.sync-status-indicator.status-error {
    border-left: 4px solid #dc3545;
    background: #f8d7da;
}

.sync-status-indicator.status-info {
    border-left: 4px solid #17a2b8;
    background: #d1ecf1;
}

.sync-status-indicator.status-ready {
    border-left: 4px solid #6c757d;
}

/* Sync progress bar animation */
.sync-progress-bar {
    height: 3px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    animation: syncProgress 2s ease-in-out infinite;
}

@keyframes syncProgress {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sync-status-indicator {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .sync-status-content {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .sync-text {
        font-size: 0.85rem;
    }
    
    .sync-action-btn {
        font-size: 0.75rem;
        padding: 3px 6px;
    }
}

/* Sync status in header (alternative placement) */
.header-sync-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: auto;
}

.header-sync-status .sync-icon {
    font-size: 1rem;
}

.header-sync-status.status-syncing {
    color: #007bff;
}

.header-sync-status.status-error {
    color: #dc3545;
}

.header-sync-status.status-offline {
    color: #ffc107;
}

.header-sync-status.status-success {
    color: #28a745;
}/*
 Enhanced Breadcrumb Navigation */

.breadcrumb-nav {
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
    top: 0; /* Ensure it's not positioned off-screen */
}

.breadcrumb-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.back-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: auto;
    position: relative;
    z-index: 20;
    min-height: 32px;
    white-space: nowrap;
    visibility: visible; /* Ensure it's always visible */
}

.back-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.back-btn:active {
    transform: translateY(1px);
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    white-space: nowrap;
}

.breadcrumb-item:not(:last-child) {
    margin-right: 0.5rem;
}

.breadcrumb-link {
    color: #007bff;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    background: #e3f2fd;
    text-decoration: none;
    color: #0056b3;
}

.breadcrumb-separator {
    color: #6c757d;
    margin: 0 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb-item.current .breadcrumb-text {
    color: #6c757d;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

.nav-shortcuts {
    display: flex;
    align-items: center;
}

.shortcuts-hint {
    color: #6c757d;
    font-size: 1rem;
    cursor: help;
    padding: 0.25rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.shortcuts-hint:hover {
    background: #f8f9fa;
    color: #495057;
}

/* Mobile responsive breadcrumbs */
@media (max-width: 768px) {
    .breadcrumb-nav {
        padding: 0.5rem;
    }
    
    .breadcrumb-content {
        gap: 0.5rem;
    }
    
    .back-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .breadcrumb-item {
        font-size: 0.8rem;
    }
    
    .breadcrumb-link,
    .breadcrumb-text {
        padding: 0.125rem 0.25rem;
    }
    
    .nav-shortcuts {
        display: none; /* Hide shortcuts hint on mobile */
    }
    
    /* Truncate long breadcrumb items on mobile */
    .breadcrumb-item {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Breadcrumb integration with existing header styles */
.header .breadcrumb-nav {
    background: transparent;
    border-bottom: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}

.header .breadcrumb-nav .breadcrumb-content {
    margin: 0;
}

/* Quick navigation shortcuts tooltip */
.shortcuts-hint[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #212529;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.shortcuts-hint[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #212529;
    z-index: 1000;
}

/* Enhanced navigation states */
.breadcrumb-link:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.back-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Animation for breadcrumb updates */
.breadcrumb-nav {
    transition: all 0.3s ease;
}

.breadcrumb-item {
    animation: fadeInBreadcrumb 0.3s ease;
}

@keyframes fadeInBreadcrumb {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}/* En
hanced Loading States - Skeleton UI */

.skeleton-container {
    animation: fadeIn 0.3s ease;
}

.skeleton-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Skeleton elements */
.skeleton-icon {
    width: 60px;
    height: 60px;
    background: #e9ecef;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.skeleton-number {
    width: 50px;
    height: 50px;
    background: #e9ecef;
    border-radius: 50%;
    margin-right: 1rem;
    flex-shrink: 0;
}

.skeleton-title {
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-title.large {
    height: 32px;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 16px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-badge {
    height: 20px;
    width: 80px;
    background: #e9ecef;
    border-radius: 10px;
    display: inline-block;
    margin-right: 0.5rem;
}

.skeleton-progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.skeleton-placeholder {
    height: 200px;
    background: #e9ecef;
    border-radius: 8px;
    margin: 1rem 0;
}

.skeleton-placeholder.large {
    height: 300px;
}

/* Skeleton layouts */
.skeleton-content {
    flex: 1;
}

.skeleton-meta {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.skeleton-header {
    margin-bottom: 2rem;
}

.activity-item-skeleton {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Enhanced Error States */

.enhanced-error {
    background: white;
    border: 1px solid #f5c6cb;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.error-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.error-details {
    flex: 1;
}

.error-title {
    color: #721c24;
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.error-message {
    color: #856404;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.error-suggestions {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.suggestions-title {
    font-weight: 600;
    color: #856404;
    margin: 0 0 0.5rem 0;
}

.suggestions-list {
    margin: 0;
    padding-left: 1.5rem;
    color: #856404;
}

.suggestions-list li {
    margin-bottom: 0.25rem;
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.error-action-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: auto;
}

.error-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.retry-btn {
    background: #28a745;
}

.retry-btn:hover {
    background: #218838;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.signin-btn {
    background: #17a2b8;
}

.signin-btn:hover {
    background: #138496;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.back-btn {
    background: #6c757d;
}

.back-btn:hover {
    background: #5a6268;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.home-btn {
    background: #fd7e14;
}

.home-btn:hover {
    background: #e8690b;
    box-shadow: 0 2px 8px rgba(253, 126, 20, 0.3);
}

/* Network Status Indicator */

.network-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.network-status.online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.network-status.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.network-icon {
    font-size: 1.1rem;
}

/* Error state transitions */
.error-state {
    animation: errorSlideIn 0.3s ease;
}

@keyframes errorSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state improvements */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading p {
    color: #6c757d;
    font-size: 1.1rem;
    margin: 0;
}

/* Responsive design for error states */
@media (max-width: 768px) {
    .enhanced-error {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .error-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .error-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .error-action-btn {
        justify-content: center;
        width: 100%;
    }
    
    .skeleton-card {
        padding: 1rem;
    }
    
    .skeleton-icon,
    .skeleton-number {
        width: 40px;
        height: 40px;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states for accessibility */
.error-action-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Loading state with skeleton integration */
.skeleton-container[role="status"] {
    position: relative;
}

.skeleton-container[role="status"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #6c757d;
    pointer-events: none;
}/* 
Network Status Indicator */

.network-status-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    transition: all 0.3s ease;
}

.network-status-container.offline {
    animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.network-status-indicator {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    min-width: 200px;
    transition: all 0.3s ease;
}

.network-status-indicator.online {
    border-left: 4px solid #28a745;
}

.network-status-indicator.offline {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
}

.status-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.status-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
}

.status-message {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.3;
}

/* Network Notifications */

.network-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    max-width: 350px;
    z-index: 1001;
    animation: slideInNotification 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

@keyframes slideInNotification {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.network-notification.success {
    border-left: 4px solid #28a745;
    background: #d4edda;
}

.network-notification.warning {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
}

.network-notification.info {
    border-left: 4px solid #17a2b8;
    background: #d1ecf1;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #212529;
}

/* Mobile responsive network status */
@media (max-width: 768px) {
    .network-status-container {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
    
    .network-status-indicator {
        min-width: auto;
        padding: 0.5rem 0.75rem;
    }
    
    .status-content {
        gap: 0.5rem;
    }
    
    .status-text {
        font-size: 0.8rem;
    }
    
    .status-message {
        font-size: 0.75rem;
    }
    
    .network-notification {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
        padding: 0.75rem 1rem;
    }
    
    .notification-title {
        font-size: 0.85rem;
    }
    
    .notification-message {
        font-size: 0.75rem;
    }
}

/* Hide network status when sync status is visible */
.sync-status-indicator.visible ~ .network-status-container {
    bottom: 80px;
}

/* Integration with existing error states */
.enhanced-error .network-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.enhanced-error .network-status.online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.enhanced-error .network-status.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Accessibility improvements */
.network-status-indicator[role="status"] {
    position: relative;
}

.network-status-indicator[aria-live="polite"] {
    /* Ensure screen readers announce status changes */
}

/* Focus states for interactive elements */
.notification-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 1px;
}

/* Animation for status changes */
.network-status-indicator {
    transition: all 0.3s ease;
}

.network-status-indicator.status-changing {
    transform: scale(1.05);
}

/* Compact mode for smaller screens */
@media (max-width: 480px) {
    .network-status-container.compact .status-message {
        display: none;
    }
    
    .network-status-container.compact .network-status-indicator {
        padding: 0.5rem;
        min-width: auto;
    }
}/*
 ========================================
   ENHANCED VISUAL DESIGN & INTERACTIONS
   Task 3.3: Polish visual design with focus on desktop and mobile
   ======================================== */

/* Enhanced Root Variables for Consistent Design */
:root {
    /* Color Palette */
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    
    /* Neutral Colors */
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 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.15);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.2);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Enhanced Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-gray);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Enhanced Focus Management for Accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Enhanced Button Styles */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    min-height: 44px; /* Minimum touch target size */
}

button:hover, .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active, .btn:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

button:disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Enhanced Card Styles */
.card, .subject-card, .unit-card, .lesson-card {
    background: var(--white);
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card:hover, .subject-card:hover, .unit-card:hover, .lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card:active, .subject-card:active, .unit-card:active, .lesson-card:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

/* Enhanced Grid Layouts with Better Responsive Behavior */
.subjects-grid, .units-grid, .lessons-grid {
    display: grid;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
    animation: fadeInUp 0.6s ease;
}

.subjects-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.units-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.lessons-grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

/* Enhanced Progress Bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--medium-gray);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: var(--spacing-sm) 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #20c997);
    border-radius: var(--radius-sm);
    transition: width var(--transition-slow);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Enhanced Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Enhanced Header Styles */
.header {
    background: var(--white);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--medium-gray);
    animation: fadeInDown 0.5s ease;
}

.subject-header, .unit-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    animation: slideInLeft 0.6s ease;
}

/* Enhanced Icon Styles */
.subject-icon, .unit-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: bold;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.subject-icon:hover, .unit-icon:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Enhanced Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--spacing-md) 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Enhanced Loading States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--medium-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-lg);
}

/* Enhanced Form Elements */
input, select, textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-fast);
    background-color: var(--white);
    min-height: 44px; /* Minimum touch target size */
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Enhanced Mobile-First Responsive Design */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .units-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }
    
    .lessons-grid {
        grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: var(--spacing-xl);
    }
    
    .units-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        gap: var(--spacing-xl);
    }
    
    .lessons-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        gap: var(--spacing-xl);
    }
    
    .header {
        padding: var(--spacing-xl);
    }
    
    h1 { font-size: 3rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 1.75rem; }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .units-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .lessons-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .subjects-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }
    
    .units-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
    
    .lessons-grid {
        grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    }
}

/* Mobile-Specific Optimizations */
@media (max-width: 767px) {
    /* Larger touch targets for mobile */
    button, .btn {
        min-height: 48px;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
    }
    
    /* Better spacing for mobile */
    .subjects-grid, .units-grid, .lessons-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        padding: var(--spacing-sm);
    }
    
    /* Mobile-optimized cards */
    .subject-card, .unit-card, .lesson-card {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-md);
    }
    
    /* Mobile typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    /* Mobile header */
    .header {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }
    
    .subject-header, .unit-header {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    /* Mobile-optimized forms */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--spacing-lg);
    }
}

/* Enhanced Accessibility Features */

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0056b3;
        --text-primary: #000000;
        --text-secondary: #333333;
        --medium-gray: #cccccc;
    }
    
    .card, .subject-card, .unit-card, .lesson-card {
        border-width: 2px;
    }
    
    button, .btn {
        border-width: 2px;
        font-weight: 600;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .progress-fill::after {
        animation: none;
    }
    
    .spinner {
        animation: none;
        border-top-color: var(--primary-color);
    }
}

/* Dark mode support (if user prefers) */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --light-gray: #121212;
        --medium-gray: #333333;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
    }
    
    body {
        background-color: var(--light-gray);
        color: var(--text-primary);
    }
    
    .card, .subject-card, .unit-card, .lesson-card {
        background: var(--white);
        border-color: var(--medium-gray);
    }
    
    input, select, textarea {
        background-color: var(--white);
        border-color: var(--medium-gray);
        color: var(--text-primary);
    }
}

/* Enhanced Interactive States */
.interactive-element {
    transition: all var(--transition-normal);
    cursor: pointer;
}

.interactive-element:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.interactive-element:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

/* Enhanced Loading Animations */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

.fade-in-down {
    animation: fadeInDown 0.5s ease;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease;
}

.slide-in-right {
    animation: slideInRight 0.6s ease;
}

.scale-in {
    animation: scaleIn 0.4s ease;
}

/* Staggered animations for lists */
.stagger-animation > * {
    animation: fadeInUp 0.6s ease;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Enhanced Print Styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .header {
        border-bottom: 1px solid #000;
    }
    
    .subjects-grid, .units-grid, .lessons-grid {
        display: block;
    }
    
    .subject-card, .unit-card, .lesson-card {
        break-inside: avoid;
        margin-bottom: 1rem;
        border: 1px solid #000;
    }
    
    button, .btn {
        display: none;
    }
}

/* Enhanced Touch Interactions for Mobile */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .card:hover, .subject-card:hover, .unit-card:hover, .lesson-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }
    
    .card:active, .subject-card:active, .unit-card:active, .lesson-card:active {
        transform: scale(0.98);
        transition-duration: 0.1s;
    }
    
    button:hover, .btn:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }
    
    button:active, .btn:active {
        transform: scale(0.95);
        transition-duration: 0.1s;
    }
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Enhanced Focus Indicators for Keyboard Navigation */
.keyboard-navigation *:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}/* 
Cache Management UI */

.cache-management-ui {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin: 1rem 0;
}

.cache-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.cache-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.25rem;
}

.cache-actions {
    display: flex;
    gap: 0.5rem;
}

.cache-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: auto;
}

.cache-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.cache-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-btn {
    color: #007bff;
    border-color: #007bff;
}

.refresh-btn:hover {
    background: #007bff;
    color: white;
}

.cleanup-btn {
    color: #28a745;
    border-color: #28a745;
}

.cleanup-btn:hover {
    background: #28a745;
    color: white;
}

.clear-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.clear-btn:hover {
    background: #dc3545;
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.stat-subtext {
    font-size: 0.75rem;
    color: #6c757d;
}

.stat-progress {
    margin-top: 0.5rem;
}

.stat-progress .progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.stat-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loading-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: #6c757d;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.cache-breakdown {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
}

.cache-breakdown h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1rem;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.breakdown-item {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #e9ecef;
}

.breakdown-type {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.breakdown-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.cache-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e9ecef;
    z-index: 1000;
    animation: slideInNotification 0.3s ease;
    font-size: 0.9rem;
}

.cache-notification.success {
    border-left: 4px solid #28a745;
    background: #d4edda;
    color: #155724;
}

.cache-notification.error {
    border-left: 4px solid #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.cache-notification.info {
    border-left: 4px solid #17a2b8;
    background: #d1ecf1;
    color: #0c5460;
}

/* Mobile responsive cache UI */
@media (max-width: 768px) {
    .cache-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .cache-actions {
        justify-content: center;
    }
    
    .cache-btn {
        flex: 1;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .breakdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .cache-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Cache status in header */
.header-cache-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.header-cache-status.cache-available {
    color: #28a745;
    border-color: #28a745;
    background: #d4edda;
}

.header-cache-status.cache-full {
    color: #ffc107;
    border-color: #ffc107;
    background: #fff3cd;
}

.header-cache-status.cache-error {
    color: #dc3545;
    border-color: #dc3545;
    background: #f8d7da;
}

/* Integration with existing components */
.dashboard-view .cache-management-ui {
    margin-top: 2rem;
}

.settings-view .cache-management-ui {
    margin: 1rem 0;
}

/* Cache size warning indicators */
.stat-item.warning .stat-value {
    color: #ffc107;
}

.stat-item.danger .stat-value {
    color: #dc3545;
}

.stat-progress .progress-fill.warning {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.stat-progress .progress-fill.danger {
    background: linear-gradient(90deg, #dc3545, #c82333);
}
/* Deskt
op Layout Fixes and Debugging */

/* Ensure all fixed elements are properly positioned and don't overlap */
.sync-status-indicator {
    z-index: 1040;
}

.network-status-container {
    z-index: 1030;
}

.cache-notification {
    z-index: 1020;
}

.network-notification {
    z-index: 1010;
}

/* Prevent any elements from being cut off at the top */
body, html {
    overflow-x: hidden;
}

/* Debug styles - remove after identifying the issue */
/* Uncomment these to help identify problematic elements */
/*
* {
    outline: 1px solid red !important;
}

[style*="position: fixed"],
[style*="position: absolute"] {
    outline: 3px solid blue !important;
}

[style*="background: black"],
[style*="background-color: black"],
[style*="background:#000"],
[style*="background-color:#000"] {
    outline: 5px solid yellow !important;
}
*/

/* Ensure proper desktop layout for all views */
@media (min-width: 1024px) {
    /* Desktop-specific improvements */
    .signin-view,
    .signup-view {
        padding: 2rem;
    }
    
    /* Ensure content doesn't stretch too wide */
    .subjects-grid,
    .units-grid,
    .lessons-grid {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    /* Improve spacing on larger screens */
    .container {
        margin: 3rem auto;
    }
}

/* Fix any potential button styling issues */
button {
    border: none;
    background: transparent;
    cursor: pointer;
}

/* Ensure no elements are positioned off-screen causing scrolling */
* {
    max-width: 100%;
}

/* Fix for any potential black elements */
[style*="background: black"],
[style*="background-color: black"],
.black-bg,
.dark-bg {
    background: transparent !important;
}