/* ==========================================================================
   RWWS NGO - Modern, High-Performance Design System
   High Color Contrast (WCAG 2.1 AA/AAA Compliant) & Ultra-Fast Rendering
   ========================================================================== */

:root {
    /* Brand Colors - High Contrast Palette */
    --color-primary: #1d4ed8;         /* Vibrant Royal Blue - 4.5+:1 on white */
    --color-primary-hover: #1e40af;   /* Darker for hover states */
    --color-primary-active: #172554;
    --color-primary-light: #eff6ff;   /* Soft background tint */
    --color-primary-border: #bfdbfe;

    --color-accent: #d97706;          /* Rich Amber / Gold for Donations & CTA */
    --color-accent-hover: #b45309;
    --color-accent-text: #0f172a;     /* Deep dark text for amber backgrounds (7+:1 contrast) */
    --color-accent-light: #fef3c7;

    --color-success: #059669;         /* High-contrast emerald */
    --color-success-hover: #047857;
    --color-success-light: #ecfdf5;

    --color-danger: #dc2626;          /* Urgent cause red */
    --color-danger-hover: #b91c1c;
    --color-danger-light: #fef2f2;

    --color-info: #0284c7;            /* Informational cyan/blue */

    /* Neutral Slate Palette */
    --color-dark-950: #020617;        /* Ultra dark slate */
    --color-dark-900: #0f172a;        /* Deep slate navy (Navbar, Footer, Main Headings) */
    --color-dark-800: #1e293b;        /* Surface dark */
    --color-dark-700: #334155;        /* Primary body text (8.9:1 on white) */
    --color-dark-600: #475569;        /* Secondary / Muted text (5.9:1 on white, passes WCAG AA) */
    --color-gray-400: #94a3b8;        /* Subtle icon / disabled text */
    --color-gray-300: #cbd5e1;        /* Light text on dark backgrounds (10+:1 contrast) */
    --color-gray-200: #e2e8f0;        /* Borders and dividers */
    --color-gray-100: #f1f5f9;        /* Light surface / card background */
    --color-gray-50:  #f8fafc;        /* Body background */
    --color-white:    #ffffff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-hero-overlay: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.88) 100%);

    /* Elevation & Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 32px -6px rgba(15, 23, 42, 0.14), 0 8px 16px -4px rgba(15, 23, 42, 0.06);

    /* Transitions & Curves */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
}

/* ==========================================================================
   Base & Typography
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--color-gray-50);
    color: var(--color-dark-700);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--color-dark-900);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.display-1, .display-2, .display-3, .display-4, .display-5 {
    letter-spacing: -0.03em;
    font-weight: 800;
}

p {
    margin-bottom: 1.15rem;
}

/* Accessible text colors */
.text-muted, .text-secondary {
    color: var(--color-dark-600) !important; /* 5.9:1 contrast ratio */
}

.text-dark {
    color: var(--color-dark-900) !important;
}

/* Improved contrast on dark surfaces (Replaces low-contrast text-white-50) */
.text-white-50, .text-light-muted {
    color: var(--color-gray-300) !important; /* 10.5:1 contrast against dark slate */
}

.text-white-75 {
    color: #e2e8f0 !important;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Keyboard accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Navigation Bar (Header) - Ultra-High Contrast & Legibility
   ========================================================================== */

nav.navbar,
.navbar,
.navbar-custom,
.navbar.navbar-dark,
.navbar-dark.bg-dark {
    background-color: #0f172a !important; /* Always solid Deep Slate Navy */
    background: #0f172a !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
    z-index: 1030 !important;
}

.navbar-custom.scrolled,
nav.navbar.scrolled {
    background-color: #020617 !important; /* Slightly darker slate on scroll */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
}

.navbar-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.navbar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

/* Nav Links - Crystal Clear White Text, Bold, Easy to Read */
.navbar-custom .nav-link,
.navbar-dark .navbar-nav .nav-link,
.navbar .nav-link,
nav .nav-link {
    color: #ffffff !important; /* Guaranteed pure white */
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 0.55rem 0.95rem !important;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    opacity: 0.95;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus,
.navbar-dark .navbar-nav .nav-link:hover,
.navbar .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.18) !important;
    opacity: 1;
    transform: translateY(-1px);
}

/* Active Nav Link Pill */
.navbar-custom .nav-link.active,
.navbar-dark .navbar-nav .nav-link.active,
.navbar .nav-link.active {
    color: #ffffff !important;
    background-color: #2563eb !important; /* Vibrant Indigo Blue */
    font-weight: 700 !important;
    opacity: 1;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.5) !important;
}

/* Nav Donate Button */
.btn-nav-donate {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    padding: 0.55rem 1.4rem !important;
    border-radius: var(--radius-full) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4) !important;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast) !important;
    display: inline-flex;
    align-items: center;
}

.btn-nav-donate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.6) !important;
    color: #000000 !important;
}

