/*
 * Saudi Digital Government Authority (DGA) Design System
 * Professional Styles for Government Websites
 * Version: 1.0.0
 */

/* ==========================================================================
   1. CSS Variables - DGA Official Colors
   ========================================================================== */

:root {
    /* ========================================
       ألوان الهوية الرسمية - MSCS Brand Colors
       ======================================== */
    
    /* الألوان الأساسية - Primary Colors */
    --brand-primary-dark: #02877A;      /* Pantone P128-15C - أخضر داكن */
    --brand-primary: #32BCAD;           /* Pantone P127-5C - أخضر فاتح */
    --brand-gold: #C2B59B;              /* Pantone P13-4C - بيج/ذهبي */
    
    /* الألوان الثانوية - Secondary Colors */
    --brand-beige: #E0D1B6;             /* Pantone P19-9C - بيج فاتح */
    --brand-teal-light: #9AD7D3;        /* Pantone P130-3C - أخضر فاتح */
    
    /* الألوان الإضافية - Accent Colors */
    --brand-pink: #DE5C6D;              /* Pantone 487 U - وردي */
    --brand-orange: #E9765A;            /* Pantone 7579 U - برتقالي */
    --brand-blue: #478BA2;              /* Pantone 7459 U - أزرق */
    --brand-peach: #F2A490;             /* Pantone 487 U - خوخي */
    
    /* Primary Colors Scale - Based on Brand Primary */
    --dga-primary-50: #e6f7f5;
    --dga-primary-100: #b3e8e3;
    --dga-primary-200: #80d9d1;
    --dga-primary-300: #4dcabf;
    --dga-primary-400: #32BCAD;         /* Brand Primary */
    --dga-primary-500: #1aa89a;
    --dga-primary-600: #02877A;         /* Brand Primary Dark */
    --dga-primary-700: #026b62;
    --dga-primary-800: #024f49;
    --dga-primary-900: #013330;

    /* Secondary Colors - Brand Gold/Beige Scale */
    --dga-sand-50: #faf8f4;
    --dga-sand-100: #f2ede3;
    --dga-sand-200: #E0D1B6;            /* Brand Beige */
    --dga-sand-300: #d4c4a3;
    --dga-sand-400: #C2B59B;            /* Brand Gold */
    --dga-sand-500: #a89e84;
    --dga-sand-600: #8e876f;
    --dga-sand-700: #746f5a;
    --dga-sand-800: #5a5746;
    --dga-sand-900: #403f32;

    /* Neutral Colors */
    --dga-gray-50: #f9fafb;
    --dga-gray-100: #f3f4f6;
    --dga-gray-200: #e5e7eb;
    --dga-gray-300: #d1d5db;
    --dga-gray-400: #9ca3af;
    --dga-gray-500: #6b7280;
    --dga-gray-600: #4b5563;
    --dga-gray-700: #374151;
    --dga-gray-800: #1f2937;
    --dga-gray-900: #111827;

    /* Semantic Colors - Using Brand Colors */
    --dga-success: #02877A;             /* Brand Primary Dark */
    --dga-warning: #E9765A;             /* Brand Orange */
    --dga-error: #DE5C6D;               /* Brand Pink */
    --dga-info: #478BA2;                /* Brand Blue */

    /* Background Colors */
    --dga-bg-primary: #ffffff;
    --dga-bg-secondary: #f9fafb;
    --dga-bg-tertiary: #f3f4f6;

    /* Text Colors */
    --dga-text-primary: #111827;
    --dga-text-secondary: #4b5563;
    --dga-text-tertiary: #6b7280;

    /* Border Colors */
    --dga-border-light: #e5e7eb;
    --dga-border-medium: #d1d5db;
    --dga-border-dark: #9ca3af;

    /* Spacing Scale */
    --spacing-xs: 0.25rem;    /* 4px */
    --spacing-sm: 0.5rem;     /* 8px */
    --spacing-md: 1rem;       /* 16px */
    --spacing-lg: 1.5rem;     /* 24px */
    --spacing-xl: 2rem;       /* 32px */
    --spacing-2xl: 3rem;      /* 48px */
    --spacing-3xl: 4rem;      /* 64px */

    /* Border Radius */
    --radius-sm: 0.375rem;    /* 6px */
    --radius-md: 0.5rem;      /* 8px */
    --radius-lg: 0.75rem;     /* 12px */
    --radius-xl: 1rem;        /* 16px */
    --radius-2xl: 1.5rem;     /* 24px */

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;

    /* Font Families */
    --font-arabic: 'IBM Plex Sans Arabic', 'Tajawal', 'Cairo', sans-serif;
    --font-english: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-tooltip: 1070;
}

/* ==========================================================================
   2. Base Styles
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-arabic);
    color: var(--dga-text-primary);
    background-color: var(--dga-bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   3. Typography System - DGA Standards
   ========================================================================== */

