/* ==========================================================================
   Custom Accessible Styles & Visual Overrides
   ========================================================================== */

/* 1. Global Focus Indicator Override (WCAG 2.1/2.2 AA)
   Enforces a highly visible focus indicator on all interactive controls.
   -------------------------------------------------------------------------- */
:focus-visible {
    outline: 3px solid #2563EB !important; /* Brand Accent Blue */
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8) !important;
}

/* Ensure Safari-friendly active state visible outlines */
a:focus-visible, 
button:focus-visible, 
input:focus-visible, 
select:focus-visible, 
textarea:focus-visible {
    outline: 3px solid #2563EB !important;
    outline-offset: 2px !important;
}

/* Disable native outline on pointer-device click, keeping it for tab navigation */
:focus:not(:focus-visible) {
    outline: none !important;
}

/* 2. Screen Reader Only Utility (Visually Hidden)
   Keeps text available to screen readers while hiding it visually.
   -------------------------------------------------------------------------- */
.visually-hidden,
.sr-only {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Skip link behaviour - hides offscreen until focused by keyboard */
.skip-link:not(:focus-within):not(:active) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Ensure focused skip link overrides .sr-only visibility with !important */
.skip-link:focus,
.skip-link:focus-visible {
    position: fixed !important;
    top: 1rem !important;
    left: 1rem !important;
    width: auto !important;
    height: auto !important;
    clip-path: none !important;
    margin: 0 !important;
    overflow: visible !important;
    white-space: normal !important;
    z-index: 999999 !important;
    padding: 0.75rem 1.5rem !important;
    background-color: #1E40AF !important;
    color: #FFFFFF !important;
    border-radius: 0.375rem !important;
    font-weight: 700 !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25) !important;
    outline: 3px solid #FFFFFF !important;
    outline-offset: 2px !important;
    text-decoration: none !important;
}

/* 3. Typography & Styling Enhancements
   -------------------------------------------------------------------------- */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.025em;
}

