/* Pcfact — overrides charte Provence Cloud (v1.25 + thème bleu v1.28 + v1.30 thème global). */

:root {
    /* Thème vert (défaut, charte historique Provence Cloud) */
    --pc-primary: #00897B;
    --pc-primary-dark: #00695C;
    --pc-primary-light: #4DB6AC;
    --pc-primary-ring: rgba(0, 137, 123, 0.35);
    --pc-slate: #37474F;
    --pc-slate-dark: #263238;
    --pc-accent-bg: #F5F5F5;
}

/* Thème bleu (azur Provence) — opt-in via data-theme="bleu" sur <body>. */
body[data-theme="bleu"] {
    --pc-primary: #1565C0;
    --pc-primary-dark: #0D47A1;
    --pc-primary-light: #64B5F6;
    --pc-primary-ring: rgba(21, 101, 192, 0.35);
    --pc-slate: #1A2D3F;
    --pc-slate-dark: #102030;
}

body {
    font-family: "Roboto", "Liberation Sans", "DejaVu Sans", Arial, sans-serif;
    color: #263238;
}

/* ============================================================================
 * Overrides Tailwind « teal-x / slate-x » vers variables de thème.
 * On préfixe par `body` pour garantir la spécificité contre les utilitaires
 * Tailwind pré-compilés.
 * ============================================================================ */

/* Header principal */
body header.bg-slate-800 { background: var(--pc-slate-dark); }

/* Branding teal */
body .text-teal-300 { color: var(--pc-primary-light) !important; }
body .text-teal-500 { color: var(--pc-primary) !important; }
body .text-teal-600 { color: var(--pc-primary-dark) !important; }
body .text-teal-700 { color: var(--pc-primary-dark) !important; }
body .text-teal-800 { color: var(--pc-primary-dark) !important; }

body .bg-teal-500 { background-color: var(--pc-primary) !important; }
body .bg-teal-700 { background-color: var(--pc-primary) !important; }
body .bg-teal-800 { background-color: var(--pc-primary-dark) !important; }

body .hover\:bg-teal-700:hover { background-color: var(--pc-primary) !important; }
body .hover\:bg-teal-800:hover { background-color: var(--pc-primary-dark) !important; }
body .hover\:text-teal-300:hover { color: var(--pc-primary-light) !important; }

body .focus\:ring-teal-500:focus { --tw-ring-color: var(--pc-primary-ring) !important; }
body .focus\:border-teal-500:focus { border-color: var(--pc-primary) !important; }

/* Bandeau-titre PCFACT (sous le header) */
.pc-banner {
    background: var(--pc-slate);
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.pc-banner img.logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 7.5rem;
    max-height: 3rem;
    object-fit: contain;
    flex: 0 0 auto;
}
.pc-banner .titles { line-height: 1.15; }
.pc-banner .brand   { font-weight: 700; font-size: 1.4rem; letter-spacing: 0.04em; }
.pc-banner .subbrand{ font-size: 0.9rem; opacity: 0.9; }
.pc-banner .version { font-size: 0.7rem; opacity: 0.65; }

/* Cartes dashboard avec bordure gauche teal */
.pc-card {
    background: #fff;
    border-left: 4px solid var(--pc-primary);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    padding: 1rem;
}

/* ============================================================================
 * Composants Pcfact — source de vérité unique (plain CSS, plus de @apply).
 * .btn-*, .input, table.tbl : tout est défini ici, sans dépendre de la
 * compilation Tailwind d'utilitaires (le bloc <style> @apply de base.html
 * a été supprimé en v1.30).
 * ============================================================================ */
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.95rem;
    line-height: 1.2;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.btn-primary  { background: var(--pc-primary); color: #fff; }
.btn-primary:hover { background: var(--pc-primary-dark); }
.btn-secondary { background: #ECEFF1; color: var(--pc-slate-dark); }
.btn-secondary:hover { background: #CFD8DC; }
.btn-danger   { background: #E53935; color: #fff; }
.btn-danger:hover { background: #C62828; }
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.input {
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 0.375rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.95rem;
    background: #fff;
    color: #263238;
}
.input:focus {
    outline: none;
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 2px var(--pc-primary-ring);
}

/* ============================================================================
 * Tableaux .tbl : largeur fluide, responsive, lignes confortables.
 * ============================================================================ */
table.tbl {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
table.tbl thead th {
    background: var(--pc-primary);
    color: #fff;
    text-align: left;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
}
table.tbl tbody td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #E0E0E0;
    vertical-align: top;
}
table.tbl tbody tr:nth-child(even) td { background: #FAFAFA; }
table.tbl tbody tr:hover td { background: #F1F8F7; }

/* Cellules nowrap pour montants, dates, statuts, états */
table.tbl td.nowrap,
table.tbl th.nowrap,
table.tbl td.text-right,
table.tbl th.text-right { white-space: nowrap; }

/* Cellule extensible : permet à la 1re colonne (désignation / nom) de grossir */
table.tbl td.fluid, table.tbl th.fluid { width: 100%; }

/* Conteneur scrollable horizontal pour mobile */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap > table.tbl { min-width: 640px; }

/* Carte de login centrée */
.pc-login-wrap {
    min-height: 100vh;
    background: var(--pc-slate);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.pc-login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 22rem;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    text-align: center;
}
.pc-login-card img.logo {
    width: auto;
    height: auto;
    max-width: 8.5rem;
    max-height: 4.5rem;
    margin: 0 auto 1rem;
    display: block;
}
.pc-login-card .pc-brand { font-weight: 700; font-size: 1.4rem; color: var(--pc-slate); }
.pc-login-card .pc-subbrand { font-size: 0.85rem; color: #607D8B; margin-bottom: 1.5rem; }
.pc-login-error {
    background: #FFEBEE;
    color: #B71C1C;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.pc-login-form { text-align: left; }
.pc-login-form label {
    display: block;
    font-size: 0.85rem;
    color: #455A64;
    margin-bottom: 0.85rem;
}
.pc-login-form label .input { margin-top: 0.25rem; }

/* ============================================================================
 * Filter bar standard : barre d'outils en haut des pages liste.
 * ============================================================================ */
.pc-filters {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.pc-filters label { font-size: 0.8rem; color: #455A64; }
.pc-filters label > select,
.pc-filters label > input { display: block; margin-top: 0.15rem; min-width: 11rem; }
.pc-filters .btn-primary,
.pc-filters .btn-secondary { padding: 0.4rem 0.9rem; font-size: 0.85rem; }

/* Bandeau « société active » dans les pages — visuel discret */
.pc-active-soc-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--pc-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* État vide standardisé pour les tables */
.pc-empty {
    text-align: center;
    color: #90A4AE;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}
.pc-empty .icon { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; opacity: 0.4; }

/* Empêche le warning Tailwind CDN de surcharger la mise en page */
[data-pc-theme-boot] body { visibility: visible; }
