/* ===== GLOBAL DESIGN SYSTEM ===== */
/* Perfect Color Palette & Professional Styling */

/* ===== LOGO STYLING ===== */
.logo img {
    border-radius: 50% !important;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Make logo square for perfect circle */
nav .logo img {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: block !important;
    object-fit: cover !important;
}

/* Logo container styling */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Logo text styling */
.logo-text {
    font-size: 1.6rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Brand logo on login page */
.brand-logo img {
    width: 160px !important;
    height: 160px !important;
    border-radius: 50% !important;
}

:root {
    /* Primary Colors - Professional Blue Palette */
    --primary-50: #e3f2fd;
    --primary-100: #bbdefb;
    --primary-200: #90caf9;
    --primary-300: #64b5f6;
    --primary-400: #42a5f5;
    --primary-500: #2196f3;
    --primary-600: #1e88e5;
    --primary-700: #1976d2;
    --primary-800: #1565c0;
    --primary-900: #0d47a1;
    
    /* Secondary Colors - Elegant Purple */
    --secondary-50: #f3e5f5;
    --secondary-100: #e1bee7;
    --secondary-200: #ce93d8;
    --secondary-300: #ba68c8;
    --secondary-400: #ab47bc;
    --secondary-500: #9c27b0;
    --secondary-600: #8e24aa;
    --secondary-700: #7b1fa2;
    --secondary-800: #6a1b9a;
    --secondary-900: #4a148c;
    
    /* Accent Colors */
    --accent-success: #10b981;
    --accent-success-light: #34d399;
    --accent-warning: #f59e0b;
    --accent-warning-light: #fbbf24;
    --accent-danger: #ef4444;
    --accent-danger-light: #f87171;
    --accent-info: #3b82f6;
    --accent-info-light: #60a5fa;
    
    /* Neutral Colors - Professional Grays */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Semantic Colors */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --text-disabled: var(--gray-400);
    --text-inverse: #ffffff;
    
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);
    --border-dark: var(--gray-400);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warm: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-cool: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    
    /* Shadows - Elevation System */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ===== GLOBAL BUTTON STYLES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-slow), height var(--transition-slow);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Variants */
.btn-primary {
    background: var(--primary-600);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-700);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary-600);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    background: var(--secondary-700);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--accent-success);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    background: var(--accent-success-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--accent-danger);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: var(--accent-danger-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-600);
    border-color: var(--primary-600);
}

.btn-outline-primary:hover {
    background: var(--primary-600);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary-600);
    border-color: var(--secondary-600);
}

.btn-outline-secondary:hover {
    background: var(--secondary-600);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

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

.btn-gradient {
    background: var(--gradient-primary);
    color: var(--text-inverse);
    border: none;
    box-shadow: var(--shadow-lg);
}

.btn-gradient:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-3px);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1.125rem;
}

.btn-xl {
    padding: var(--space-5) var(--space-10);
    font-size: 1.25rem;
}

.btn-block {
    width: 100%;
}

/* ===== CARD STYLES ===== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-8px);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-body {
    padding: var(--space-6);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.card-footer {
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* ===== INPUT STYLES ===== */
.form-control {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    font-family: 'Inter', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
    background-color: var(--bg-primary);
}