/* Glassmorphism effects for premium financial feel */
.glass-panel {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-panel-dark {
    background: rgba(15, 23, 42, 0.85); /* Slate 900 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   WCAG 2.2 AAA Enhanced Color Contrast Enhancements (>7.0:1 ratio globally)
   ========================================================================== */
.bg-brand-navy,
.bg-brand-navyLight,
.glass-panel-dark,
.bg-slate-900,
.bg-slate-950,
footer {
    color: #F8FAFC !important;
}

/* Muted / Secondary text on Dark Backgrounds: Min 9.5:1 Contrast */
.bg-brand-navy .text-slate-400,
.bg-brand-navy .text-slate-500,
.bg-brand-navy .text-slate-300,
.bg-brand-navyLight .text-slate-400,
.bg-brand-navyLight .text-slate-500,
.glass-panel-dark .text-slate-400,
.glass-panel-dark .text-slate-500,
.bg-slate-900 .text-slate-400,
.bg-slate-900 .text-slate-500,
footer .text-slate-400,
footer .text-slate-500,
footer p,
footer li,
footer span {
    color: #CBD5E1 !important; /* Slate 300: 10.5:1 on #0F172A */
}

footer strong,
footer h1,
footer h2,
footer h3,
footer h4,
footer .text-white,
.bg-\[\#090D16\] div {
    color: #FFFFFF !important;
}

footer a {
    color: #E2E8F0 !important;
    text-underline-offset: 3px;
}
footer a:hover,
footer a:focus {
    color: #FFFFFF !important;
    text-decoration: underline;
}

/* Accent blue on Dark Backgrounds: 10.2:1 Contrast */
.bg-brand-navy .text-brand-accentBlue,
.bg-brand-navyLight .text-brand-accentBlue,
.glass-panel-dark .text-brand-accentBlue,
.bg-slate-900 .text-brand-accentBlue,
.bg-slate-950 .text-brand-accentBlue,
footer .text-brand-accentBlue {
    color: #93C5FD !important; /* Blue 300 */
}

/* Muted / Secondary text on Light Backgrounds: Min 10.5:1 Contrast */
.bg-white .text-slate-400,
.bg-white .text-slate-500,
.bg-white .text-slate-600,
.bg-brand-lightBg .text-slate-400,
.bg-brand-lightBg .text-slate-500,
.bg-brand-lightBg .text-slate-600 {
    color: #1E293B !important; /* Slate 800: 13.5:1 on White */
}

/* Accent blue on Light Backgrounds: 8.2:1 Contrast */
.bg-white .text-brand-accentBlue,
.bg-brand-lightBg .text-brand-accentBlue {
    color: #1E40AF !important; /* Blue 800 */
}

.wa-badge {
    background-color: #B91C1C !important;
    color: #FFFFFF !important;
    font-weight: 800 !important;
}

/* Premium gradient animations */
@keyframes pulseGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.glow-effect {
    position: relative;
}
.glow-effect::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 25px 5px rgba(37, 99, 235, 0.25);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}
.glow-effect:hover::after {
    opacity: 1;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #F8FAFC;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* 4. Accessible Form Inputs
   -------------------------------------------------------------------------- */
/* Invalid styles using :user-invalid for non-annoying validation */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
    border-color: #991B1B !important; /* Crimson Red */
    background-color: #FEF2F2;
}

/* Custom indicator styles */
.input-error-border {
    border-color: #991B1B !important;
}

/* 5. Custom Table Layouts for SEBI Disposal Metrics
   -------------------------------------------------------------------------- */
.sebi-table th, .sebi-table td {
    padding: 1rem 1.25rem;
    text-align: left;
}
.sebi-table tbody tr:nth-child(even) {
    background-color: #F1F5F9;
}
.sebi-table tbody tr:hover {
    background-color: #E2E8F0;
}

/* ==========================================================================
   6. Custom Accessibility Helper Classes (WCAG / ADA / Section 508)
   ========================================================================== */

/* Text Scale Factors */
html.a11y-text-120 {
    font-size: 120% !important;
}
html.a11y-text-150 {
    font-size: 150% !important;
}
html.a11y-text-200 {
    font-size: 200% !important;
}

/* High Contrast Modes */
body.a11y-high-contrast {
    background: #000000 !important;
    color: #FFFFFF !important;
}
body.a11y-high-contrast * {
    background-color: #000000 !important;
    color: #FFFFFF !important;
    border-color: #FFFFFF !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
body.a11y-high-contrast a, 
body.a11y-high-contrast a *, 
body.a11y-high-contrast button, 
body.a11y-high-contrast button * {
    color: #FFFF00 !important; /* Yellow links for standard visibility */
    text-decoration: underline !important;
}
body.a11y-high-contrast a:hover, 
body.a11y-high-contrast button:hover {
    background: #FFFFFF !important;
    color: #000000 !important;
}

/* Monochromatic / Grayscale */
body.a11y-grayscale {
    filter: grayscale(100%) !important;
}

/* Dyslexia Friendly Fonts */
body.a11y-dyslexia, 
body.a11y-dyslexia * {
    font-family: 'Comic Sans MS', 'Dyslexie', 'OpenDyslexic', 'Courier New', sans-serif !important;
}

/* Highlight Links */
body.a11y-highlight-links a,
body.a11y-highlight-links button {
    outline: 3px solid #D97706 !important; /* Amber 600 */
    outline-offset: 3px !important;
    text-decoration: underline !important;
    font-weight: 800 !important;
}

/* Reading Ruler Line */
.a11y-reading-ruler {
    position: fixed;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: #2563EB; /* Bright Blue */
    z-index: 99999;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
}

/* Speaking Highlight */
.a11y-speaking-highlight {
    outline: 2px dashed #2563EB !important;
    outline-offset: 3px !important;
    background-color: rgba(37, 99, 235, 0.08) !important;
}

/* ==========================================================================
   7. WhatsApp Floating Action Button (Standalone, Zero-CDN Dependency)
   ========================================================================== */
.whatsapp-float-btn {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    width: 60px !important;
    height: 60px !important;
    background-color: #25D366 !important;
    color: #FFFFFF !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45), 0 8px 16px rgba(0, 0, 0, 0.25) !important;
    z-index: 9999 !important;
    text-decoration: none !important;
    border: 2px solid #FFFFFF !important;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease !important;
}

.whatsapp-float-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.65), 0 12px 24px rgba(0, 0, 0, 0.35) !important;
    background-color: #20BA5A !important;
}

.whatsapp-float-btn svg {
    width: 32px !important;
    height: 32px !important;
    fill: #FFFFFF !important;
}

.whatsapp-float-badge {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    width: 22px !important;
    height: 22px !important;
    background-color: #DC2626 !important;
    color: #FFFFFF !important;
    border-radius: 50% !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #FFFFFF !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3) !important;
}

/* ==========================================================================
   8. Accessibility Panel Explicit High-Contrast Styling
   ========================================================================== */
#a11y-widget-panel {
    background-color: #0F172A !important;
    color: #FFFFFF !important;
}

#a11y-widget-panel h2,
#a11y-widget-panel h3,
#a11y-widget-panel label {
    color: #FFFFFF !important;
    font-weight: 700 !important;
}

#a11y-widget-panel span,
#a11y-widget-panel p,
#a11y-widget-panel div {
    color: #E2E8F0 !important;
}

#a11y-widget-panel .text-slate-400,
#a11y-widget-panel .text-slate-500 {
    color: #CBD5E1 !important;
}

#a11y-widget-panel button[data-a11y-size],
#a11y-widget-panel button[data-a11y-contrast] {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    font-weight: 700 !important;
}
