/* ============================================================
   ESPACE PRO — Variables couleurs (cohérence avec le site)
   ============================================================ */
:root {
    --ep-beige: #f2ebe2;
    --ep-beige-fonce: #ddd0bc;
    --ep-brun: #5c4433;
    --ep-vert-sauge: #a8b399;
    --ep-vert-sauge-fonce: #6f7c5e;
    --ep-terracotta: #b5714a;
    --ep-rouge: #c0392b;
    --ep-blanc: #ffffff;
    --ep-radius: 12px;
    --ep-shadow: 0 2px 10px rgba(92, 68, 51, 0.08);
}

/* ============================================================
   NOTICE (accès refusé / aucun contenu)
   ============================================================ */
.ep-notice {
    background: var(--ep-beige);
    border-radius: var(--ep-radius);
    padding: 24px;
    text-align: center;
    color: var(--ep-brun);
    font-size: 1rem;
    max-width: 600px;
    margin: 40px auto;
}

.ep-notice a {
    color: var(--ep-terracotta);
    font-weight: 600;
    text-decoration: underline;
}

/* ============================================================
   WRAP GÉNÉRAL DES TABLEAUX
   ============================================================ */
.ep-wrap {
    font-family: 'Jost', 'Poppins', sans-serif;
}

.ep-table-scroll {
    overflow-x: auto;
    border-radius: var(--ep-radius);
    box-shadow: var(--ep-shadow);
}

/* ============================================================
   TABLEAU
   ============================================================ */
.ep-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ep-blanc);
    font-size: 0.92rem;
}

.ep-table thead {
    background: var(--ep-vert-sauge-fonce);
    color: var(--ep-blanc);
}

.ep-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.ep-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ep-beige-fonce);
    color: var(--ep-brun);
    vertical-align: middle;
}

.ep-table tbody tr:hover {
    background: var(--ep-beige);
}

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

.ep-row-updated {
    animation: ep-flash 0.9s ease;
}

@keyframes ep-flash {
    0% { background: rgba(168, 179, 153, 0.4); }
    100% { background: transparent; }
}

/* ============================================================
   STOCK — indicateurs visuels
   ============================================================ */
.ep-stock {
    font-weight: 700;
}

.ep-stock-low {
    color: var(--ep-rouge);
}

.ep-rupture {
    display: inline-block;
    background: var(--ep-rouge);
    color: var(--ep-blanc);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.ep-alerte-wc-stock {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--ep-rouge);
    font-weight: 600;
}

/* ============================================================
   BOUTONS
   ============================================================ */
.ep-btn-vendu,
.ep-btn-recommander,
.ep-btn-detail,
.ep-btn-dl {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.ep-btn-vendu {
    background: var(--ep-vert-sauge);
    color: var(--ep-brun);
}

.ep-btn-vendu:hover:not(:disabled) {
    background: var(--ep-vert-sauge-fonce);
    color: var(--ep-blanc);
    transform: translateY(-1px);
}

.ep-btn-vendu:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ep-btn-recommander {
    background: var(--ep-terracotta);
    color: var(--ep-blanc);
}

.ep-btn-recommander:hover {
    background: #a05f3c;
    transform: translateY(-1px);
    box-shadow: var(--ep-shadow);
}

.ep-btn-detail {
    background: var(--ep-beige-fonce);
    color: var(--ep-brun);
}

.ep-btn-detail:hover {
    background: var(--ep-vert-sauge);
    color: var(--ep-blanc);
}

.ep-btn-dl {
    background: var(--ep-brun);
    color: var(--ep-blanc);
}

.ep-btn-dl:hover {
    background: #46332656;
    background: #463326;
    transform: translateY(-1px);
}

.ep-qte-vendue {
    padding: 6px 8px;
    border: 1px solid var(--ep-beige-fonce);
    border-radius: 6px;
    font-family: inherit;
}

/* ============================================================
   BADGES DE STATUT (factures)
   ============================================================ */
.ep-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.ep-badge-wc-processing {
    background: #fdf1e0;
    color: #b5711f;
}

.ep-badge-wc-completed {
    background: #e8f0e0;
    color: var(--ep-vert-sauge-fonce);
}

/* ============================================================
   BADGE ALERTE SUR ONGLET
   ============================================================ */
.ep-badge-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ep-rouge);
    color: var(--ep-blanc);
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    animation: ep-pulse 2s ease-in-out infinite;
}

