/* ==========================================
   FICHIER : /css/pages/dashboard.css
   PROJET  : Divine Hair Secrets by Lionne
   Dépend de : main.css (variables CSS globales)
========================================== */


/* ────────────────────────────────────────
   1. LAYOUT
──────────────────────────────────────── */
.dashboard-body {
    display: flex;
    min-height: 100vh;
    background: var(--beige-100);
    overflow-x: hidden;
}

.dash-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 256px;
    background: var(--green-900);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.dash-main {
    margin-left: 256px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


/* ────────────────────────────────────────
   2. SIDEBAR — BRAND
──────────────────────────────────────── */
.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sb-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.15);
}

.sb-brand-name {
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sb-brand-role {
    font-size: .68rem;
    color: var(--gold-500);
    letter-spacing: .06em;
    text-transform: uppercase;
}


/* ────────────────────────────────────────
   3. SIDEBAR — PROFIL ADMIN
   Rempli dynamiquement depuis profiles.full_name
──────────────────────────────────────── */
.sb-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sb-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gold-500);
    color: #fff;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sb-profile-info {
    min-width: 0;
}

.sb-profile-name {
    font-family: var(--font-heading);
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sb-profile-email {
    font-size: .7rem;
    color: rgba(255,255,255,.38);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-top: 2px;
}


/* ────────────────────────────────────────
   4. SIDEBAR — NAVIGATION
──────────────────────────────────────── */
.sb-nav {
    flex: 1;
    padding: 12px 0 8px;
    overflow-y: auto;
}

.sb-nav-label {
    font-family: var(--font-heading);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255,255,255,.22);
    padding: 14px 20px 5px;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: .88rem;
    font-weight: 400;
    color: rgba(255,255,255,.48);
    text-decoration: none;
    transition: var(--transition-fast);
    position: relative;
}

.sb-link .material-icons-round {
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: .55;
    transition: opacity .2s;
}

.sb-link:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
}

.sb-link:hover .material-icons-round {
    opacity: 1;
}

.sb-link.active {
    color: #fff;
    background: rgba(197,160,89,.12);
    font-weight: 600;
    border-left: 3px solid var(--gold-500);
    padding-left: 17px;
}

.sb-link.active .material-icons-round {
    opacity: 1;
    color: var(--gold-500);
}

.sb-badge {
    margin-left: auto;
    background: var(--gold-500);
    color: #fff;
    font-family: var(--font-heading);
    font-size: .65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}


/* ────────────────────────────────────────
   5. SIDEBAR — FOOTER (LOGOUT)
──────────────────────────────────────── */
.sb-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sb-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: .86rem;
    font-weight: 500;
    color: rgba(255,255,255,.38);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
}

.sb-logout-btn:hover {
    background: rgba(200,50,50,.12);
    color: #e07070;
}

.sb-logout-btn .material-icons-round {
    font-size: 1.05rem;
}

/* Overlay mobile */
.sb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 290;
}


/* ────────────────────────────────────────
   6. TOPBAR
──────────────────────────────────────── */
.dash-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    height: 62px;
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid rgba(22,53,40,.08);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.topbar-burger {
    display: none;
    background: none;
    border: none;
    color: var(--green-950);
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.topbar-burger:hover { background: var(--beige-100); }

.topbar-burger .material-icons-round { font-size: 1.4rem; }

.topbar-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--green-950);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--beige-100);
    border: 1px solid rgba(22,53,40,.1);
    color: var(--green-900);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.topbar-icon-btn:hover { background: var(--white); border-color: var(--green-900); }
.topbar-icon-btn .material-icons-round { font-size: 1.05rem; }

.btn-add-product {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--green-900);
    color: #fff;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-add-product:hover {
    background: var(--gold-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-add-product .material-icons-round { font-size: .95rem; }


/* ────────────────────────────────────────
   7. CONTENU / SECTIONS
──────────────────────────────────────── */
.dash-content {
    padding: 26px 28px 60px;
    flex: 1;
}

.dash-section {
    display: none;
}

.dash-section.active {
    display: block;
    animation: sectionIn .3s ease;
}

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}