.form-control:hover {
    border-color: var(--border-dark);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

/* ===== BADGE STYLES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-800);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ===== UTILITY CLASSES ===== */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.transition-fast { transition: all var(--transition-fast); }
.transition-base { transition: all var(--transition-base); }
.transition-slow { transition: all var(--transition-slow); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.animate-fadeIn { animation: fadeIn var(--transition-slow) ease-out; }
.animate-slideInUp { animation: slideInUp var(--transition-slow) ease-out; }
.animate-slideInDown { animation: slideInDown var(--transition-slow) ease-out; }
.animate-scaleIn { animation: scaleIn var(--transition-base) ease-out; }

/* ===== RESPONSIVE DESIGN - MOBILE FIRST ===== */

/* Tablets and below (768px) */
@media (max-width: 768px) {
    /* Logo adjustments for tablets */
    nav .logo img {
        width: 50px !important;
        height: 50px !important;
    }
    
    .brand-logo img {
        width: 140px !important;
        height: 140px !important;
    }
    
    /* Hero Banner Mobile Responsiveness */
    .hero-banner,
    .page-hero-banner {
        height: 250px !important;
        margin-bottom: 2rem !important;
    }
    
    .hero-banner-image {
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .hero-banner-content {
        padding: 1.5rem !important;
    }
    
    .hero-title {
        font-size: 2rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .hero-icon {
        font-size: 3rem !important;
    }
    
    /* Ensure text is readable */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Container padding */
    .container {
        padding: 1rem !important;
    }
    
    /* Card adjustments */
    .card {
        padding: 1.25rem !important;
    }
    
    /* Button sizing */
    .btn, .action-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

/* Small mobile phones (480px and below) */
@media (max-width: 480px) {
    /* Logo adjustments for small phones */
    nav .logo img {
        width: 45px !important;
        height: 45px !important;
    }
    
    .brand-logo img {
        width: 120px !important;
        height: 120px !important;
    }
    
    /* Hero Banner for Small Screens */
    .hero-banner,
    .page-hero-banner {
        height: 200px !important;
        margin-bottom: 1.5rem !important;
        border-radius: 15px !important;
    }
    
    .hero-banner-image {
        object-fit: cover !important;
        object-position: center !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .hero-banner-content {
        padding: 1rem !important;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    .hero-subtitle {
        font-size: 0.875rem !important;
        display: none; /* Hide subtitle on very small screens */
    }
    
    .hero-icon {
        font-size: 2.5rem !important;
    }
    
    .hero-logo-img {
        width: 80px !important;
        height: 80px !important;
    }
    
    /* Typography adjustments */
    body {
        font-size: 13px;
        padding: 5px;
        overflow-x: hidden !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* Spacing adjustments */
    .container {
        padding: 0.75rem !important;
        margin: 0.5rem auto !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    /* Card adjustments */
    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Button adjustments */
    .btn, .action-btn {
        padding: 8px 12px !important;
        font-size: 13px !important;
        width: 100%;
    }
    
    /* Grid adjustments */
    .dashboard-grid,
    .papers-grid,
    .subjects-grid,
    .grade-selection {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Form inputs */
    input, textarea, select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Navigation improvements */
    nav {
        padding: 0.75rem 1rem !important;
    }
    
    nav ul {
        gap: 0.5rem !important;
    }
    
    nav a, nav button {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
}

/* Extra small devices (360px and below) */
@media (max-width: 360px) {
    nav .logo img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .brand-logo img {
        width: 100px !important;
        height: 100px !important;
    }
    
    body {
        font-size: 12px;
    }
    
    h1 {
        font-size: 1.35rem !important;
    }
    
    h2 {
        font-size: 1.15rem !important;
    }
    
    h3 {
        font-size: 1rem !important;
    }
    
    .container {
        padding: 0.5rem !important;
    }
    
    .card {
        padding: 0.75rem !important;
    }
}

/* ===== NAVIGATION EXTRAS (Calendar & Profile) ===== */
.nav-extras {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.calendar-widget, .profile-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-widget:hover, .profile-widget:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.calendar-icon {
    font-size: 1.5rem;
}

.calendar-date {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

.profile-pic {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.profile-name {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
}

/* Calendar Dropdown */
.calendar-dropdown {
    position: fixed;
    top: 80px;
    right: 250px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 1.5rem;
    width: 350px;
    z-index: 9999;
    display: none;
    animation: slideDown 0.3s ease;
}

.calendar-dropdown.active {
    display: block;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-header h3 {
    font-size: 1.2rem;
    color: var(--gray-900);
    margin: 0;
}

.calendar-nav-btn {
    background: var(--gradient-primary);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.calendar-nav-btn:hover {
    transform: scale(1.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.calendar-day-header {
    font-weight: 700;
    color: var(--gray-600);
    font-size: 0.8rem;
}

.calendar-day-number {
    color: var(--gray-700);
}

.calendar-day-number:hover {
    background: var(--gray-100);
}

.calendar-day-today {
    background: var(--gradient-primary);
    color: white !important;
    font-weight: 700;
}

.calendar-day-other-month {
    color: var(--gray-400);
}

.calendar-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 2px solid var(--gray-200);
}

.calendar-footer p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin: 0;
}

/* Profile Dropdown */
.profile-dropdown {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 320px;
    z-index: 9999;
    display: none;
    animation: slideDown 0.3s ease;
    overflow: hidden;
}

.profile-dropdown.active {
    display: block;
}

.profile-header {
    background: var(--gradient-primary);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-pic-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
}

.profile-info h3 {
    color: white;
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

.profile-info p {
    color: rgba(255,255,255,0.9);
    margin: 0;
    font-size: 0.85rem;
}

.profile-details {
    padding: 1.5rem;
}

.profile-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.profile-detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--gray-900);
    font-weight: 600;
    font-size: 0.9rem;
}

.profile-actions {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    display: flex;
    gap: 0.75rem;
}

.profile-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.profile-btn:first-child {
    background: var(--gradient-primary);
    color: white;
}

.profile-btn:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.logout-btn {
    background: var(--accent-danger);
    color: white;
}

.logout-btn:hover {
    background: var(--accent-danger-light);
    transform: translateY(-2px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    nav {
        padding: 0.5rem 1rem !important;
    }
    
    nav .logo img {
        width: 35px !important;
        height: 35px !important;
    }
    
    .container {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* Mobile responsive for nav extras */
@media (max-width: 768px) {
    .nav-extras {
        display: none;
    }
    
    .calendar-dropdown, .profile-dropdown {
        right: 10px;
        left: 10px;
        width: auto;
    }
}

/* ===== GLOBAL NAVIGATION STYLING ===== */
/* Professional Navigation Bar for All Pages */

nav {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.6rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
    transform: scale(1.05);
}

/* Navigation Menu Items */
#navMenu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 0.5rem;
}

#navMenu li {
    margin: 0;
}

#navMenu a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

#navMenu a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

#navMenu a.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* Logout Button Styling */
#navMenu button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

#navMenu button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ===== STANDARD HAMBURGER MENU ===== */
.hamburger {
    display: none; /* Hidden by default, shown on mobile */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 8px;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1001;
}

.hamburger:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.hamburger:active {
    transform: scale(0.95);
}

.hamburger span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hamburger Animation to X */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.menu-overlay.active {
    display: block;
}

/* No Scroll Class */
.no-scroll {
    overflow: hidden;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }
    
    #navMenu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        flex-direction: column;
        justify-content: flex-start;
        padding: 5rem 2rem 2rem;
        transition: right 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    #navMenu.active {
        right: 0;
    }
    
    #navMenu li {
        margin: 1rem 0;
        width: 100%;
    }
    
    #navMenu a {
        display: block;
        padding: 1rem;
        border-radius: 8px;
        font-size: 1.1rem;
    }
    
    .hamburger {
        display: flex;
        z-index: 1001;
    }
    
    .menu-overlay.active {
        display: block;
    }
}

/* Desktop Navigation - Hide hamburger on desktop */
@media (min-width: 769px) {
    .hamburger {
        display: none !important;
    }
    
    .menu-overlay {
        display: none !important;
    }
}

/* ===== MOBILE STABILITY - PREVENT HORIZONTAL SCROLL ===== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

* {
    max-width: 100%;
}

/* Prevent any element from causing horizontal overflow */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Tables should scroll horizontally if too wide */
table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

/* Fix for mobile screens 480px and below */
@media (max-width: 480px) {
    html, body {
        max-width: 100vw;
        overflow-x: hidden !important;
        position: relative;
    }
    
    /* Ensure all containers fit */
    .container, 
    .container-fluid,
    .wrapper,
    .page-wrapper,
    .main-content,
    .content-wrapper {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        overflow-x: hidden !important;
    }
    
    /* Fix for any fixed width elements */
    [style*="width:"] {
        max-width: 100% !important;
    }
    
    /* Prevent text overflow */
    h1, h2, h3, h4, h5, h6, p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Flex and grid items should not overflow */
    .flex-row, .row {
        flex-wrap: wrap !important;
    }
    
    /* Hero banners should fit */
    .hero-banner, 
    .page-hero-banner,
    .banner,
    .hero-section {
        max-width: 100vw !important;
        overflow: hidden !important;
    }
    
    /* Cards should stack */
    .card,
    .paper-card,
    .subject-card,
    .grade-card {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Extra small screens 360px and below */
@media (max-width: 360px) {
    html, body {
        font-size: 14px;
    }
    
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* ===== GLOBAL HORIZONTAL SCROLL FIX ===== */
html {
    overflow-x: hidden !important;
    width: 100% !important;
}

body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative !important;
}

nav {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}

.menu-overlay {
    max-width: 100vw !important;
    overflow: hidden !important;
}

/* Prevent any fixed/absolute positioned elements from causing overflow */
@media (max-width: 768px) {
    nav {
        width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .container,
    .page-hero-banner,
    .grade-selection,
    .subjects-view,
    .papers-view {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}
