/**
 * Global CSS - Accessibility & UI/UX improvements
 * Applied to all documentation pages
 */

/* ==========================================================================
   Skip Link - Navigation clavier
   ========================================================================== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 12px 24px;
    background-color: #7b3b95;
    color: #fff;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* ==========================================================================
   Focus Visible - Accessibilite clavier
   ========================================================================== */
*:focus-visible {
    outline: 3px solid #fe8264;
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Specific focus styles for interactive elements */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #fe8264;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Sidebar links focus */
[data-item-id] a:focus-visible {
    outline: 2px solid #fe8264;
    outline-offset: 1px;
    background-color: rgba(254, 130, 100, 0.1);
}

/* ==========================================================================
   Contrast - Amelioration du contraste WCAG AA
   ========================================================================== */
/* Darker gray for better contrast (from #6b7280 to #4b5563) */
.api-info-description,
.api-info p,
[data-section-id] p {
    color: #4b5563;
}

/* Ensure sufficient contrast for secondary text */
.sc-fmBCVi, /* ReDoc secondary text class */
.sc-bwCtUz {
    color: #4b5563 !important;
}

/* ==========================================================================
   Sidebar - Menu styling
   ========================================================================== */

/* Sidebar container */
.menu-content {
    background-color: #ffffff !important;
}

/* Group headers (SMS, Account, etc.) */
[data-item-id^="group/"] > label {
    background-color: #5a2a6e !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.05em !important;
    padding: 14px 20px !important;
    margin-top: 8px !important;
    border-radius: 0 !important;
}

[data-item-id^="group/"] > label span {
    color: #ffffff !important;
}

[data-item-id^="group/"]:first-child > label {
    margin-top: 0 !important;
}

/* Level 1 items (Send, History, Webhooks...) */
[data-item-id^="tag/"] > label {
    color: #374151 !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

[data-item-id^="tag/"] > label:hover {
    background-color: #f3e8ff !important;
}

[data-item-id^="tag/"] > label span {
    color: #374151 !important;
}

/* Level 2 items (operations) */
[data-item-id*="/operation/"] > label {
    color: #4b5563 !important;
    font-weight: 400 !important;
    transition: all 0.2s ease !important;
}

[data-item-id*="/operation/"] > label:hover {
    background-color: #f3e8ff !important;
}

/* Active item - orange left border */
[data-item-id].active > label,
[data-item-id][aria-current="true"] > label {
    background-color: #f3e8ff !important;
    border-left: 3px solid #fe8264 !important;
    padding-left: 17px !important;
}

[data-item-id].active > label span,
[data-item-id][aria-current="true"] > label span {
    color: #7b3b95 !important;
    font-weight: 600 !important;
}

/* Chevron icons */
.menu-content svg polygon {
    fill: #9ca3af !important;
}

[data-item-id^="group/"] > label svg polygon {
    fill: #ffffff !important;
}

/* Separator between sections */
[data-item-id^="group/"] {
    border-top: 1px solid #eeeef2;
}

[data-item-id^="group/"]:first-child {
    border-top: none;
}

/* HTTP method badges */
.operation-type,
span.operation-type,
span[class*="operation-type"],
.menu-content .operation-type,
[data-item-id] .operation-type {
    font-weight: 600 !important;
    font-size: 10px !important;
    border-radius: 3px !important;
    padding: 4px 6px !important;
    text-transform: uppercase !important;
    width: auto !important;
    min-width: fit-content !important;
    white-space: nowrap !important;
    height: auto !important;
    max-height: 18px !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: flex-start !important;
    flex-shrink: 0 !important;
    margin-top: 2px !important;
    color: #ffffff !important;
}

.operation-type.get {
    background-color: #16a34a !important;
}

.operation-type.post {
    background-color: #186FAF !important;
}

.operation-type.put {
    background-color: #9b5bb5 !important;
}

.operation-type.patch {
    background-color: #f59e0b !important;
}

.operation-type.delete {
    background-color: #dc2626 !important;
}

.operation-type.hook {
    background-color: #7b3b95 !important;
}

/* Top navigation container */
.top-nav {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    gap: 8px;
}

/* Navigation buttons */
.nav-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: #7b3b95;
    color: #ffffff !important;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(123, 59, 149, 0.3);
    transition: all 0.2s ease;
}

.nav-button:hover {
    background-color: #5a2a6e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 59, 149, 0.4);
}

.nav-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Secondary button variant (outline style) */
.nav-button--secondary {
    background-color: transparent;
    color: #7b3b95 !important;
    border: 1px solid #7b3b95;
    box-shadow: none;
}

.nav-button--secondary:hover {
    background-color: #7b3b95;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(123, 59, 149, 0.3);
}

.nav-button--secondary svg {
    width: 14px;
    height: 14px;
}

/* Download button variant */
.nav-button--download {
    background-color: #16a34a;
}

.nav-button--download:hover {
    background-color: #15803d;
}

/* Legacy back-button support */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: #7b3b95;
    color: #ffffff !important;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(123, 59, 149, 0.3);
    transition: all 0.2s ease;
}

.back-button:hover {
    background-color: #5a2a6e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 59, 149, 0.4);
}

.back-button svg {
    width: 16px;
    height: 16px;
}

/* Redocly logo link at bottom */
.menu-content a[href*="redocly"] {
    color: #9ca3af !important;
    font-size: 11px !important;
}

/* ==========================================================================
   Motion - Respect des preferences utilisateur
   ========================================================================== */
@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;
    }
}

/* ==========================================================================
   Print styles
   ========================================================================== */
@media print {
    .skip-link,
    .back-button,
    .top-nav,
    .nav-button {
        display: none !important;
    }
}