/* Dropdown Menus - Always Solid Dark Background */
.navbar-custom .dropdown-menu,
.navbar-dark .dropdown-menu,
.navbar .dropdown-menu {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5) !important;
    padding: 0.6rem;
    margin-top: 0.5rem;
}

.navbar-custom .dropdown-item,
.navbar-dark .dropdown-item,
.navbar .dropdown-item {
    color: #e2e8f0 !important;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus,
.navbar-dark .dropdown-item:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

/* Mobile Navbar - Guaranteed Dark Background & Clean Spacing */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: #0f172a !important;
        padding: 1.25rem !important;
        margin-top: 0.75rem !important;
        border-radius: var(--radius-lg) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5) !important;
    }
    .navbar-nav .nav-item {
        margin-bottom: 0.35rem;
        width: 100%;
    }
    .navbar-nav .nav-link {
        padding: 0.7rem 1.1rem !important;
        text-align: left;
    }
}

/* Toggler */
.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-md);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5) !important;
}

/* ==========================================================================
   Buttons System
   ========================================================================== */

.btn {
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.6rem 1.3rem;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Accessible High-Contrast Warning / Donation Button */
.btn-warning {
    background-color: #f59e0b;
    border-color: #d97706;
    color: #0f172a !important; /* Guaranteed 8+:1 high contrast */
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover,
.btn-warning:focus {
    background-color: #d97706;
    border-color: #b45309;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
}

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.btn-success:hover,
.btn-success:focus {
    background-color: var(--color-success-hover);
    border-color: var(--color-success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--color-white);
}

.btn-outline-light:hover {
    background-color: var(--color-white);
    color: var(--color-dark-900);
    border-color: var(--color-white);
    transform: translateY(-1px);
}

.btn-pill {
    border-radius: var(--radius-full);
}

/* Pulse animation on main donation button */
.btn-pulse {
    animation: btnPulse 2.4s infinite;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* ==========================================================================
   Cards & Layout Components
   ========================================================================== */

.card {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    overflow: hidden;
}

.card:hover,
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.hover-lift-xl:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl) !important;
}

/* Stat Cards */
.stat-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover::after {
    opacity: 1;
}

/* Feature Icon Boxes */
.feature-icon-box {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 1.85rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition-base), background-color var(--transition-base), color var(--transition-base);
}

.stat-card:hover .feature-icon-box {
    transform: scale(1.08) rotate(3deg);
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* ==========================================================================
   Progress Bars
   ========================================================================== */

.progress {
    background-color: var(--color-gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.progress-bar {
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.progress-bar-animated-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmerProgress 2s infinite;
}

@keyframes shimmerProgress {
    100% {
        left: 100%;
    }
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */

.form-label {
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--color-dark-800);
    margin-bottom: 0.4rem;
}

.form-control,
.form-select {
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.65rem 0.95rem;
    font-size: 0.975rem;
    color: var(--color-dark-900);
    background-color: var(--color-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
    outline: none;
}

.form-control::placeholder {
    color: #94a3b8;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    font-weight: 700;
    padding: 0.4em 0.85em;
    border-radius: var(--radius-md);
    letter-spacing: 0.02em;
}

.badge.rounded-pill {
    border-radius: var(--radius-full);
}

.badge-urgent {
    background-color: var(--color-danger);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.badge-trust {
    background-color: rgba(29, 78, 216, 0.1);
    color: var(--color-primary);
    border: 1px solid rgba(29, 78, 216, 0.2);
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table-responsive {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--color-gray-200);
    overflow: hidden;
    background: var(--color-white);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--color-gray-100);
    color: var(--color-dark-800);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-gray-200);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-gray-200);
    color: var(--color-dark-700);
}

.table tbody tr:hover {
    background-color: rgba(29, 78, 216, 0.02);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer-custom {
    background-color: #090d16;
    color: #e2e8f0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-custom h5 {
    color: var(--color-white);
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.footer-custom a.footer-link {
    color: #cbd5e1;
    text-decoration: none;
    transition: color var(--transition-fast), transform var(--transition-fast);
    display: inline-block;
    padding: 0.2rem 0;
}

.footer-custom a.footer-link:hover {
    color: #ffffff;
    transform: translateX(4px);
}

.footer-social-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: rgba(255, 255, 255, 0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    transition: all var(--transition-fast);
}

.footer-social-btn:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.4);
}

/* ==========================================================================
   Back To Top Floating Button
   ========================================================================== */

#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base), background-color var(--transition-fast);
    z-index: 1020;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--color-primary-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* ==========================================================================
   Alerts & Toast Overlays
   ========================================================================== */

.alert {
    border-radius: var(--radius-md);
    border-width: 0 0 0 4px;
    font-weight: 500;
}

.alert-success {
    background-color: #ecfdf5;
    border-color: #059669;
    color: #065f46;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #2563eb;
    color: #1e40af;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: #d97706;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}

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