@keyframes ep-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================================
   TOOLBAR (recherche + filtres)
   ============================================================ */
.ep-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 18px;
    background: var(--ep-beige);
    border-radius: var(--ep-radius);
}

.ep-search-wrap {
    flex: 1;
    min-width: 220px;
}

.ep-search-wrap input[type="search"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ep-beige-fonce);
    border-radius: 30px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--ep-blanc);
    box-sizing: border-box;
}

.ep-search-wrap input[type="search"]:focus {
    outline: none;
    border-color: var(--ep-terracotta);
    box-shadow: 0 0 0 3px rgba(181, 113, 74, 0.15);
}

.ep-checkbox-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--ep-brun);
    cursor: pointer;
    white-space: nowrap;
}

.ep-checkbox-filter input[type="checkbox"] {
    accent-color: var(--ep-terracotta);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#ep-filter-statut {
    padding: 9px 14px;
    border: 1px solid var(--ep-beige-fonce);
    border-radius: 30px;
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--ep-blanc);
    cursor: pointer;
}

#ep-filter-statut:focus {
    outline: none;
    border-color: var(--ep-terracotta);
}

.ep-results-count {
    font-size: 0.82rem;
    color: var(--ep-vert-sauge-fonce);
    white-space: nowrap;
    margin-left: auto;
}

.ep-no-results {
    text-align: center;
    padding: 30px;
    color: var(--ep-vert-sauge-fonce);
    font-style: italic;
    background: var(--ep-beige);
    border-radius: var(--ep-radius);
    margin-top: 16px;
}

/* ============================================================
   TRI DES COLONNES
   ============================================================ */
.ep-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.ep-sortable:hover {
    background: var(--ep-vert-sauge-fonce);
}

.ep-sortable:focus-visible {
    outline: 2px solid var(--ep-terracotta);
    outline-offset: -2px;
}

.ep-sort-icon {
    font-size: 0.7rem;
    display: inline-block;
    margin-left: 3px;
}

/* ============================================================
   ESPACE PRO — En-tête + Onglets
   ============================================================ */
.ep-espace-pro {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0 60px;
}

.ep-header {
    margin-bottom: 32px;
    text-align: center;
}

.ep-header h2 {
    font-family: 'Jost', 'Poppins', sans-serif;
    color: var(--ep-brun);
    font-size: 1.8rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.ep-header p {
    color: var(--ep-vert-sauge-fonce);
    font-size: 1rem;
    margin: 0;
}

.ep-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--ep-beige-fonce);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.ep-tab-btn {
    background: transparent;
    border: none;
    padding: 14px 24px;
    font-family: 'Jost', 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ep-vert-sauge-fonce);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
}

.ep-tab-btn:hover {
    background: var(--ep-beige);
    color: var(--ep-brun);
}

.ep-tab-btn:focus-visible {
    outline: 2px solid var(--ep-terracotta);
    outline-offset: 2px;
}

.ep-tab-btn.is-active {
    color: var(--ep-brun);
    font-weight: 600;
}

.ep-tab-btn.is-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ep-terracotta);
    border-radius: 3px 3px 0 0;
}

.ep-tab-panel {
    animation: ep-fade-in 0.25s ease;
}

@keyframes ep-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* ============================================================
   RESPONSIVE — Tableaux en cartes sur mobile
   ============================================================ */
@media (max-width: 782px) {
    .ep-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ep-results-count {
        margin-left: 0;
        text-align: right;
    }

    .ep-table thead {
        display: none;
    }

    .ep-table, .ep-table tbody, .ep-table tr, .ep-table td {
        display: block;
        width: 100%;
    }

    .ep-table tr {
        margin-bottom: 16px;
        border: 1px solid var(--ep-beige-fonce);
        border-radius: var(--ep-radius);
        padding: 10px 0;
    }

    .ep-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        border-bottom: 1px solid var(--ep-beige);
        text-align: right;
    }

    .ep-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ep-vert-sauge-fonce);
        text-align: left;
        flex-shrink: 0;
    }

    .ep-table td:last-child {
        border-bottom: none;
    }

    .ep-tabs {
        gap: 4px;
    }

    .ep-tab-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
    }

    .ep-header h2 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .ep-tab-btn {
        font-size: 0.82rem;
        padding: 10px 10px;
    }
}