/**
 * ARX Horaires frontend styles.
 *
 * Public components use the .arx-horaires-* prefix and CSS variables
 * instead of hard-coded brand colors. Layout lives on outer blocks;
 * content styles target *-inner children (référentiel ARX).
 */
:root {
    --arx-horaires-primary: #00697A;
    --arx-horaires-secondary: #f0f4fb;
    --arx-horaires-text-light: #ffffff;
    --arx-horaires-text-dark: #222222;
}

.arx-horaires {
    --arx-horaires-layout-gap: clamp(1.5rem, 3vw, 3rem);
    max-width: 100%;
}

.arx-horaires--list > .arx-horaires-inner {
    display: grid;
    gap: var(--arx-horaires-layout-gap);
}

.arx-horaires-item {
    max-width: 100%;
}

.arx-horaires-item-label {
    margin: 0 0 clamp(0.85rem, 2vw, 1.25rem);
    color: var(--arx-horaires-heading-color, var(--arx-horaires-text-dark, #222222));
    font-size: var(--arx-horaires-heading-font-size, clamp(1.25rem, 2.4vw, 1.75rem));
    font-weight: var(--arx-horaires-heading-font-weight, 700);
    line-height: 1.2;
    letter-spacing: var(--arx-horaires-heading-letter-spacing, normal);
}

.arx-horaires-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    border-bottom: 1px solid color-mix(in srgb, var(--arx-horaires-text-dark, #222222) 16%, transparent);
}

.arx-horaires-tab {
    margin: 0;
    padding: 0.75rem 1rem;
    min-height: 44px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0.4rem 0.4rem 0 0;
    background: transparent;
    color: var(--arx-horaires-text-dark, #222222);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.arx-horaires-tab:hover,
.arx-horaires-tab:focus-visible {
    background: var(--arx-horaires-secondary, #f0f4fb);
    color: var(--arx-horaires-primary, #00697A);
}

.arx-horaires-tab:focus-visible {
    outline: 2px solid var(--arx-horaires-primary, #00697A);
    outline-offset: 2px;
}

.arx-horaires-tab.is-active {
    border-bottom-color: var(--arx-horaires-primary, #00697A);
    color: var(--arx-horaires-primary, #00697A);
}

.arx-horaires-tab-panel {
    animation: arx-horaires-tab-fade 180ms ease-out;
}

.arx-horaires-tab-panel[hidden] {
    display: none;
}

@keyframes arx-horaires-tab-fade {
    from {
        opacity: 0;
        transform: translateY(0.35rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.arx-horaires-day-status {
    color: var(--arx-horaires-text-dark, #222222);
}

.arx-horaires-day-status--ouvert {
    color: var(--arx-horaires-primary, #00697A);
}

.arx-horaires-table {
    /* Override these tokens from a theme or page builder when needed. */
    --arx-horaires-table-background: var(--arx-horaires-text-light, #ffffff);
    --arx-horaires-table-header-background: var(--arx-horaires-secondary, #f0f4fb);
    --arx-horaires-table-header-color: var(--arx-horaires-primary, #00697A);
    --arx-horaires-table-text-color: var(--arx-horaires-text-dark, #222222);
    --arx-horaires-table-border-color: color-mix(in srgb, var(--arx-horaires-table-text-color) 16%, transparent);
    --arx-horaires-table-row-border-color: color-mix(in srgb, var(--arx-horaires-table-text-color) 9%, transparent);
    --arx-horaires-table-striped-background: color-mix(in srgb, var(--arx-horaires-table-header-background) 38%, var(--arx-horaires-table-background));
    --arx-horaires-table-radius: 1rem;
    --arx-horaires-table-cell-padding-y: clamp(0.8rem, 1.5vw, 1.25rem);
    --arx-horaires-table-cell-padding-x: clamp(1rem, 2.5vw, 2.25rem);

    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--arx-horaires-table-border-color);
    border-radius: var(--arx-horaires-table-radius);
    background: var(--arx-horaires-table-background);
}

.arx-horaires-table-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-color: var(--arx-horaires-table-border-color) transparent;
    scrollbar-width: thin;
}

.arx-horaires-table table {
    width: 100%;
    min-width: var(--arx-horaires-table-min-width, 40rem);
    border-collapse: separate;
    border-spacing: 0;
    background: var(--arx-horaires-table-background);
}

.arx-horaires-table table,
.arx-horaires-table tr,
.arx-horaires-table td,
.arx-horaires-table th {
    border: 0;
}

.arx-horaires-table tbody tr:not(:first-child) td {
    border-top: 1px solid var(--arx-horaires-table-row-border-color);
}

.arx-horaires-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: var(--arx-horaires-table-cell-padding-y) var(--arx-horaires-table-cell-padding-x);
    background: var(--arx-horaires-table-header-background);
    color: var(--arx-horaires-table-header-color);
    font-size: var(--arx-horaires-table-header-font-size, 1rem);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.arx-horaires-table thead th:first-child,
.arx-horaires-table tbody .arx-horaires-table-day {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 1%;
}

.arx-horaires-table thead th:first-child {
    z-index: 3;
    background: var(--arx-horaires-table-header-background);
}

.arx-horaires-table tbody td {
    padding: var(--arx-horaires-table-cell-padding-y) var(--arx-horaires-table-cell-padding-x);
    background: var(--arx-horaires-table-background);
    color: var(--arx-horaires-table-text-color);
    font-size: var(--arx-horaires-table-font-size, 1rem);
    text-align: left;
    white-space: nowrap;
}

.arx-horaires-table tbody tr:nth-child(even) td {
    background: var(--arx-horaires-table-striped-background);
}

.arx-horaires-table tbody .arx-horaires-table-day {
    font-weight: 700;
    background: var(--arx-horaires-table-background);
}

.arx-horaires-table tbody tr:nth-child(even) .arx-horaires-table-day {
    background: var(--arx-horaires-table-striped-background);
}

@media (hover: hover) {
    .arx-horaires-table tbody tr:hover td {
        background: color-mix(in srgb, var(--arx-horaires-table-header-background) 58%, var(--arx-horaires-table-background));
    }

    .arx-horaires-table tbody tr:hover .arx-horaires-table-day {
        background: color-mix(in srgb, var(--arx-horaires-table-header-background) 58%, var(--arx-horaires-table-background));
    }
}

@media (max-width: 782px) {
    .arx-horaires-table {
        --arx-horaires-table-radius: 0.75rem;
        --arx-horaires-table-cell-padding-x: 0.85rem;
        --arx-horaires-table-cell-padding-y: 0.7rem;
    }

    .arx-horaires-table table {
        min-width: var(--arx-horaires-table-mobile-min-width, 28rem);
    }

    .arx-horaires-table thead th,
    .arx-horaires-table tbody td {
        font-size: var(--arx-horaires-table-font-size, 0.9375rem);
    }

    .arx-horaires-tabs {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.25rem;
        margin-bottom: 1rem;
        padding-bottom: 0;
        border-bottom: 0;
    }

    .arx-horaires-tab {
        flex: 0 0 auto;
        width: 100%;
        padding: 0.75rem 1rem;
        border-bottom: 0;
        border-left: 3px solid transparent;
        border-radius: 0.4rem;
        text-align: left;
    }

    .arx-horaires-tab.is-active {
        border-left-color: var(--arx-horaires-primary, #00697A);
        border-bottom-color: transparent;
        background: var(--arx-horaires-secondary, #f0f4fb);
    }

    .arx-horaires-item-label {
        font-size: var(--arx-horaires-heading-font-size, clamp(1.125rem, 4vw, 1.5rem));
    }
}

@media (max-width: 480px) {
    .arx-horaires-table table {
        min-width: var(--arx-horaires-table-mobile-min-width, 22rem);
    }

    .arx-horaires-table thead th,
    .arx-horaires-table tbody td {
        white-space: normal;
    }

    .arx-horaires-table tbody .arx-horaires-table-day {
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arx-horaires-tab-panel {
        animation: none;
    }
}
