/* =============================================
   ACCESSIBILITY STYLES
   Purpose: Support WCAG 2.1 AA compliance
   Note: All styles are visually neutral
   ============================================= */

/* =============================================
   SKIP LINK - Top Center, Professional Style
   ============================================= */
.skip-link {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #007473 0%, #005a59 100%);
    color: #ffffff;
    padding: 14px 32px;
    z-index: 999999;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 116, 115, 0.4);
    transition: top 0.3s ease-in-out, box-shadow 0.2s ease;
    white-space: nowrap;
}

.skip-link:focus {
    top: 0;
    outline: none;
    box-shadow: 0 4px 25px rgba(0, 116, 115, 0.6), 
                0 0 0 3px #ffffff, 
                0 0 0 6px #007473;
    color: #ffffff;
}

.skip-link:hover {
    background: linear-gradient(135deg, #005a59 0%, #004544 100%);
    color: #ffffff;
    text-decoration: none;
}

/* RTL support for skip link - stays centered */
[dir="rtl"] .skip-link {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

/* =============================================
   SCREEN READER ONLY CONTENT
   ============================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Live region for announcements */
#sr-announcer {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================
   PROFESSIONAL FOCUS INDICATORS
   ============================================= */

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Professional focus ring for keyboard users */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 4px;
}

/* Links - elegant underline + glow */
a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 3px;
    text-decoration: underline;
    text-decoration-color: #007473;
    text-underline-offset: 3px;
}

/* Buttons - prominent focus ring */
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473,
                0 4px 12px rgba(0, 116, 115, 0.3);
    border-radius: 6px;
}

/* Form inputs - clean inset glow */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473,
                inset 0 0 0 1px #007473;
    border-color: #007473 !important;
}

/* Navigation links */
.nav-link:focus-visible,
.navbar-nav .nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 4px;
    background-color: rgba(0, 116, 115, 0.1);
}

/* Dropdown items */
.dropdown-item:focus-visible {
    outline: none;
    box-shadow: inset 4px 0 0 #007473;
    background-color: rgba(0, 116, 115, 0.08);
    border-radius: 0;
}

/* Cards and list items */
.card:focus-visible,
.list-group-item:focus-visible,
.card.membre-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #007473,
                0 8px 25px rgba(0, 116, 115, 0.25);
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Language buttons */
.btn-lang:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 50%;
}

/* Carousel controls */
.carousel-control-prev:focus-visible,
.carousel-control-next:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #ffffff, 
                0 0 0 6px #007473;
    border-radius: 8px;
    opacity: 1;
}

/* Carousel container when focused */
.carousel:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #007473;
    border-radius: 8px;
}

/* Modal close button */
.btn-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 50%;
    opacity: 1;
}

/* Accordion buttons */
.accordion-button:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px #007473;
    border-color: #007473;
}

/* Tabs */
.nav-tabs .nav-link:focus-visible,
.nav-pills .nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
}

/* Pagination */
.page-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    z-index: 3;
    position: relative;
}

/* Main content - no visible outline when jumped to via skip link */
#main-content:focus {
    outline: none;
    box-shadow: none;
}

/* Article content focus */
article:focus-visible,
.article-content:focus-visible,
[role="region"]:focus-visible,
[role="document"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #007473;
    border-radius: 8px;
}

/* Ensure database content is always readable */
[data-db-content],
.article-content,
[role="document"] {
    /* Remove any potential hidden states */
    visibility: visible !important;
    opacity: 1 !important;
}

[data-db-content] *,
.article-content *,
[role="document"] * {
    /* Ensure child content is also visible */
    visibility: inherit;
}

/* Tabindex elements */
[tabindex="0"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 
                0 0 0 4px #007473;
    border-radius: 4px;
}

/* =============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================= */
@media (prefers-contrast: high) {
    .skip-link {
        background: #000000;
        border: 3px solid #ffffff;
    }
    
    .skip-link:focus {
        box-shadow: 0 0 0 3px #ffffff, 
                    0 0 0 6px #000000;
    }
    
    :focus-visible {
        box-shadow: 0 0 0 3px #000000 !important;
        outline: 3px solid #ffffff !important;
        outline-offset: 1px;
    }
}

/* =============================================
   REDUCED MOTION SUPPORT
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .skip-link {
        transition: none;
    }
    
    .carousel-item {
        transition: none;
    }
    
    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        transition: none;
    }
    
    .card:focus-visible,
    .list-group-item:focus-visible {
        transition: none;
        transform: none;
    }
}

/* =============================================
   DARK MODE SUPPORT (if applicable)
   ============================================= */
@media (prefers-color-scheme: dark) {
    .skip-link {
        background: linear-gradient(135deg, #00a3a1 0%, #007473 100%);
    }
    
    :focus-visible {
        box-shadow: 0 0 0 2px #1a1a1a, 
                    0 0 0 4px #00a3a1;
    }
}
