/* ============================================
   DETECTME MOBILE - PROFESSIONAL CSS SYSTEM
   ============================================ */

/* ============================================
   1. CSS RESET & BASE
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   2. DESIGN TOKENS (CSS Variables)
   ============================================ */

:root {
    /* === Colors === */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #13131a;
    --color-bg-tertiary: #1a1a24;

    --color-surface-1: rgba(255, 255, 255, 0.03);
    --color-surface-2: rgba(255, 255, 255, 0.05);
    --color-surface-3: rgba(255, 255, 255, 0.08);

    --color-border-subtle: rgba(255, 255, 255, 0.06);
    --color-border-medium: rgba(255, 255, 255, 0.1);
    --color-border-strong: rgba(255, 255, 255, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
    --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);

    /* Brand Colors */
    --color-primary: #f43f5e;
    --color-primary-light: #fb7185;
    --color-primary-dark: #e11d48;

    --color-secondary: #3b82f6;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.8);
    --color-text-tertiary: rgba(255, 255, 255, 0.5);
    --color-text-muted: rgba(255, 255, 255, 0.3);

    /* === Spacing === */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 64px;

    /* === Typography === */
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */

    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* === Border Radius === */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* === Shadows === */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 24px rgba(244, 63, 94, 0.4);

    /* === Layout === */
    --header-height: 60px;
    --nav-height: 56px;
    --max-width: 600px;

    /* === Safe Areas (iOS & Android) === */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);

    /* === Transitions === */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* === Z-Index === */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ============================================
   3. LAYOUT
   ============================================ */

body {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    /* No padding in portrait mode - safe areas only in landscape/fullscreen */
    padding-left: 0;
    padding-right: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    background: radial-gradient(ellipse at top, rgba(244, 63, 94, 0.05), transparent 50%),
        radial-gradient(ellipse at bottom, rgba(59, 130, 246, 0.05), transparent 50%),
        var(--color-bg-primary);
    /* No padding in portrait mode - safe areas only in landscape/fullscreen */
    padding-left: 0;
    padding-right: 0;
}

.main-content {
    flex: 1;
    /* Default padding - NO safe-area in portrait mode */
    padding-top: calc(var(--header-height) + var(--space-4));
    padding-bottom: calc(var(--space-8) + var(--safe-area-inset-bottom));
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    animation: fadeInUp 0.4s var(--transition-base);
    /* Ensure content is always visible and centered */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 200px; /* Minimum height to ensure content is visible */
    /* Force centering - remove any transform or positioning that could cause offset */
    position: relative;
    left: auto !important;
    right: auto !important;
    transform: none !important;
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: 260px;
        transition: margin-left 0.3s ease, max-width 0.3s ease, padding-left 0.3s ease;
        padding-bottom: var(--space-10);
        padding-left: var(--space-8);
        padding-right: var(--space-8);
        max-width: calc(100% - 260px);
        background: var(--color-bg-primary);
        min-height: calc(100vh - var(--header-height));
    }
}

/* Desktop: Full width for home page - NO MARGIN */
@media (min-width: 1024px) {
    .main-content.home-page {
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0;
        padding-right: 0;
        padding-top: calc(var(--header-height) + var(--space-6));
        padding-bottom: var(--space-10);
    }
    
    .main-content.home-page .container {
        max-width: 1400px;
        margin: 0 auto;
        width: 100%;
        padding-left: calc(260px + 32px);
        padding-right: 32px;
        transition: padding-left 0.3s ease;
    }
    
    /* When sidebar is collapsed */
    .sidebar.collapsed ~ * .main-content.home-page .container,
    body:has(.sidebar.collapsed) .main-content.home-page .container {
        padding-left: calc(80px + 32px);
    }
}

/* Desktop: All pages should have proper layout */
@media (min-width: 1024px) {
    .main-content:not(.home-page) {
        max-width: 1400px;
        padding-left: var(--space-8);
        padding-right: var(--space-8);
        padding-top: calc(var(--header-height) + var(--space-6));
        margin-left: 260px;
        transition: margin-left 0.3s ease, max-width 0.3s ease;
    }
    
    /* When sidebar is collapsed */
    body:has(.sidebar.collapsed) .main-content:not(.home-page),
    .sidebar.collapsed ~ * .main-content:not(.home-page) {
        margin-left: 80px;
        max-width: calc(100% - 80px);
    }
    
    /* Container adjustments for all pages */
    .main-content .container {
        width: 100%;
        max-width: 100%;
    }
    
    /* Section titles larger on desktop */
    .section-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-6);
    }
}

/* ============================================
   4. HEADER
   ============================================ */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    /* Don't add padding-top by default - will be added via JS when needed */
    transition: all var(--transition-base);
    /* Make background more opaque to hide content behind */
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border-subtle);
    /* Don't adjust min-height by default - will be adjusted via JS when needed */
}

