/* ==========================================================================
   DIYAAFA ENTERPRISE REUSABLE CSS DESIGN SYSTEM
   Palette: Deep Navy (#012957) + Primary Blue (#196CDF) + Electric Cyan (#0CE4E0)
   Typography: Poppins | Responsive: Mobile -> Tablet -> Desktop
   ========================================================================== */

:root {
    /* ==========================================================================
       1. MASTER COLOR TOKENS
       ========================================================================== */

    /* Primary Blue */
    --ds-primary: #196CDF;
    --ds-primary-hover: #1458B8;
    --ds-primary-light: #A1D1FA;
    --ds-primary-dark: #1D2A3C;

    /* Secondary / Electric Cyan */
    --ds-secondary: #0CE4E0;
    --ds-secondary-mid: #49EBE8;
    --ds-secondary-light: #85F1EF;
    --ds-secondary-lighter: #C2F8F7;

    /* Tertiary / Success Green */
    --ds-success: #1CC248;
    --ds-success-mid: #55D176;
    --ds-success-light: #8DE1A3;
    --ds-success-lighter: #C6F0D1;

    /* Deep Purple */
    --ds-purple: #0D0349;
    --ds-purple-mid: #4A4277;
    --ds-purple-light: #8681A4;
    --ds-purple-lighter: #C2C0D1;

    /* Warning / Amber */
    --ds-warning: #FFAD24;
    --ds-warning-mid: #FFC15B;
    --ds-warning-light: #FFD691;
    --ds-warning-lighter: #FFEBC8;

    /* Danger / Orange-Red */
    --ds-danger: #F1591D;
    --ds-danger-mid: #F58256;
    --ds-danger-light: #F8AC8E;
    --ds-danger-lighter: #FBD5C6;

    /* Highlight / Lime */
    --ds-highlight: #F2FF47;
    --ds-highlight-light: #F5FF75;
    --ds-highlight-lighter: #F9FFA3;
    --ds-highlight-soft: #FCFFD1;

    /* Neutral Colors */
    --ds-white: #FFFFFF;
    --ds-white-fog: #FBFBFB;
    --ds-white-smoke: #E6E6E6;
    --ds-black: #000000;

    /* Original Brand Background Foundation */
    --ds-brand-navy: #012957;
    --ds-brand-navy-dark: #001A38;
    --ds-brand-navy-light: #063A78;
    --ds-brand-blue: #2C76D6;

    /* ==========================================================================
       2. SEMANTIC COLOR MAPPING
       ========================================================================== */
    --ds-page-bg: #F4F7FB;
    --ds-surface: #FFFFFF;
    --ds-surface-muted: #FBFBFB;
    --ds-text: #172B4D;
    --ds-text-muted: #596579;
    --ds-border: #E2E6EB;
    --ds-border-light: #EEF2F6;

    /* Interaction & Focus */
    --ds-focus-ring: 0 0 0 3px rgba(25, 108, 223, 0.25);
    --ds-focus-ring-cyan: 0 0 0 3px rgba(12, 228, 224, 0.35);
    --ds-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ==========================================================================
       3. TYPOGRAPHY SYSTEM (Poppins)
       ========================================================================== */
    --ds-font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --ds-text-xs: 0.75rem;       /* 12px */
    --ds-text-sm: 0.875rem;      /* 14px */
    --ds-text-base: 1rem;        /* 16px */
    --ds-text-lg: 1.125rem;      /* 18px */
    --ds-text-xl: 1.25rem;       /* 20px */
    --ds-text-2xl: 1.5rem;       /* 24px */
    --ds-text-3xl: 1.875rem;     /* 30px */
    --ds-text-4xl: 2.25rem;      /* 36px */
    --ds-heading: 2rem;          /* 32px */
    --ds-heading-display: 2.75rem; /* 44px */

    /* ==========================================================================
       4. SPACING SCALE
       ========================================================================== */
    --ds-space-1: 4px;
    --ds-space-2: 8px;
    --ds-space-3: 12px;
    --ds-space-4: 16px;
    --ds-space-5: 20px;
    --ds-space-6: 24px;
    --ds-space-8: 32px;
    --ds-space-10: 40px;
    --ds-space-12: 48px;
    --ds-space-16: 64px;

    /* ==========================================================================
       5. SHAPE AND ELEVATION
       ========================================================================== */
    --ds-radius-xs: 4px;
    --ds-radius-sm: 6px;
    --ds-radius-md: 12px;
    --ds-radius-lg: 18px;
    --ds-radius-xl: 24px;
    --ds-radius-full: 9999px;

    --ds-shadow-xs: 0 1px 3px rgba(1, 41, 87, 0.05);
    --ds-shadow-sm: 0 2px 8px rgba(18, 42, 75, 0.06);
    --ds-shadow-md: 0 8px 24px rgba(18, 42, 75, 0.10);
    --ds-shadow-lg: 0 16px 36px rgba(18, 42, 75, 0.14);
    --ds-shadow-glow-cyan: 0 0 20px rgba(12, 228, 224, 0.35);
    --ds-shadow-glow-blue: 0 0 20px rgba(25, 108, 223, 0.35);
}

