/* Layout backoffice — mobile-first */

:root {
    --bo-header-height: 4.5rem;
    --bo-page-gutter: 1rem;
    --bo-content-max: 90rem;
    --bo-detail-max: 52rem;
}

@media (min-width: 768px) {
    :root {
        --bo-header-height: 5.5rem;
        --bo-page-gutter: 1.5rem;
    }
}

@media (min-width: 1200px) {
    :root {
        --bo-page-gutter: 2rem;
    }
}

/* Header fixe — hauteur cohérente */
.header {
    position: fixed;
    min-height: var(--bo-header-height);
}

.header__container {
    min-height: var(--bo-header-height);
    max-width: none;
    width: 100%;
    padding: 0.65rem var(--bo-page-gutter);
    gap: 0.75rem;
}

.header__logo-img {
    height: 2.5rem;
    max-width: 4.5rem;
}

@media (min-width: 768px) {
    .header__logo-img {
        height: 3.25rem;
        max-width: 5.5rem;
    }
}

.header__nav.active {
    z-index: 101;
    border-top: 1px solid rgba(229, 209, 178, 0.15);
    max-height: calc(100dvh - var(--bo-header-height));
    overflow-y: auto;
}

.header__nav-link {
    display: block;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
}

@media (min-width: 800px) {
    .header__container {
        padding-inline: var(--bo-page-gutter);
    }

    .header__nav {
        gap: 0.35rem;
    }

    .header__nav-link {
        padding: 0.5rem 0.85rem;
        font-size: 0.9rem;
    }
}

/* Contenu sous le header fixe */
.bo-page,
.reports-page,
.report-detail,
.dashboard {
    flex: 1;
    width: 100%;
    padding:
        calc(var(--bo-header-height) + 1.25rem)
        var(--bo-page-gutter)
        2.5rem;
    background-color: var(--talos-bg);
}

.bo-page__container,
.reports-page__container,
.dashboard__container {
    width: 100%;
    max-width: var(--bo-content-max);
    margin: 0 auto;
}

.report-detail__container,
.listing-detail__container {
    width: 100%;
    max-width: var(--bo-detail-max);
    margin: 0 auto;
}

.reports-page__header,
.dashboard__header {
    margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
    .bo-page,
    .reports-page,
    .report-detail,
    .dashboard {
        padding-top: calc(var(--bo-header-height) + 1.75rem);
        padding-bottom: 3rem;
    }

    .reports-page__header,
    .dashboard__header {
        margin-bottom: 2rem;
    }
}

.reports-page__title,
.dashboard__title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    line-height: 1.2;
}

.reports-page__subtitle,
.dashboard__subtitle {
    font-size: clamp(0.95rem, 2.5vw, 1.125rem);
}

/* Stats — 2 colonnes mobile, plus sur desktop */
.stats-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
        gap: 1rem;
    }
}

.stat-card,
a.stat-card {
    padding: 0.85rem;
}

@media (min-width: 768px) {
    .stat-card,
    a.stat-card {
        padding: 1rem;
    }
}

/* Filtres pills — scroll horizontal sur petit écran */
.filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
    margin-inline: calc(var(--bo-page-gutter) * -0.25);
    padding-inline: calc(var(--bo-page-gutter) * 0.25);
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-link {
    flex-shrink: 0;
}

/* Tableaux — cartes empilées sur mobile */
.table-panel {
    border-radius: 0.75rem;
}

.table-responsive {
    margin: 0;
}

@media (max-width: 767px) {
    .data-table--responsive {
        display: block;
        width: 100%;
    }

    .data-table--responsive thead {
        display: none;
    }

    .data-table--responsive tbody {
        display: grid;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .data-table--responsive tbody tr {
        display: grid;
        gap: 0.65rem;
        padding: 1rem;
        border: 1px solid rgba(17, 51, 77, 0.1);
        border-radius: 0.65rem;
        background: var(--gray-50);
    }

    .data-table--responsive tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table--responsive td {
        display: grid;
        grid-template-columns: minmax(5.5rem, 34%) 1fr;
        gap: 0.5rem 0.75rem;
        padding: 0;
        border: none;
        align-items: start;
    }

    .data-table--responsive td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gray-600);
    }

    .data-table--responsive td[data-label=""] {
        grid-template-columns: 1fr;
    }

    .data-table--responsive td.empty-state {
        display: block;
        grid-template-columns: none;
        text-align: center;
        padding: 1.5rem 0.5rem;
    }

    .data-table--responsive td.empty-state::before {
        content: none;
    }

    .listings-table__actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 0.85rem;
        min-width: 0;
    }

    .data-table--responsive td[data-label="Photo"] {
        grid-template-columns: 1fr;
    }

    .data-table--responsive td[data-label="Photo"]::before {
        content: none;
    }

    .listings-table__thumb,
    .listings-table__thumb-placeholder {
        width: 100%;
        max-width: 12rem;
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

@media (min-width: 768px) {
    .data-table th,
    .data-table td {
        padding: 0.9rem 1.1rem;
    }
}

/* Dashboard */
.stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

.dashboard__header {
    text-align: left;
    margin-top: 0;
}

@media (min-width: 768px) {
    .dashboard__sections {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

/* Formulaires recherche annonces */
.listings-search {
    padding: 1rem;
}

.listings-search__row {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .listings-search__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .listings-search__field--grow {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    .listings-search {
        padding: 1.25rem 1.5rem;
    }

    .listings-search__row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .listings-search__field--grow {
        grid-column: span 2;
    }
}

.listings-search__actions {
    width: 100%;
}

.listings-search__actions .btn {
    flex: 1;
    min-height: 2.75rem;
}

@media (min-width: 480px) {
    .listings-search__actions .btn {
        flex: 0 1 auto;
    }
}

/* Détail / formulaires */
.listing-form__grid {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .listing-form__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .listing-detail__container {
        max-width: 56rem;
    }

    .listing-form__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.listing-danger-zone__actions .btn,
.listing-form__actions .btn,
.resolve-form button {
    width: 100%;
    min-height: 2.75rem;
}

@media (min-width: 480px) {
    .listing-danger-zone__actions .btn,
    .listing-form__actions .btn,
    .resolve-form button {
        width: auto;
    }
}

.detail-card {
    padding: 1rem;
}

@media (min-width: 768px) {
    .detail-card {
        padding: 1.5rem;
    }
}

/* Actions icônes — backoffice */
.bo-actions {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bo-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--talos-teal);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bo-icon-action:hover {
    background: rgba(87, 136, 140, 0.12);
    border-color: rgba(87, 136, 140, 0.2);
}

.bo-icon-action--edit {
    color: var(--talos-navy);
}

.bo-icon-action--edit:hover {
    background: rgba(17, 51, 77, 0.08);
    border-color: rgba(17, 51, 77, 0.12);
}

.bo-icon-action--external {
    color: var(--talos-teal);
}

.bo-icon-action--warn {
    color: #b45309;
}

.bo-icon-action--warn:hover {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.2);
}

.bo-icon-action--danger {
    color: #b91c1c;
}

.bo-icon-action--danger:hover {
    background: rgba(185, 28, 28, 0.08);
    border-color: rgba(185, 28, 28, 0.18);
}

.bo-icon-action--success {
    color: #047857;
}

.bo-icon-action--success:hover {
    background: rgba(4, 120, 87, 0.1);
    border-color: rgba(4, 120, 87, 0.2);
}

.listings-inline-form {
    display: inline-flex;
    margin: 0;
}

.listings-table__actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.listing-danger-zone__actions--icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