@media (min-width: 1024px) {
    .app-header {
        left: 260px;
        transition: left 0.3s ease, width 0.3s ease;
        padding: 0 var(--space-6);
        width: calc(100% - 260px);
    }
    
    /* When sidebar is collapsed */
    body:has(.sidebar.collapsed) .app-header,
    .sidebar.collapsed ~ * .app-header {
        left: 80px;
        width: calc(100% - 80px);
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Header Navigation */
.header-nav {
    display: none;
    align-items: center;
    gap: var(--space-2);
}

.header-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    color: var(--color-text-tertiary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.header-nav-item i {
    font-size: 18px;
}

.header-nav-item span {
    display: none;
}

.header-nav-item:hover {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
}

.header-nav-item.active {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.25) 0%, rgba(251, 146, 60, 0.25) 100%);
    border: 1px solid rgba(244, 63, 94, 0.5);
    color: #ff4d6d;
}

.header-nav-item.active i {
    color: #ff4d6d;
}

@media (min-width: 768px) {
    .header-nav {
        display: flex;
    }
    
    .header-nav-item span {
        display: inline;
    }
}

/* Tablet Landscape: Header adapté */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {
    .app-header {
        height: 60px;
        padding: 0 var(--space-4);
    }
    
    .header-nav-item {
        padding: var(--space-2) var(--space-2);
        font-size: var(--font-size-sm);
    }
    
    .header-nav-item i {
        font-size: 16px;
    }
}

@media (min-width: 1024px) {
    .app-header {
        padding: 0 var(--space-6);
        height: 70px;
    }
    
    .app-header #menu-toggle {
        display: none !important;
    }
    
    /* Hide logo in header on desktop (it's in sidebar) */
    .app-header .logo {
        display: none;
    }
    
    .header-actions {
        gap: var(--space-4) !important;
    }
    
    .header-nav {
        gap: var(--space-1);
    }
    
    .header-nav-item {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-base);
    }
}

.app-header.scrolled {
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border-subtle);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

/* Hide sidebar and header on mobile for login/register pages */
@media (max-width: 1023px) {
    .page-login .sidebar,
    .page-register .sidebar,
    .page-login .app-header,
    .page-register .app-header {
        display: none !important;
    }
    
    .page-login .main-content,
    .page-register .main-content {
        margin-left: 0 !important;
        padding-top: var(--space-4) !important;
    }
}

/* Show sidebar and header on PC for all pages including login/register */
@media (min-width: 1024px) {
    .page-login .sidebar,
    .page-register .sidebar,
    .page-login .app-header,
    .page-register .app-header {
        display: block !important;
    }
    
    .page-login .main-content,
    .page-register .main-content {
        margin-left: 260px !important;
        padding-top: calc(var(--header-height) + var(--space-6)) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: calc(100% - 260px) !important;
        max-width: calc(100% - 260px) !important;
    }
    
    body:has(.sidebar.collapsed) .page-login .main-content,
    body:has(.sidebar.collapsed) .page-register .main-content,
    .sidebar.collapsed ~ * .page-login .main-content,
    .sidebar.collapsed ~ * .page-register .main-content {
        width: calc(100% - 80px) !important;
        max-width: calc(100% - 80px) !important;
    }
    
    body:has(.sidebar.collapsed) .page-login .main-content,
    body:has(.sidebar.collapsed) .page-register .main-content,
    .sidebar.collapsed ~ * .page-login .main-content,
    .sidebar.collapsed ~ * .page-register .main-content {
        margin-left: 80px !important;
    }
    
    body:has(.sidebar.collapsed) .page-login .app-header,
    body:has(.sidebar.collapsed) .page-register .app-header,
    .sidebar.collapsed ~ * .page-login .app-header,
    .sidebar.collapsed ~ * .page-register .app-header {
        left: 80px !important;
        width: calc(100% - 80px) !important;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-lg);
    letter-spacing: -0.02em;
    transition: transform var(--transition-fast);
}

.logo:active {
    transform: scale(0.96);
}

.logo img {
    height: 32px;
    filter: drop-shadow(0 0 12px rgba(244, 63, 94, 0.5));
}

/* ============================================
   5. BOTTOM NAVIGATION
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: calc(var(--space-4) + var(--safe-area-inset-bottom));
    left: max(var(--space-4), var(--safe-area-inset-left));
    right: max(var(--space-4), var(--safe-area-inset-right));
    height: 64px;
    background: rgba(26, 26, 36, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-full);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-2);
    z-index: var(--z-fixed);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUpNav 0.5s var(--transition-bounce);
}

@media (min-width: 1024px) {
    .bottom-nav {
        left: auto;
        right: var(--space-6);
        width: auto;
        min-width: 300px;
        border-radius: var(--radius-xl);
        padding: 0 var(--space-4);
        gap: var(--space-2);
    }
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
}

.nav-item i {
    font-size: 24px;
    transition: all var(--transition-base);
}

.nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--gradient-primary);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-base);
}

.nav-item.active {
    color: #ffffff;
}

.nav-item.active::before {
    opacity: 1;
    transform: scale(1);
}

.nav-item.active i {
    position: relative;
    z-index: 1;
    transform: scale(1.1);
}

.nav-item:not(.active):active {
    transform: scale(0.9);
}

/* ============================================
   6. CARDS
   ============================================ */