/* ==========================================================================
   GLOBAL RESET & BASE TYPOGRAPHY
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--ds-font-family);
    font-size: var(--ds-text-base);
    line-height: 1.5;
    color: var(--ds-text);
    background-color: var(--ds-page-bg);
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ds-font-family);
    color: var(--ds-text);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 var(--ds-space-3);
}

h1 { font-size: var(--ds-text-4xl); font-weight: 800; }
h2 { font-size: var(--ds-text-3xl); font-weight: 800; }
h3 { font-size: var(--ds-text-2xl); font-weight: 700; }
h4 { font-size: var(--ds-text-xl); font-weight: 700; }
h5 { font-size: var(--ds-text-lg); font-weight: 600; }
h6 { font-size: var(--ds-text-base); font-weight: 600; }

p {
    margin: 0 0 var(--ds-space-4);
    line-height: 1.6;
}

a {
    color: var(--ds-primary);
    text-decoration: none;
    transition: color var(--ds-transition);
}

a:hover {
    color: var(--ds-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

button, a, input, select, textarea {
    transition:
        color var(--ds-transition),
        background-color var(--ds-transition),
        border-color var(--ds-transition),
        box-shadow var(--ds-transition),
        transform var(--ds-transition);
}

:focus-visible {
    outline: none;
    box-shadow: var(--ds-focus-ring);
}

/* ==========================================================================
   REUSABLE CONTAINERS & SURFACES
   ========================================================================== */
.ds-container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding-inline: var(--ds-space-5);
}

.ds-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-6);
    box-shadow: var(--ds-shadow-sm);
    transition: transform var(--ds-transition), box-shadow var(--ds-transition), border-color var(--ds-transition);
}

.ds-card--hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--ds-shadow-md);
    border-color: var(--ds-primary-light);
}