/* Display Sizes */
.display-2xl {
    font-size: 4.5rem;        /* 72px */
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.display-xl {
    font-size: 3.75rem;       /* 60px */
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.display-lg {
    font-size: 3rem;          /* 48px */
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.display-md {
    font-size: 2.25rem;       /* 36px */
    line-height: 1.22;
    letter-spacing: -0.02em;
    font-weight: 600;
}

.display-sm {
    font-size: 1.875rem;      /* 30px */
    line-height: 1.27;
    font-weight: 600;
}

.display-xs {
    font-size: 1.5rem;        /* 24px */
    line-height: 1.33;
    font-weight: 600;
}

/* Text Sizes */
.text-xl {
    font-size: 1.25rem;       /* 20px */
    line-height: 1.5;
}

.text-lg {
    font-size: 1.125rem;      /* 18px */
    line-height: 1.56;
}

.text-md {
    font-size: 1rem;          /* 16px */
    line-height: 1.5;
}

.text-sm {
    font-size: 0.875rem;      /* 14px */
    line-height: 1.43;
}

.text-xs {
    font-size: 0.75rem;       /* 12px */
    line-height: 1.5;
}

/* Font Weights */
.font-regular { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Text with Weight Variants */
.text-md-regular {
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 400;
}

.text-lg-regular {
    font-size: 1.125rem;
    line-height: 1.56;
    font-weight: 400;
}

/* ==========================================================================
   4. Shadow System - DGA Standards
   ========================================================================== */

.shadow-xs {
    box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
}

.shadow-sm {
    box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10),
                0px 1px 2px 0px rgba(16, 24, 40, 0.06);
}

.shadow-md {
    box-shadow: 0px 4px 8px -2px rgba(16, 24, 40, 0.10),
                0px 2px 4px -2px rgba(16, 24, 40, 0.06);
}

.shadow-lg {
    box-shadow: 0px 12px 16px -4px rgba(16, 24, 40, 0.08),
                0px 4px 6px -2px rgba(16, 24, 40, 0.03);
}

.shadow-xl {
    box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),
                0px 8px 8px -4px rgba(16, 24, 40, 0.03);
}

.shadow-2xl {
    box-shadow: 0px 24px 48px -12px rgba(16, 24, 40, 0.18);
}

.shadow-3xl {
    box-shadow: 0px 32px 64px -12px rgba(16, 24, 40, 0.14);
}

/* ==========================================================================
   5. Focus States - Accessibility
   ========================================================================== */

*:focus {
    outline: 2px solid var(--dga-primary-600);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--dga-primary-600);
    outline-offset: 2px;
}

/* ==========================================================================
   6. Mobile Menu Styles
   ========================================================================== */

.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    background-color: #ffffff;
    display: block;
    width: 100%;
    padding: 0;
}

.mobile-menu.active {
    max-height: 2000px;
    border-top: 2px solid #E5E7EB;
    padding-top: 1rem;
    padding-bottom: 1rem;
    overflow: visible;
}

.mobile-menu-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--dga-border-light);
    transition: background-color var(--transition-fast);
}

.mobile-menu-item:hover {
    background-color: var(--dga-bg-secondary);
}

.mobile-menu-link {
    display: block;
    color: var(--dga-text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.mobile-menu-link:hover {
    color: var(--dga-primary-600);
}

/* ==========================================================================
   7. Dropdown Menu Styles
   ========================================================================== */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dga-bg-primary);
    border: 1px solid var(--dga-border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) 0;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-lg);
}

.dropdown:hover .dropdown-menu,
.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--dga-text-primary);
    text-decoration: none;
    transition: background-color var(--transition-fast);
    white-space: nowrap;
    font-size: 0.9375rem;
}

.dropdown-menu a:hover {
    background-color: var(--dga-bg-secondary);
    color: var(--dga-primary-600);
}

/* Mobile Dropdown */
.mobile-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    background: var(--dga-bg-secondary);
    margin-top: var(--spacing-sm);
    border-radius: var(--radius-md);
}

.mobile-dropdown-menu.active {
    max-height: 600px;
    padding: var(--spacing-sm) 0;
}

.mobile-dropdown-menu a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--dga-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.mobile-dropdown-menu a:hover {
    color: var(--dga-primary-600);
}

/* ==========================================================================
   8. Card Styles
   ========================================================================== */

.news-card {
    transition: transform var(--transition-base),
                box-shadow var(--transition-base);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--dga-bg-primary);
}

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

.stat-card {
    transition: transform var(--transition-base),
                box-shadow var(--transition-base);
    border-radius: var(--radius-xl);
    background: var(--dga-bg-primary);
}

.stat-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* Service Cards */
.service-card {
    background: var(--dga-bg-primary);
    border: 2px solid var(--dga-border-light);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    transition: all var(--transition-base);
}

