/* ================================================================
   CEZER STAFF — Socle de composants partagés (panel.css)
   Intégré automatiquement via head.ejs. Fournit un langage visuel
   harmonieux pour TOUTES les pages internes du panel.
   ================================================================ */

/* ── Animations ──────────────────────────────────────────── */
@keyframes panelFadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes panelPulseDot {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.15); }
}

/* ════════════════════════════════════════════════════════════════
   EN-TÊTE DE PAGE (standardisé pour toutes les pages internes)
   ════════════════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 0 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    animation: panelFadeInUp 0.35s ease both;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.page-header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--dark);
    color: var(--beige);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.page-header-icon i,
.page-header-icon svg {
    width: 22px;
    height: 22px;
}

.page-header-text h1 {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.page-header-text p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ── Fil d'Ariane ────────────────────────────────────────── */
.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.breadcrumb a {
    color: var(--text-secondary);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb-sep {
    opacity: 0.5;
}

.breadcrumb-sep i,
.breadcrumb-sep svg {
    width: 12px;
    height: 12px;
}

/* ════════════════════════════════════════════════════════════════
   CARTES (cartes génériques cliquables & conteneurs)
   ════════════════════════════════════════════════════════════════ */
.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    animation: panelFadeInUp 0.35s ease both;
}

.panel-card:hover {
    border-color: var(--border-dark);
    box-shadow: var(--shadow-sm);
}

.panel-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-card-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.panel-card-title i,
.panel-card-title svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.panel-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition), gap var(--transition);
}

.panel-card-link:hover {
    color: var(--text-primary);
    gap: 0.45rem;
}

.panel-card-link i,
.panel-card-link svg {
    width: 13px;
    height: 13px;
}

.panel-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.25rem 0.55rem;
    border-radius: 100px;
    background: rgba(46, 125, 79, 0.12);
    color: var(--success);
    border: 1px solid rgba(46, 125, 79, 0.2);
}

.panel-card-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: panelPulseDot 1.8s ease-in-out infinite;
}

.panel-card-body {
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* ════════════════════════════════════════════════════════════════
   GRILLES STANDARDISÉES
   ════════════════════════════════════════════════════════════════ */
.panel-grid {
    display: grid;
    gap: 1rem;
}

.panel-grid-2 { grid-template-columns: repeat(2, 1fr); }
.panel-grid-3 { grid-template-columns: repeat(3, 1fr); }
.panel-grid-4 { grid-template-columns: repeat(4, 1fr); }

.panel-grid-auto {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.panel-grid-auto-lg {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.panel-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* ════════════════════════════════════════════════════════════════
   TUILES MÉTRIQUES (stat tiles)
   ════════════════════════════════════════════════════════════════ */
.stat-tile {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    overflow: hidden;
    animation: panelFadeInUp 0.35s ease both;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-dark);
}

.stat-tile-ico {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--dark);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.stat-tile-ico i,
.stat-tile-ico svg {
    width: 20px;
    height: 20px;
}

.stat-tile-data {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-tile-val {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-tile-lbl {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: none;
    line-height: 1.3;
}

.stat-tile-hint {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 0.2rem;
    line-height: 1.35;
}

.stat-tile-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    margin-top: 0.35rem;
    width: fit-content;
}

.stat-tile-trend-up {
    background: var(--success-bg);
    color: var(--success);
}

.stat-tile-trend-down {
    background: var(--error-bg);
    color: var(--error);
}

.stat-tile-trend-neutral {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
}

.stat-tile-trend i,
.stat-tile-trend svg {
    width: 12px;
    height: 12px;
}

/* Variantes colorées */
.stat-tile.tile-accent .stat-tile-ico {
    background: var(--dark);
    color: var(--beige);
    border-color: var(--dark);
}

.stat-tile.tile-blue .stat-tile-ico   { background: rgba(47, 111, 184, 0.1); color: var(--info); border-color: rgba(47, 111, 184, 0.25); }
.stat-tile.tile-green .stat-tile-ico  { background: rgba(46, 125, 79, 0.1);  color: var(--success); border-color: rgba(46, 125, 79, 0.25); }
.stat-tile.tile-orange .stat-tile-ico { background: rgba(214, 139, 46, 0.1); color: var(--warning); border-color: rgba(214, 139, 46, 0.25); }
.stat-tile.tile-red .stat-tile-ico    { background: rgba(199, 67, 58, 0.1);  color: var(--error); border-color: rgba(199, 67, 58, 0.25); }
.stat-tile.tile-purple .stat-tile-ico { background: rgba(136, 80, 170, 0.1); color: #7e4c9d; border-color: rgba(136, 80, 170, 0.25); }
.stat-tile.tile-teal .stat-tile-ico   { background: rgba(20, 130, 130, 0.1); color: #127070; border-color: rgba(20, 130, 130, 0.25); }
.stat-tile.tile-pink .stat-tile-ico   { background: rgba(199, 76, 125, 0.1); color: #a93d69; border-color: rgba(199, 76, 125, 0.25); }

/* ════════════════════════════════════════════════════════════════
   LISTES GÉNÉRIQUES (list-row)
   ════════════════════════════════════════════════════════════════ */
.list-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius);
    transition: background var(--transition);
    border: 1px solid transparent;
}

.list-row:hover {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
}

.list-row + .list-row {
    margin-top: 0.25rem;
}

.list-row-ico {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
}

.list-row-ico i,
.list-row-ico svg {
    width: 17px;
    height: 17px;
}

.list-row-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
    overflow: hidden;
}

.list-row-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-row-body {
    flex: 1;
    min-width: 0;
}

.list-row-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.list-row-sub {
    font-size: 0.76rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-top: 0.1rem;
}

.list-row-meta {
    font-size: 0.74rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
    text-align: right;
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════
   ÉTATS VIDES (empty states)
   ════════════════════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-tertiary);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}

.empty-state i,
.empty-state svg {
    width: 36px;
    height: 36px;
    opacity: 0.45;
}

.empty-state h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    max-width: 360px;
    line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════
   BADGES (statuts, chips)
   ════════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.22rem 0.65rem;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid transparent;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-neutral {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border);
}

.badge-dark {
    background: var(--dark);
    color: var(--beige);
    border-color: var(--dark);
}

.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-border); }