.ds-card--header {
    padding-bottom: var(--ds-space-4);
    margin-bottom: var(--ds-space-4);
    border-bottom: 1px solid var(--ds-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ds-card--footer {
    padding-top: var(--ds-space-4);
    margin-top: var(--ds-space-4);
    border-top: 1px solid var(--ds-border);
}

/* Deep Navy Hero & Section Foundation */
.ds-section--navy {
    background: var(--ds-brand-navy);
    color: var(--ds-surface);
    padding-block: var(--ds-space-12);
    position: relative;
}

.ds-section--navy h1,
.ds-section--navy h2,
.ds-section--navy h3,
.ds-section--navy h4 {
    color: var(--ds-white);
}

.ds-section--navy p {
    color: #CBD5E1;
}

.ds-section--gradient {
    background: linear-gradient(135deg, var(--ds-brand-navy) 0%, #08336B 50%, var(--ds-primary) 100%);
    color: var(--ds-surface);
    padding-block: var(--ds-space-12);
}

/* Electric Cyan Highlight Section Marker */
.ds-accent-cyan {
    color: var(--ds-secondary);
}

.ds-badge-cyan-glow {
    background: rgba(12, 228, 224, 0.15);
    color: var(--ds-secondary);
    border: 1px solid var(--ds-secondary);
    padding: 4px 12px;
    border-radius: var(--ds-radius-full);
    font-size: var(--ds-text-xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(12, 228, 224, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   REUSABLE BUTTONS
   ========================================================================== */
.ds-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    min-height: 42px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--ds-radius-sm);
    font-size: var(--ds-text-sm);
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.ds-button--primary {
    color: var(--ds-surface);
    background: var(--ds-primary);
    box-shadow: 0 4px 14px rgba(25, 108, 223, 0.3);
}

.ds-button--primary:hover {
    background: var(--ds-primary-hover);
    color: var(--ds-surface);
    box-shadow: 0 6px 18px rgba(25, 108, 223, 0.4);
    transform: translateY(-1px);
}

.ds-button--secondary {
    color: var(--ds-primary);
    background: var(--ds-surface);
    border-color: var(--ds-border);
    box-shadow: var(--ds-shadow-xs);
}

.ds-button--secondary:hover {
    color: var(--ds-primary-hover);
    border-color: var(--ds-primary);
    background: #F8FAFC;
    transform: translateY(-1px);
}

.ds-button--cyan {
    color: var(--ds-brand-navy);
    background: var(--ds-secondary);
    border-color: var(--ds-secondary);
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(12, 228, 224, 0.4);
}

.ds-button--cyan:hover {
    background: var(--ds-secondary-mid);
    color: var(--ds-brand-navy);
    box-shadow: 0 6px 22px rgba(12, 228, 224, 0.6);
    transform: translateY(-1px);
}

.ds-button--success {
    color: var(--ds-surface);
    background: var(--ds-success);
    box-shadow: 0 4px 14px rgba(28, 194, 72, 0.3);
}

.ds-button--success:hover {
    background: #17A83E;
    color: var(--ds-surface);
    box-shadow: 0 6px 18px rgba(28, 194, 72, 0.4);
    transform: translateY(-1px);
}

.ds-button--danger {
    color: var(--ds-surface);
    background: var(--ds-danger);
    box-shadow: 0 4px 14px rgba(241, 89, 29, 0.3);
}

.ds-button--danger:hover {
    background: #D94912;
    color: var(--ds-surface);
    transform: translateY(-1px);
}

.ds-button--outline {
    color: var(--ds-text);
    background: transparent;
    border-color: var(--ds-border);
}

.ds-button--outline:hover {
    border-color: var(--ds-primary);
    color: var(--ds-primary);
    background: rgba(25, 108, 223, 0.05);
}

/* Button Sizes */
.ds-button--sm {
    min-height: 34px;
    padding: 6px 14px;
    font-size: var(--ds-text-xs);
}

.ds-button--lg {
    min-height: 48px;
    padding: 13px 26px;
    font-size: var(--ds-text-base);
    border-radius: var(--ds-radius-md);
}

/* ==========================================================================
   REUSABLE FORM CONTROLS
   ========================================================================== */
.ds-form-group {
    margin-bottom: var(--ds-space-5);
}

.ds-label {
    display: block;
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-text);
    margin-bottom: var(--ds-space-2);
}

.ds-input,
.ds-select,
.ds-textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    color: var(--ds-text);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    font-size: var(--ds-text-sm);
    line-height: 1.5;
    outline: none;
    transition: border-color var(--ds-transition), box-shadow var(--ds-transition);
}

.ds-input::placeholder,
.ds-textarea::placeholder {
    color: var(--ds-text-muted);
    opacity: 0.8;
}

.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
    border-color: var(--ds-primary);
    box-shadow: var(--ds-focus-ring);
}

.ds-textarea {
    min-height: 110px;
    resize: vertical;
}

.ds-input:disabled,
.ds-select:disabled,
.ds-textarea:disabled {
    background-color: #F1F5F9;
    color: var(--ds-text-muted);
    cursor: not-allowed;
    border-color: var(--ds-border);
}

/* Form Helper Text */
.ds-hint {
    display: block;
    font-size: var(--ds-text-xs);
    color: var(--ds-text-muted);
    margin-top: var(--ds-space-1);
}

.ds-error {
    display: block;
    font-size: var(--ds-text-xs);
    color: var(--ds-danger);
    font-weight: 600;
    margin-top: var(--ds-space-1);
}

/* ==========================================================================
   STATUS BADGES & ALERTS
   ========================================================================== */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-1);
    padding: 4px 10px;
    border-radius: var(--ds-radius-full);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    line-height: 1.2;
}