.service-card:hover {
    border-color: var(--dga-primary-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

/* ==========================================================================
   9. Button Styles - DGA Standards
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-family: var(--font-arabic);
    gap: var(--spacing-sm);
}

.btn-primary {
    background-color: var(--dga-primary-600);
    color: white;
}

.btn-primary:hover {
    background-color: var(--dga-primary-700);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--dga-sand-500);
    color: var(--dga-text-primary);
}

.btn-secondary:hover {
    background-color: var(--dga-sand-600);
}

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

.btn-outline:hover {
    background-color: var(--dga-primary-50);
}

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

.btn-ghost:hover {
    background-color: var(--dga-bg-secondary);
}

/* Button Sizes */
.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.125rem;
}

/* ==========================================================================
   10. Utility Classes
   ========================================================================== */

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Text Colors */
.text-primary { color: var(--dga-text-primary); }
.text-secondary { color: var(--dga-text-secondary); }
.text-tertiary { color: var(--dga-text-tertiary); }

/* Background Colors */
.bg-primary { background-color: var(--dga-bg-primary); }
.bg-secondary { background-color: var(--dga-bg-secondary); }
.bg-tertiary { background-color: var(--dga-bg-tertiary); }

/* ==========================================================================
   11. Scroll to Top Button
   ========================================================================== */

.scroll-to-top {
    position: fixed;
    bottom: 7rem;
    left: 2rem;
    width: 3rem;
    height: 3rem;
    background-color: var(--dga-primary-600);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-base);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-lg);
}

.scroll-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-to-top:hover {
    background-color: var(--dga-primary-700);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* ==========================================================================
   12. Accessibility Features
   ========================================================================== */

/* Font Size Classes for Accessibility */
body.font-size-small {
    font-size: 14px;
}

body.font-size-normal {
    font-size: 16px;
}

body.font-size-large {
    font-size: 18px;
}

body.font-size-xlarge {
    font-size: 20px;
}

/* High Contrast Mode */
body.high-contrast {
    --dga-primary-600: #0a5c54;
    --dga-text-primary: #000000;
    --dga-text-secondary: #1a1a1a;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   13. Loading Animation
   ========================================================================== */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--dga-border-light);
    border-radius: 50%;
    border-top-color: var(--dga-primary-600);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   14. Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .display-2xl { font-size: 3rem; }
    .display-xl { font-size: 2.5rem; }
    .display-lg { font-size: 2rem; }
    .display-md { font-size: 1.75rem; }
}

@media (max-width: 768px) {
    .display-2xl { font-size: 2.5rem; }
    .display-xl { font-size: 2rem; }
    .display-lg { font-size: 1.75rem; }
    .display-md { font-size: 1.5rem; }
    .display-sm { font-size: 1.25rem; }

    .scroll-to-top {
        bottom: 1rem;
        left: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* ==========================================================================
   15. Print Styles
   ========================================================================== */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ==========================================================================
   16. Partners Swiper Carousel
   ========================================================================== */

.partners-swiper {
    padding: var(--spacing-lg) 0 var(--spacing-3xl);
}

.partner-logo-card {
    background: var(--dga-bg-primary);
    border: 1px solid var(--dga-border-light);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    transition: all var(--transition-base);
}

.partner-logo-card:hover {
    border-color: var(--dga-primary-400);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.partner-logo-card img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    filter: grayscale(30%);
    opacity: 0.85;
    transition: all var(--transition-base);
}

.partner-logo-card:hover img {
    filter: grayscale(0%);
    opacity: 1;
}

/* Swiper Navigation */
.partners-swiper .swiper-button-next,
.partners-swiper .swiper-button-prev {
    width: 44px;
    height: 44px;
    background: var(--dga-bg-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    color: var(--dga-primary-600);
}

.partners-swiper .swiper-button-next:after,
.partners-swiper .swiper-button-prev:after {
    font-size: 18px;
    font-weight: bold;
}

.partners-swiper .swiper-button-next:hover,
.partners-swiper .swiper-button-prev:hover {
    background: var(--dga-primary-600);
    color: white;
}

.partners-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: var(--dga-border-medium);
    opacity: 1;
}

.partners-swiper .swiper-pagination-bullet-active {
    background: var(--dga-primary-600);
    width: 24px;
    border-radius: 5px;
}

/* ==========================================================================
   17. Initiative Cards
   ========================================================================== */

.initiative-card {
    background: var(--dga-bg-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

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

.initiative-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ==========================================================================
   18. DgaTag Component - Design System Standards
   ========================================================================== */

/* DgaTag Component - Gray Color, Large Size */
.dga-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: #F3F4F6;
    color: #6B7280;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
}

.dga-tag .tag-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke-width: 2;
}

.dga-tag .tag-label {
    white-space: nowrap;
}