.card {
    background: var(--gradient-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-base);
    animation: fadeInUp 0.4s var(--transition-base) backwards;
}

.card:active {
    transform: scale(0.98);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:active .card-image {
    transform: scale(1.05);
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-6);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
}

.card-content {
    padding: var(--space-5);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

/* ============================================
   7. BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(244, 63, 94, 0.4);
}

.btn-secondary {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-medium);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-subtle);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-7);
    font-size: var(--font-size-lg);
}

.btn-full {
    width: 100%;
}

/* ============================================
   8. FORM ELEMENTS
   ============================================ */

.form-group {
    position: relative;
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.form-input {
    width: 100%;
    padding: var(--space-4);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all var(--transition-base);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus {
    background: var(--color-surface-3);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.1);
}

/* Floating Label */
.form-floating {
    position: relative;
}

.form-floating .form-input {
    padding-top: var(--space-6);
}

.form-floating .form-label {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    margin: 0;
    pointer-events: none;
    transform-origin: left;
    transition: all var(--transition-base);
}

.form-floating .form-input:focus~.form-label,
.form-floating .form-input:not(:placeholder-shown)~.form-label {
    transform: translateY(-8px) scale(0.85);
    color: var(--color-primary);
}

/* ============================================
   9. ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUpNav {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   10. UTILITY CLASSES
   ============================================ */

/* Spacing */
.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-5 {
    margin-bottom: var(--space-5);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-5 {
    margin-top: var(--space-5);
}

.mt-6 {
    margin-top: var(--space-6);
}

/* Text */
.text-center {
    text-align: center;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-primary {
    color: var(--color-text-primary);
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

.text-muted {
    color: var(--color-text-muted);
}

/* Display */
.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.d-none {
    display: none;
}

/* Flex */
.flex-column {
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

/* Section Title */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

/* Horizontal Scroll */
.scroll-horizontal {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -ms-overflow-style: none;
    scrollbar-width: none;
    margin: 0 calc(var(--space-4) * -1);
    padding: 0 var(--space-4) var(--space-4);
}

.scroll-horizontal::-webkit-scrollbar {
    display: none;
}

.scroll-item {
    flex: 0 0 80%;
    scroll-snap-align: start;
}

/* Glass Effect */
.glass {
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-border-subtle);
}

/* Loading */
.skeleton {
    background: linear-gradient(90deg, var(--color-surface-1) 25%, var(--color-surface-2) 50%, var(--color-surface-1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ============================================
   11. RESPONSIVE
   ============================================ */

@media (max-width: 375px) {
    :root {
        --space-4: 12px;
    }

    .main-content {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }
}

/* ============================================
   12. ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
}

/* ============================================
   PAGE LOADER
   ============================================ */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.page-loader.active {
    opacity: 1;
    pointer-events: all;
}

.page-loader.fade-out {
    opacity: 0;
}

.page-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
}

.page-loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: #f43f5e;
    border-radius: 50%;
    animation: loader-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-ring:nth-child(1) {
    width: 80px;
    height: 80px;
    border-top-color: #f43f5e;
    animation-delay: 0s;
}

.loader-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    border-top-color: #fb923c;
    animation-delay: -0.2s;
    animation-duration: 1s;
}

.loader-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    border-top-color: #f43f5e;
    animation-delay: -0.4s;
    animation-duration: 0.8s;
}

@keyframes loader-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loader-logo {
    width: 120px;
    height: auto;
    opacity: 0.9;
    animation: loader-pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(244, 63, 94, 0.5));
}

.loader-logo img {
    width: 100%;
    height: auto;
    display: block;
}

@keyframes loader-pulse {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .page-loader-spinner {
        width: 60px;
        height: 60px;
    }
    
    .loader-ring:nth-child(1) {
        width: 60px;
        height: 60px;
    }
    
    .loader-ring:nth-child(2) {
        width: 45px;
        height: 45px;
    }
    
    .loader-ring:nth-child(3) {
        width: 30px;
        height: 30px;
    }
    
    .loader-logo {
        width: 100px;
    }
}

/* ============================================
   PAGE LAYOUT & SETTINGS STYLES
   ============================================ */

.page-container {
    padding: var(--space-4);
    max-width: 100%;
}

.page-header {
    margin-bottom: var(--space-6);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
}

/* Settings Tabs */
.settings-tabs-wrapper {
    margin-bottom: var(--space-6);
}

.settings-tabs {
    display: flex;
    gap: var(--space-2);
    background: var(--gradient-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.settings-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    min-width: fit-content;
}

.settings-tab i {
    font-size: var(--font-size-lg);
}

.settings-tab:hover {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
}

.settings-tab.active {
    background: var(--gradient-primary);
    color: var(--color-text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Settings Content */
.settings-content {
    position: relative;
}

.settings-pane {
    display: none;
    animation: fadeInUp 0.3s ease-out;
}

.settings-pane.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for page layout */
@media (max-width: 768px) {
    .page-container {
        padding: var(--space-3);
    }
    
    .settings-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .settings-tab {
        min-width: 120px;
    }
}

/* ============================================
   FULLSCREEN MOBILE SUPPORT (iOS & Android)
   ============================================ */

/* Safe area support for modern iOS and Android devices - ONLY IN LANDSCAPE */
@supports (padding-top: env(safe-area-inset-top)) {
    /* Don't apply these styles on initial load in portrait mode */
    /* They will be applied dynamically via JavaScript when needed */
}

/* Landscape mode specific adjustments for safe areas */
@media (max-width: 926px) and (orientation: landscape) {
    /* Landscape adjustments will be handled dynamically via JavaScript */
    /* This ensures they're only applied when actually in landscape mode */
    body,
    .app-container {
        /* Add more padding on sides in landscape mode */
        padding-left: max(var(--safe-area-inset-left), 8px);
        padding-right: max(var(--safe-area-inset-right), 8px);
    }
    
    .main-content {
        /* Adjust content padding for landscape safe areas */
        padding-left: max(var(--space-4), var(--safe-area-inset-left));
        padding-right: max(var(--space-4), var(--safe-area-inset-right));
        /* Padding-top will be adjusted via JS to include safe area */
    }
    
    .app-header {
        /* Ensure header respects safe areas in landscape */
        padding-left: max(var(--space-4), var(--safe-area-inset-left));
        padding-right: max(var(--space-4), var(--safe-area-inset-right));
        /* Padding-top and min-height will be adjusted via JS */
    }
    
    .sidebar {
        /* Ensure sidebar respects safe areas in landscape */
        padding-left: max(var(--safe-area-inset-left), 0);
        top: var(--safe-area-inset-top);
        left: var(--safe-area-inset-left);
        bottom: var(--safe-area-inset-bottom);
    }
    
    .bottom-nav {
        /* Adjust bottom nav for landscape safe areas */
        left: max(var(--space-4), var(--safe-area-inset-left));
        right: max(var(--space-4), var(--safe-area-inset-right));
        bottom: calc(var(--space-4) + var(--safe-area-inset-bottom));
    }
}

/* Ensure header stays above video player in fullscreen - higher z-index */
.plyr--fullscreen-active ~ .app-header,
.vlite:-webkit-full-screen ~ .app-header,
.vlite:-moz-full-screen ~ .app-header,
.vlite:fullscreen ~ .app-header,
video:fullscreen ~ .app-header {
    z-index: 10001 !important;
}

/* Fullscreen specific adjustments - handled by JavaScript for dynamic positioning */
@media (max-width: 768px) {
    /* When in fullscreen, the header will be positioned dynamically by JavaScript
       to avoid the status bar based on device detection */
    .vlite:-webkit-full-screen,
    .vlite:-moz-full-screen,
    .vlite:fullscreen {
        /* Ensure video player takes full viewport in fullscreen */
        width: 100vw !important;
        height: 100vh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 10000 !important;
    }
    
    /* Hide bottom nav in fullscreen mode */
    .vlite:-webkit-full-screen ~ .bottom-nav,
    .vlite:-moz-full-screen ~ .bottom-nav,
    .vlite:fullscreen ~ .bottom-nav {
        display: none !important;
    }
}

/* Portrait mode on mobile - ensure proper spacing and centering */
@media (max-width: 768px) and (orientation: portrait) {
    body,
    .app-container {
        /* No padding in portrait mode - content should be centered */
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .main-content {
        /* Ensure content doesn't get hidden behind bottom nav */
        padding-bottom: calc(80px + var(--safe-area-inset-bottom)) !important;
        /* Ensure content is centered - no left/right offset */
        padding-left: var(--space-4) !important;
        padding-right: var(--space-4) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
    }
}

/* Additional landscape optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    /* Compact mode for small landscape screens */
    .app-header {
        height: 48px !important;
    }
    
    .main-content {
        padding-top: calc(48px + var(--safe-area-inset-top) + var(--space-2)) !important;
    }
    
    /* Reduce vertical spacing in compact landscape */
    .card,
    .section {
        margin-bottom: var(--space-3) !important;
    }
}