.ds-badge--success {
    color: #12652B;
    background: #C6F0D1;
    border: 1px solid #8DE1A3;
}

.ds-badge--warning {
    color: #754600;
    background: #FFEBC8;
    border: 1px solid #FFD691;
}

.ds-badge--danger {
    color: #8B2D0C;
    background: #FBD5C6;
    border: 1px solid #F8AC8E;
}

.ds-badge--primary {
    color: #1458B8;
    background: #EBF3FC;
    border: 1px solid #A1D1FA;
}

.ds-badge--cyan {
    color: #056B69;
    background: #C2F8F7;
    border: 1px solid #85F1EF;
}

.ds-badge--purple {
    color: #0D0349;
    background: #C2C0D1;
    border: 1px solid #8681A4;
}

/* Alerts */
.ds-alert {
    padding: var(--ds-space-4) var(--ds-space-5);
    border-radius: var(--ds-radius-sm);
    margin-bottom: var(--ds-space-5);
    font-size: var(--ds-text-sm);
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    border: 1px solid transparent;
}

.ds-alert--success {
    background: #C6F0D1;
    border-color: #8DE1A3;
    color: #12652B;
}

.ds-alert--danger {
    background: #FBD5C6;
    border-color: #F8AC8E;
    color: #8B2D0C;
}

.ds-alert--warning {
    background: #FFEBC8;
    border-color: #FFD691;
    color: #754600;
}

.ds-alert--info {
    background: #EBF3FC;
    border-color: #A1D1FA;
    color: #1458B8;
}

/* ==========================================================================
   REUSABLE TABLES & METRICS
   ========================================================================== */
.ds-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-sm);
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ds-text-sm);
    text-align: left;
}

.ds-table th {
    background: #F8FAFC;
    padding: 13px 18px;
    font-weight: 700;
    color: var(--ds-text-muted);
    border-bottom: 1px solid var(--ds-border);
}

.ds-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--ds-border);
    color: var(--ds-text);
    vertical-align: middle;
}

.ds-table tbody tr:last-child td {
    border-bottom: none;
}

.ds-table tbody tr:hover td {
    background: #F9FBFE;
}

/* Metric / KPI Card */
.ds-metric {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-5);
    display: flex;
    align-items: center;
    gap: var(--ds-space-4);
    box-shadow: var(--ds-shadow-sm);
}

.ds-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--ds-radius-md);
    background: #EBF3FC;
    color: var(--ds-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ds-metric-icon--cyan {
    background: #C2F8F7;
    color: #056B69;
}

.ds-metric-icon--success {
    background: #C6F0D1;
    color: #12652B;
}

.ds-metric-val {
    font-size: var(--ds-text-2xl);
    font-weight: 800;
    color: var(--ds-text);
    line-height: 1.1;
}

.ds-metric-label {
    font-size: var(--ds-text-xs);
    color: var(--ds-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* ==========================================================================
   RESPONSIVE DESIGN REFINEMENTS
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --ds-heading: 1.75rem;
    }
}

@media (max-width: 767px) {
    :root {
        --ds-heading: 1.625rem;
        --ds-heading-display: 2rem;
        --ds-space-6: 18px;
        --ds-space-12: 36px;
    }

    .ds-card {
        border-radius: var(--ds-radius-sm);
        padding: var(--ds-space-4);
    }

    .ds-table th,
    .ds-table td {
        padding: 10px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
