/* ═══════════════════════════════════════════════════════════
   COOKIE CONSENT — MaîtresTravaux.com v1.1
   Palette : #0f0f0f | #FBBF24 | #E09200 | #fff | #6b7280 | #22C55E
════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   RESET / ISOLATION
────────────────────────────────────────────── */
.mt-cb *,
.mt-cm * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ══════════════════════════════════════════════
   BANDEAU COOKIES (.mt-cb)
══════════════════════════════════════════════ */
.mt-cb {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    z-index: 99999;
    width: 100%;
    max-width: 900px;
    background: #0f0f0f;
    color: #ffffff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), 0 -2px 12px rgba(251, 191, 36, 0.1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.mt-cb[aria-hidden="true"] {
    pointer-events: none;
}

.mt-cb[aria-hidden="false"] {
    pointer-events: auto;
}

.mt-cb--visible {
    transform: translateX(-50%) translateY(0);
}

/* Inner layout */
.mt-cb__inner {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 24px 28px;
}

/* Contenu gauche */
.mt-cb__content {
    flex: 1;
    min-width: 0;
}

.mt-cb__logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mt-cb__shield {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.mt-cb__brand {
    font-size: 13px;
    font-weight: 700;
    color: #FBBF24;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.mt-cb__text {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 10px;
}

.mt-cb__legal-links {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.mt-cb__legal-links a {
    color: rgba(255, 255, 255, 0.45);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.mt-cb__legal-links a:hover {
    color: #FBBF24;
}

.mt-cb__legal-links span {
    color: rgba(255, 255, 255, 0.25);
}

/* Actions droite */
.mt-cb__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    min-width: 190px;
}

/* ──────────────────────────────────────────────
   BOUTONS
────────────────────────────────────────────── */
.mt-cb__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    border-radius: 10px;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.mt-cb__btn:focus-visible {
    outline: 2px solid #FBBF24;
    outline-offset: 3px;
}

/* Primaire */
.mt-cb__btn--primary {
    background: #FBBF24;
    color: #0f0f0f;
    box-shadow: 0 2px 12px rgba(251, 191, 36, 0.25);
}

.mt-cb__btn--primary:hover {
    background: #E09200;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.35);
}

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

/* Secondaire */
.mt-cb__btn--secondary {
    background: transparent;
    border: 2px solid #FBBF24;
    color: #FBBF24;
}

.mt-cb__btn--secondary:hover {
    background: rgba(251, 191, 36, 0.08);
    transform: translateY(-1px);
}

/* Ghost */
.mt-cb__btn--ghost {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-size: 13px;
    padding: 8px 12px;
}

.mt-cb__btn--ghost:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Bouton "Enregistrer préférences" dans modal */
.mt-cb__btn--save {
    background: #1a1a1a;
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.mt-cb__btn--save:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background: #222222;
}

/* ──────────────────────────────────────────────
   LIEN "GÉRER MES COOKIES" FOOTER
────────────────────────────────────────────── */
.mt-cookie-manage-link {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 12px !important;
    transition: color 0.2s ease !important;
}

.mt-cookie-manage-link:hover {
    color: #FBBF24 !important;
}

.mt-cookie-manage-link i {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4) !important;
}

.mt-cookie-manage-link:hover i {
    color: #FBBF24 !important;
}

/* ══════════════════════════════════════════════
   MODAL PRÉFÉRENCES (.mt-cm)
══════════════════════════════════════════════ */
.mt-cm {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.mt-cm[aria-hidden="false"],
.mt-cm--visible {
    pointer-events: auto;
    opacity: 1;
}

/* Overlay */
.mt-cm__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Panel */
.mt-cm__panel {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.mt-cm--visible .mt-cm__panel,
.mt-cm[aria-hidden="false"] .mt-cm__panel {
    transform: scale(1) translateY(0);
}

.mt-cm__panel::-webkit-scrollbar {
    width: 5px;
}

.mt-cm__panel::-webkit-scrollbar-track {
    background: transparent;
}

.mt-cm__panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

/* Header */
.mt-cm__header {
    background: #0f0f0f;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
    gap: 16px;
}

.mt-cm__header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mt-cm__header-brand svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.mt-cm__title {
    font-size: 16px;
    font-weight: 700;
    color: #FBBF24;
    line-height: 1.3;
    margin: 0;
}

.mt-cm__close {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
    color: #ffffff;
    -webkit-tap-highlight-color: transparent;
}

.mt-cm__close:hover,
.mt-cm__close:active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
}

.mt-cm__close:focus-visible {
    outline: 2px solid #FBBF24;
    outline-offset: 2px;
}

.mt-cm__close svg {
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    fill: none;
    display: block;
}

.mt-cm__close svg path {
    stroke: #ffffff !important;
}

/* Tabs */
.mt-cm__tabs {
    display: flex;
    background: #f8f8f8;
    border-bottom: 2px solid #e5e7eb;
    flex-shrink: 0;
}

.mt-cm__tab {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.mt-cm__tab:hover {
    color: #0f0f0f;
}

.mt-cm__tab.active,
.mt-cm__tab[aria-selected="true"] {
    color: #0f0f0f;
    border-bottom-color: #FBBF24;
    background: #ffffff;
}

/* Body */
.mt-cm__body {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

/* Categories */
.mt-cm__category {
    border-bottom: 1px solid #f0f0f0;
    padding: 18px 24px;
}

.mt-cm__category:last-child {
    border-bottom: none;
}

.mt-cm__cat-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    justify-content: space-between;
}

.mt-cm__cat-info {
    flex: 1;
    min-width: 0;
}

.mt-cm__cat-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.mt-cm__cat-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f0f0f;
}

.mt-cm__always-active {
    font-size: 11px;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid #bbf7d0;
}

.mt-cm__cat-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
}

/* Toggle locked (nécessaires) */
.mt-cm__toggle-locked {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
    color: #22C55E;
    margin-top: 2px;
}

.mt-cm__toggle-locked svg {
    width: 20px;
    height: 20px;
}

/* Toggle switch iOS */
.mt-cm__toggle {
    position: relative;
    display: inline-flex;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 2px;
}

.mt-cm__toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.mt-cm__slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 28px;
    transition: background 0.25s ease;
}