.badge i,
.badge svg {
    width: 11px;
    height: 11px;
}

/* ════════════════════════════════════════════════════════════════
   ONGLETS (tabs)
   ════════════════════════════════════════════════════════════════ */
.panel-tabs {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.3rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: calc(var(--radius) - 2px);
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: transparent;
}

.panel-tab:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.panel-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.panel-tab i,
.panel-tab svg {
    width: 14px;
    height: 14px;
}

/* ════════════════════════════════════════════════════════════════
   TABLEAU STANDARD
   ════════════════════════════════════════════════════════════════ */
.panel-table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.panel-table thead {
    background: var(--bg-elevated);
}

.panel-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid var(--border);
}

.panel-table td {
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

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

.panel-table tbody tr {
    transition: background var(--transition);
}

.panel-table tbody tr:hover {
    background: var(--bg-elevated);
}

/* ════════════════════════════════════════════════════════════════
   SECTIONS (titres de section)
   ════════════════════════════════════════════════════════════════ */
.panel-section {
    margin-bottom: 2rem;
}

.panel-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-section-head h3 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.panel-section-head h3 i,
.panel-section-head h3 svg {
    width: 17px;
    height: 17px;
    color: var(--text-tertiary);
}

.panel-section-hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ════════════════════════════════════════════════════════════════
   MODALES
   ════════════════════════════════════════════════════════════════ */
.panel-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(41, 41, 41, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: panelFadeInUp 0.2s ease both;
}

.panel-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: panelFadeInUp 0.3s ease both;
}

.panel-modal-head {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-modal-head h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-tertiary);
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.panel-modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.panel-modal-body {
    padding: 1.25rem 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.panel-modal-foot {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-elevated);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ════════════════════════════════════════════════════════════════
   HELPERS PRATIQUES
   ════════════════════════════════════════════════════════════════ */
.muted { color: var(--text-tertiary); }
.numeric { font-variant-numeric: tabular-nums; }

.divider {
    height: 1px;
    background: var(--border);
    margin: 1.25rem 0;
    border: none;
}

/* Avatar circulaire (38px) */
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    font-size: 0.82rem;
    overflow: hidden;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.72rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .panel-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .panel-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .panel-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .page-header-right {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    .panel-grid-2,
    .panel-grid-3,
    .panel-grid-4 {
        grid-template-columns: 1fr;
    }
    .panel-grid-auto,
    .panel-grid-auto-lg {
        grid-template-columns: 1fr;
    }
    .stat-tile-val {
        font-size: 1.45rem;
    }
    .page-header-icon {
        width: 40px;
        height: 40px;
    }
    .page-header-icon i,
    .page-header-icon svg {
        width: 18px;
        height: 18px;
    }
    .page-header-text h1 {
        font-size: 1.25rem;
    }
    .panel-table {
        font-size: 0.82rem;
    }
    .panel-table th,
    .panel-table td {
        padding: 0.65rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .panel-card {
        padding: 1rem 1.1rem;
    }
    .stat-tile {
        padding: 1rem;
    }
    .stat-tile-ico {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
    .stat-tile-val {
        font-size: 1.3rem;
    }
}