/* ────────────────────────────────────────
   8. STATISTIQUES
──────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid rgba(22,53,40,.05);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Trait couleur en haut */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.card-green::before  { background: var(--green-900); }
.card-gold::before   { background: var(--gold-500); }
.card-brown::before  { background: var(--brown-500); }
.card-grey::before   { background: #bbb; }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.card-green .stat-icon  { background: rgba(22,53,40,.07); color: var(--green-900); }
.card-gold .stat-icon   { background: rgba(197,160,89,.12); color: #957200; }
.card-brown .stat-icon  { background: rgba(74,43,35,.07); color: var(--brown-500); }
.card-grey .stat-icon   { background: rgba(0,0,0,.05); color: #888; }

.stat-icon .material-icons-round { font-size: 1.35rem; }

.stat-num {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--green-950);
    line-height: 1;
    display: block;
    margin-bottom: 3px;
}

.stat-lbl {
    font-size: .75rem;
    color: #999;
}


/* ────────────────────────────────────────
   9. DATA CARD (TABLEAU)
──────────────────────────────────────── */
.data-card {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(22,53,40,.05);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(22,53,40,.06);
}

.data-card-title {
    font-family: var(--font-heading);
    font-size: .95rem;
    font-weight: 700;
    color: var(--green-950);
}

.filter-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 5px 14px;
    font-family: var(--font-heading);
    font-size: .72rem;
    font-weight: 600;
    color: var(--brown-500);
    background: var(--beige-100);
    border: 1.5px solid rgba(22,53,40,.1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-tab:hover { border-color: var(--green-900); color: var(--green-900); }

.filter-tab.active {
    background: var(--green-900);
    color: #fff;
    border-color: var(--green-900);
}


/* ────────────────────────────────────────
   10. TABLE
──────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead { background: var(--beige-100); }

th {
    padding: 11px 16px;
    font-family: var(--font-heading);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #999;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid rgba(22,53,40,.06);
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(22,53,40,.04);
    vertical-align: middle;
    font-size: .88rem;
    color: var(--brown-900);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(22,53,40,.015); }

/* Miniature produit */
.tbl-thumb {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid rgba(22,53,40,.08);
    display: block;
}

.tbl-thumb-ph {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    background: var(--beige-100);
    border: 1px dashed rgba(22,53,40,.15);
    display: flex; align-items: center; justify-content: center;
    color: #ccc;
}

.tbl-thumb-ph .material-icons-round { font-size: 1.3rem; }

/* Nom + desc */
.tbl-name {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--green-950);
    font-size: .88rem;
    display: block;
    margin-bottom: 2px;
}

.tbl-short {
    font-size: .74rem;
    color: #aaa;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Badge catégorie */
.cat-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cat-extensions { background: rgba(22,53,40,.08); color: var(--green-900); }
.cat-accessoires { background: rgba(197,160,89,.12); color: #957200; }
.cat-soins { background: rgba(74,43,35,.08); color: var(--brown-500); }

/* Prix */
.price-normal { font-family: var(--font-heading); font-weight: 700; color: var(--green-900); font-size: .88rem; }
.price-promo  { font-family: var(--font-heading); font-weight: 700; color: #c0392b; font-size: .88rem; display: block; }
.price-old    { font-size: .74rem; color: #ccc; text-decoration: line-through; }

/* Badge statut */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-active   { background: rgba(22,53,40,.08); color: var(--green-900); }
.status-inactive { background: rgba(0,0,0,.05); color: #aaa; }
.status-badge .material-icons-round { font-size: .78rem; }

/* Boutons action tableau */
.tbl-actions { display: flex; gap: 6px; align-items: center; }

.tbl-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.tbl-btn .material-icons-round { font-size: .95rem; }

.tbl-btn.edit   { background: rgba(22,53,40,.07); color: var(--green-900); }
.tbl-btn.edit:hover   { background: var(--green-900); color: #fff; }
.tbl-btn.remove { background: rgba(192,57,43,.07); color: #c0392b; }
.tbl-btn.remove:hover { background: #c0392b; color: #fff; }

/* Avatar utilisateur */
.user-av {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--green-900);
    color: #fff;
    font-family: var(--font-heading);
    font-size: .75rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}

.role-admin {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    background: rgba(197,160,89,.12); color: #957200;
    font-size: .74rem; font-weight: 700;
}

.role-user {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px;
    background: rgba(22,53,40,.06); color: var(--green-900);
    font-size: .74rem; font-weight: 600;
}

.role-admin .material-icons-round,
.role-user  .material-icons-round { font-size: .78rem; }

/* Loader table */
.tbl-loader {
    padding: 40px;
    display: flex;
    justify-content: center;
    gap: 7px;
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green-900);
    animation: dotPulse .8s ease-in-out infinite;
    opacity: .35;
}

.dot:nth-child(2) { animation-delay: .15s; }
.dot:nth-child(3) { animation-delay: .30s; }

@keyframes dotPulse {
    0%, 100% { transform: translateY(0); opacity: .35; }
    50% { transform: translateY(-9px); opacity: 1; }
}

/* Vide */
.tbl-empty {
    padding: 48px 24px;
    text-align: center;
    color: #bbb;
}

.tbl-empty .material-icons-round {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
    opacity: .25;
    color: var(--green-900);
}

.tbl-empty p { font-size: .88rem; }


/* ────────────────────────────────────────
   11. MODAL
──────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.open {
    display: flex;
    animation: bdIn .2s ease;
}

@keyframes bdIn { from{opacity:0} to{opacity:1} }

.modal-box {
    background: #fff;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    animation: boxIn .28s ease;
}

.modal-sm { max-width: 400px; }

@keyframes boxIn {
    from { opacity:0; transform:translateY(18px) scale(.97); }
    to   { opacity:1; transform:none; }
}

.modal-box::-webkit-scrollbar { width: 4px; }
.modal-box::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(22,53,40,.07);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--green-950);
}

.modal-title.danger { color: #c0392b; }

.modal-close-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--beige-100);
    border: none;
    color: #aaa;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.modal-close-btn:hover { background: #eee; color: var(--green-950); }
.modal-close-btn .material-icons-round { font-size: 1.05rem; }

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 18px;
    margin-top: 20px;
    border-top: 1px solid rgba(22,53,40,.06);
}

.confirm-msg {
    padding: 14px 22px;
    font-size: .9rem;
    color: #666;
    line-height: 1.55;
}


/* ────────────────────────────────────────
   12. FORMULAIRE PRODUIT
──────────────────────────────────────── */
#product-form { padding: 18px 22px; }

.form-section-label {
    font-family: var(--font-heading);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--green-900);
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1.5px solid rgba(22,53,40,.08);
}

.form-section-label:first-child { margin-top: 0; }

/* Zone upload */
.upload-zone {
    border: 2px dashed rgba(22,53,40,.16);
    border-radius: var(--radius-sm);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--beige-100);
    transition: var(--transition-fast);
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover {
    border-color: var(--green-900);
    background: rgba(22,53,40,.03);
}

.upload-ic {
    font-size: 2rem !important;
    color: var(--green-900);
    opacity: .45;
    display: block;
    margin: 0 auto 6px;
}

.upload-txt {
    font-family: var(--font-heading);
    font-size: .84rem;
    font-weight: 600;
    color: var(--green-950);
    margin-bottom: 3px;
}

.upload-sub { font-size: .72rem; color: #aaa; }

.img-preview {
    display: none;
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

/* ── Zone galerie ── */
.gallery-upload-zone {
    border: 2px dashed rgba(22,53,40,.13);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(197,160,89,.04);
    transition: var(--transition-fast);
    margin-bottom: 12px;
}

.gallery-upload-zone:hover {
    border-color: var(--gold-500);
    background: rgba(197,160,89,.08);
}

.gallery-upload-zone .material-icons-round {
    font-size: 1.8rem;
    color: var(--gold-500);
    opacity: .6;
    display: block;
    margin: 0 auto 5px;
}

/* Grille prévisualisations galerie */
.gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.gallery-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid rgba(22,53,40,.1);
    background: var(--beige-100);
}

.gallery-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bouton supprimer sur chaque miniature */
.gallery-preview-item .gallery-remove {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(192,57,43,.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem;
    transition: background .15s;
    backdrop-filter: blur(2px);
}

.gallery-preview-item .gallery-remove:hover { background: #c0392b; }
.gallery-preview-item .gallery-remove .material-icons-round { font-size: .78rem; }

/* Badge numéro sur la miniature */
.gallery-preview-item .gallery-num {
    position: absolute;
    bottom: 3px; left: 3px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-family: var(--font-heading);
    font-size: .58rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* Galerie existante (mode édition) */
.gallery-existing {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.gallery-existing-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid rgba(22,53,40,.1);
}

.gallery-existing-item img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}

.gallery-existing-item .gallery-remove {
    position: absolute; top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(192,57,43,.85); color: #fff;
    border: none; border-radius: 50%;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background .15s;
}

.gallery-existing-item .gallery-remove:hover { background: #c0392b; }
.gallery-existing-item .gallery-remove .material-icons-round { font-size: .78rem; }

/* Message "aucune photo galerie" */
.gallery-empty-msg {
    font-size: .76rem;
    color: #bbb;
    font-style: italic;
    text-align: center;
    padding: 4px 0 8px;
}

/* Grille formulaire */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group.span-2 { grid-column: 1 / -1; }

.form-lbl {
    font-family: var(--font-heading);
    font-size: .72rem;
    font-weight: 700;
    color: var(--brown-500);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.form-hint-lbl {
    font-weight: 400;
    font-size: .68rem;
    color: #bbb;
    text-transform: none;
    letter-spacing: 0;
}

.form-ctrl {
    padding: 9px 12px;
    border: 1.5px solid rgba(22,53,40,.12);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .88rem;
    color: var(--brown-900);
    background: #fff;
    outline: none;
    width: 100%;
    transition: var(--transition-fast);
}

.form-ctrl:focus {
    border-color: var(--green-900);
    box-shadow: 0 0 0 3px rgba(22,53,40,.06);
}

.form-ctrl:hover:not(:focus) { border-color: rgba(22,53,40,.24); }
.form-ctrl::placeholder { color: #ccc; }

textarea.form-ctrl { resize: vertical; min-height: 70px; line-height: 1.5; }
select.form-ctrl { cursor: pointer; }

/* Toggle is_active */
.form-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid rgba(22,53,40,.06);
    margin-top: 4px;
}

.toggle-switch { position: relative; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
    display: block;
    width: 44px; height: 24px;
    background: #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: background .25s;
    position: relative;
}

.toggle-switch input:checked + .toggle-track { background: var(--green-900); }

.toggle-thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: transform .25s ease;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(20px); }


/* ────────────────────────────────────────
   13. BOUTONS MODAL
──────────────────────────────────────── */
.btn-cancel {
    padding: 9px 20px;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 600;
    color: #888;
    background: var(--beige-100);
    border: 1px solid rgba(22,53,40,.1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-cancel:hover { background: #eee; color: var(--green-950); }

.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    background: var(--green-900);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-save:hover { background: var(--gold-500); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-save:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-save .material-icons-round { font-size: .95rem; }

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    font-family: var(--font-heading);
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    background: #c0392b;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-delete:hover { background: #a93226; }
.btn-delete .material-icons-round { font-size: .95rem; }


/* ────────────────────────────────────────
   14. TOASTS
──────────────────────────────────────── */
#toast-root {
    position: fixed;
    bottom: 22px; right: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 16px;
    background: #fff;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--green-900);
    box-shadow: 0 6px 22px rgba(0,0,0,.12);
    min-width: 260px;
    max-width: 340px;
    pointer-events: all;
    animation: tIn .32s ease;
}

.toast.error   { border-left-color: #c0392b; }
.toast.success { border-left-color: var(--green-900); }
.toast.removing { animation: tOut .24s ease forwards; }

@keyframes tIn  { from{opacity:0;transform:translateY(10px) scale(.96)} to{opacity:1;transform:none} }
@keyframes tOut { to{opacity:0;transform:translateY(8px) scale(.96)} }

.toast .material-icons-round { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.toast.success .material-icons-round { color: var(--green-900); }
.toast.error   .material-icons-round { color: #c0392b; }

.t-title { font-family: var(--font-heading); font-size: .82rem; font-weight: 700; color: var(--green-950); margin-bottom: 2px; }
.t-desc  { font-size: .76rem; color: #999; }

.t-body { flex: 1; min-width: 0; }

.t-close {
    background: none; border: none;
    color: #ccc; cursor: pointer;
    flex-shrink: 0; padding: 1px;
    transition: color .15s;
}

.t-close:hover { color: var(--green-950); }
.t-close .material-icons-round { font-size: .9rem; }


/* ────────────────────────────────────────
   15. RESPONSIVE
──────────────────────────────────────── */
/* ────────────────────────────────────────
   RESPONSIVE — TABLETTE (≤ 1100px)
──────────────────────────────────────── */
/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */

/* ── Tablette large (≤ 1100px) ── */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ── Tablette portrait (≤ 900px) ── */
@media (max-width: 900px) {

    /* Sidebar : drawer hors écran */
    .dash-sidebar {
        transform: translateX(-100%);
        width: 270px;
        box-shadow: 4px 0 24px rgba(0,0,0,.2);
    }
    .dash-sidebar.open { transform: translateX(0); }
    .sb-overlay.open   { display: block; }

    /* Main pleine largeur */
    .dash-main     { margin-left: 0; }

    /* Burger visible */
    .topbar-burger { display: flex; }

    /* Topbar */
    .dash-topbar   { padding: 0 16px; height: 56px; }

    /* Contenu */
    .dash-content  { padding: 18px 16px 80px; }

    /* Data card header en colonne */
    .data-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px;
    }

    .filter-tabs { flex-wrap: wrap; }
}


/* ── Smartphone (≤ 640px) ── */
@media (max-width: 640px) {

    /* ─ Stats ─ */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card  { padding: 14px 12px; gap: 10px; }
    .stat-icon  { width: 36px; height: 36px; }
    .stat-icon .material-icons-round { font-size: 1rem; }
    .stat-num   { font-size: 1.35rem; }
    .stat-lbl   { font-size: .68rem; }

    /* ─ Topbar ─ */
    .dash-topbar     { padding: 0 12px; height: 52px; }
    .topbar-title    { font-size: .88rem; }
    .topbar-icon-btn { width: 32px; height: 32px; }
    .topbar-right    { gap: 7px; }

    /* Bouton "Nouveau produit" → rond icône seule */
    .btn-add-product .btn-label { display: none; }
    .btn-add-product {
        width: 36px; height: 36px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    /* ─ Data card ─ */
    .data-card-header { padding: 12px 14px; }
    .data-card-title  { font-size: .88rem; }
    .filter-tab       { padding: 4px 10px; font-size: .68rem; }

    /* ─ Table scroll ─ */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Empêche le débordement du conteneur parent */
        max-width: 100%;
    }

    /* La table elle-même ne force pas de largeur minimale */
    table { min-width: 0; }

    /* ─ Table PRODUITS (section-products) ─
       On garde : image, nom, statut, actions
       On masque : catégorie, prix, stock      */
    #section-products table thead tr th:nth-child(3),
    #section-products table thead tr th:nth-child(4),
    #section-products table thead tr th:nth-child(5),
    #section-products table tbody tr td:nth-child(3),
    #section-products table tbody tr td:nth-child(4),
    #section-products table tbody tr td:nth-child(5) {
        display: none;
    }

    /* ─ Table UTILISATEURS (section-users) ─
       ≤ 640px : garde Avatar + Nom + Rôle
       On masque : Email (col 3) + Inscription (col 5) */
    #section-users table thead tr th:nth-child(3),
    #section-users table tbody tr td:nth-child(3),
    #section-users table thead tr th:nth-child(5),
    #section-users table tbody tr td:nth-child(5) {
        display: none;
    }

    /* Colonnes restantes */
    th { padding: 9px 10px; font-size: .62rem; }
    td { padding: 11px 10px; font-size: .82rem; }

    /* Empêcher les cellules de texte long de déborder */
    td { max-width: 0; }
    td > span, td > div { 
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
        display: block;
    }

    /* Miniatures */
    .tbl-thumb,
    .tbl-thumb-ph { width: 40px; height: 40px; }
    .tbl-short    { max-width: 100px; font-size: .7rem; }
    .tbl-name     { font-size: .82rem; }

    /* Boutons action */
    .tbl-btn { width: 30px; height: 30px; }
    .tbl-btn .material-icons-round { font-size: .88rem; }

    /* ─ Modal : bottom sheet ─ */
    .modal-backdrop { align-items: flex-end; padding: 0; }

    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        animation: sheetUp .32s ease;
    }

    .modal-sm { border-radius: 20px 20px 0 0; }

    @keyframes sheetUp {
        from { transform: translateY(100%); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .modal-head  { padding: 16px 18px; position: sticky; top: 0; background: #fff; z-index: 2; }
    .modal-title { font-size: .92rem; }
    #product-form { padding: 14px 18px; }
    .confirm-msg  { padding: 12px 18px; font-size: .86rem; }

    /* Pied modal : boutons pleine largeur */
    .modal-foot {
        flex-direction: column-reverse;
        gap: 8px;
        padding-top: 14px;
    }

    .modal-foot .btn-cancel,
    .modal-foot .btn-save,
    .modal-foot .btn-delete {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    /* ─ Formulaire produit ─ */
    .form-section-label { font-size: .64rem; margin: 14px 0 8px; }
    .form-grid          { grid-template-columns: 1fr; gap: 10px; }
    .form-group.span-2  { grid-column: 1; }
    .form-lbl           { font-size: .68rem; }
    .form-ctrl          { padding: 10px 12px; font-size: .88rem; }
    textarea.form-ctrl  { min-height: 64px; }

    /* Upload */
    .upload-zone        { padding: 18px 12px; }
    .upload-ic          { font-size: 1.6rem !important; }
    .upload-txt         { font-size: .8rem; }
    .upload-sub         { font-size: .68rem; }
    .img-preview        { max-height: 120px; }

    /* Galerie */
    .gallery-upload-zone  { padding: 12px; }
    .gallery-preview-grid,
    .gallery-existing     { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }

    /* Toggle */
    .form-toggle-row { gap: 10px; }
}


/* ── Très petit (≤ 400px) ── */
@media (max-width: 400px) {

    /* Stats : 1 colonne */
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card  { flex-direction: row; }

    /* Topbar */
    .topbar-title { font-size: .8rem; }

    /* Sidebar */
    .dash-sidebar  { width: 240px; }
    .sb-logo-img   { width: 36px; height: 36px; }
    .sb-brand-name { font-size: .75rem; }

    /* Table produits : on masque aussi la colonne statut,
       on ne garde que image + nom + actions */
    #section-products table thead tr th:nth-child(6),
    #section-products table tbody tr td:nth-child(6) {
        display: none;
    }

    /* Table utilisateurs : on masque aussi le rôle,
       on ne garde que Avatar + Nom complet */
    #section-users table thead tr th:nth-child(4),
    #section-users table tbody tr td:nth-child(4) {
        display: none;
    }

    /* Miniatures encore plus petites */
    .tbl-thumb,
    .tbl-thumb-ph { width: 34px; height: 34px; }

    .tbl-btn { width: 28px; height: 28px; }
    .tbl-btn .material-icons-round { font-size: .8rem; }

    /* Formulaire : padding réduit */
    #product-form  { padding: 12px 14px; }
    .modal-head    { padding: 14px 16px; }
}

/* ── Modal Blog : même taille que modal Produit ── */
#blog-form { padding: 18px 22px; }

#blog-form textarea.form-ctrl {
    min-height: 120px;
    max-height: 220px;
    resize: vertical;
}


/* ══════════════════════════════════════════════
   RESPONSIVE — TABLE BLOG
   Colonnes : Image(1) Titre(2) Cat(3) Lecture(4)
              Statut(5) Date(6) Actions(7)
══════════════════════════════════════════════ */

/* ── ≤ 640px : garde Image + Titre + Statut + Actions
       masque Catégorie(3), Lecture(4), Date(6) ── */
@media (max-width: 640px) {

    #section-blog table thead tr th:nth-child(3),
    #section-blog table tbody tr td:nth-child(3),
    #section-blog table thead tr th:nth-child(4),
    #section-blog table tbody tr td:nth-child(4),
    #section-blog table thead tr th:nth-child(6),
    #section-blog table tbody tr td:nth-child(6) {
        display: none;
    }
}

/* ── ≤ 400px : masque aussi Statut(5)
       ne garde que Image + Titre + Actions ── */
@media (max-width: 400px) {

    #section-blog table thead tr th:nth-child(5),
    #section-blog table tbody tr td:nth-child(5) {
        display: none;
    }
}


/* ══════════════════════════════════════════════
   NEWSLETTER — STYLES
══════════════════════════════════════════════ */

/* Textarea newsletter : taille cohérente */
#nl-content {
    min-height: 160px;
    max-height: 300px;
    resize: vertical;
}

/* Info inscrits */
#nl-subscriber-info strong {
    color: var(--green-900);
}

/* ── Responsive newsletter ≤ 640px ── */
@media (max-width: 640px) {

    /* Formulaire newsletter : padding réduit */
    #section-newsletter .data-card > div[style*="padding:22px"] {
        padding: 14px !important;
    }

    /* Bouton envoi pleine largeur sur mobile */
    #section-newsletter [style*="display:flex"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    #btn-send-newsletter {
        width: 100%;
        justify-content: center;
    }

    /* Table inscrits : date masquée sur petit écran,
       seul l'email reste visible */
    #section-newsletter table thead tr th:nth-child(2),
    #section-newsletter table tbody tr td:nth-child(2) {
        display: none;
    }

    /* Textarea moins haute sur mobile */
    #nl-content { min-height: 100px; max-height: 200px; }
}

/* ── Responsive newsletter ≤ 400px ── */
@media (max-width: 400px) {
    #nl-content { min-height: 80px; }
}