.mt-cm__slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    top: 3px;
    left: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mt-cm__toggle input:checked + .mt-cm__slider {
    background: #FBBF24;
}

.mt-cm__toggle input:checked + .mt-cm__slider::before {
    transform: translateX(20px);
}

.mt-cm__toggle input:focus-visible + .mt-cm__slider {
    outline: 2px solid #FBBF24;
    outline-offset: 2px;
}

/* Details / expand */
.mt-cm__details {
    margin-top: 12px;
}

.mt-cm__details summary {
    font-size: 12px;
    color: #FBBF24;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

.mt-cm__details summary::-webkit-details-marker {
    display: none;
}

.mt-cm__details summary::after {
    content: '▾';
    font-size: 10px;
    transition: transform 0.2s ease;
}

.mt-cm__details[open] summary::after {
    transform: rotate(180deg);
}

.mt-cm__details summary:hover {
    color: #E09200;
}

/* Table cookies */
.mt-cm__table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 11.5px;
}

.mt-cm__table thead th {
    background: #f8f8f8;
    color: #374151;
    font-weight: 700;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mt-cm__table tbody td {
    padding: 7px 10px;
    color: #4b5563;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.mt-cm__table tbody tr:last-child td {
    border-bottom: none;
}

.mt-cm__table tbody td:first-child {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #0f0f0f;
}

/* Tab "À propos" */
.mt-cm__about {
    padding: 24px;
}

.mt-cm__about h3 {
    font-size: 14px;
    font-weight: 700;
    color: #0f0f0f;
    margin-bottom: 8px;
    margin-top: 20px;
}

.mt-cm__about h3:first-child {
    margin-top: 0;
}

.mt-cm__about p {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.65;
}

.mt-cm__about-links {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mt-cm__about-links a {
    font-size: 13px;
    font-weight: 600;
    color: #FBBF24;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mt-cm__about-links a:hover {
    color: #E09200;
    text-decoration: underline;
}

.mt-cm__consent-id {
    margin-top: 20px;
    padding: 12px 14px;
    background: #f8f8f8;
    border-radius: 8px;
    font-size: 10.5px;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    min-height: 36px;
}

/* Footer modal */
.mt-cm__footer {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mt-cm__footer .mt-cb__btn {
    flex: 1;
    min-width: 130px;
    font-size: 13px;
    padding: 11px 16px;
}

.mt-cm__footer .mt-cb__btn--ghost {
    color: #6b7280;
    font-size: 12px;
    flex: 0 0 auto;
    padding: 11px 12px;
}

.mt-cm__footer .mt-cb__btn--ghost:hover {
    color: #374151;
}

/* ══════════════════════════════════════════════
   RESPONSIVE MOBILE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .mt-cb {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }

    .mt-cb--visible {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 768px) {
    .mt-cb__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px 18px;
    }

    .mt-cb__actions {
        min-width: unset;
        width: 100%;
    }

    .mt-cb__btn {
        width: 100%;
        justify-content: center;
    }

    .mt-cb__legal-links {
        flex-wrap: wrap;
    }

    .mt-cm {
        align-items: flex-end;
        padding: 0;
    }

    .mt-cm__panel {
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        max-width: 100%;
    }

    .mt-cm__header {
        border-radius: 16px 16px 0 0;
    }

    .mt-cm__footer {
        border-radius: 0;
        flex-direction: column;
    }

    .mt-cm__footer .mt-cb__btn {
        min-width: unset;
    }

    .mt-cm__footer .mt-cb__btn--ghost {
        order: 3;
    }

    .mt-cm__title {
        font-size: 14px;
    }

    .mt-cm__table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .mt-cb__brand {
        font-size: 11px;
    }

    .mt-cb__text {
        font-size: 12px;
    }

    .mt-cm__category {
        padding: 14px 16px;
    }

    .mt-cm__about {
        padding: 18px 16px;
    }

    .mt-cm__footer {
        padding: 14px 16px;
    }

    .mt-cm__header {
        padding: 16px 18px;
    }
}

/* ──────────────────────────────────────────────
   ACCESSIBILITÉ / RÉDUCTION DE MOUVEMENT
────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .mt-cb,
    .mt-cm,
    .mt-cm__panel,
    .mt-cm__slider,
    .mt-cm__slider::before,
    .mt-cb__btn {
        transition-duration: 0.01ms !important;
    }
}
