/* ============================================
   IFOD UK Platform - Global Styles v2.0
   Premium Design System
   ============================================ */

/* --- CSS Variables & Design Tokens --- */
:root {
    --primary: #003366;
    --primary-light: #335c85;
    --primary-dark: #002244;
    --secondary: #2E7D32;
    --secondary-light: #4CAF50;
    --bg-light: #f5f7f8;
    --bg-dark: #0f1923;
    --surface: #ffffff;
    --surface-dark: #1a2733;
    --border-light: #e6edf4;
    --border-dark: #2c3b4b;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --text-muted: #94a3b8;
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --shadow-sm: 0 2px 12px -2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(0, 51, 102, 0.08);
    --font-ar: 'Tajawal', sans-serif;
    --font-en: 'Public Sans', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-ar);
    background: var(--bg-light);
    color: var(--text-main);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body[dir="ltr"] {
    font-family: var(--font-en);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition);
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Glass Header --- */
.glass-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(230, 237, 244, 0.5);
    transition: background var(--transition), box-shadow var(--transition);
}

.glass-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* --- Utility Classes --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section-padding {
    padding: 5rem 0;
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-sub {
    color: var(--text-sub);
}

.bg-primary {
    background-color: var(--primary);
}

.bg-secondary {
    background-color: var(--secondary);
}

/* --- Badge/Tag --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.badge-primary {
    background: rgba(0, 51, 102, 0.08);
    color: var(--primary);
}

.badge-green {
    background: rgba(46, 125, 50, 0.1);
    color: var(--secondary);
}

.badge-white {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Card Base --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 51, 102, 0.12);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.875rem;
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 51, 102, 0.35);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.25);
}

.btn-secondary:hover {
    background: #256d29;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 51, 102, 0.2);
}

.btn-white {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
}

.btn-white:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* --- Form Inputs --- */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-main);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 51, 102, 0.08);
    background: #fff;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* --- Stats Counter --- */
.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* --- Section Titles --- */
.section-title {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-title .overline {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    background: rgba(0, 51, 102, 0.06);
}

.section-title h2 {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.section-title p {
    color: var(--text-sub);
    max-width: 640px;
    margin: 0 auto;
    font-size: 1.0625rem;
    line-height: 1.8;
}

/* --- Mobile Menu --- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 360px;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    transition: right var(--transition);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

[dir="ltr"] .mobile-menu {
    right: auto;
    left: -100%;
}

.mobile-menu.active {
    right: 0;
}

[dir="ltr"] .mobile-menu.active {
    left: 0;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(46, 125, 50, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="ltr"] .slideInRight {
    animation-name: slideInLeft;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out both;
}

[data-animate] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-animate].visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Footer --- */
.footer {
    background: var(--primary-dark);
    color: #fff;
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.footer a {
    color: rgba(255, 255, 255, 0.6);
    transition: color var(--transition);
}

.footer a:hover {
    color: #fff;
}

/* --- Progress Bar Animation --- */
.progress-fill {
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Selection --- */
::selection {
    background: rgba(0, 51, 102, 0.15);
    color: var(--primary-dark);
}

/* --- Focus Visible (Accessibility) --- */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-padding {
        padding: 3rem 0;
    }

    .section-title h2 {
        font-size: 1.625rem;
    }

    .section-title .overline {
        font-size: 0.7rem;
    }

    .container {
        padding: 0 1rem;
    }

    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 480px) {
    .section-padding {
        padding: 2.5rem 0;
    }

    .section-title {
        margin-bottom: 2rem;
    }

    .section-title h2 {
        font-size: 1.375rem;
    }
}

/* --- Print --- */
@media print {

    .glass-header,
    .mobile-menu,
    .mobile-overlay,
    footer,
    #login-modal {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .section-padding {
        padding: 1.5rem 0;
    }
}