/* =======================================================
   FONTS & RESET
======================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =======================================================
   TYPO & LAYOUT GLOBAL
======================================================= */
body {
    font-family: "Inter", "Roboto", "Segoe UI", Arial, sans-serif;
    background: #f3f4f6;
    color: #2d2d2d;
    line-height: 1.55;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 40px;
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.3px;
    color: #1e1e1e;
}

h1 { font-size: 26px; margin-bottom: 20px; }
h2 { font-size: 20px; margin-top: 30px; margin-bottom: 10px; }
h3 { font-size: 16px; margin-top: 20px; margin-bottom: 8px; }

.small {
    font-size: 13px;
    color: #6b7280;
}

/* Bloc générique type "card" (profils, formulaires, etc.) */
.section-card,
.card {
    background: #ffffff;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
}

/* =======================================================
   BOUTONS
======================================================= */

button,
.btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    background: #4f46e5;
    color: #ffffff;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.05s ease;
}

button:hover,
.btn:hover {
    background: #4338ca;
    box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

button:active,
.btn:active {
    transform: translateY(1px);
}

/* Variante warning */
.btn-warning {
    background: #d97706;
}
.btn-warning:hover {
    background: #b45309;
}

/* Bouton secondaire (ex: + Ajouter un spectacle) */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 14px;
    border: 1px solid #4f46e5;
    background: #eef2ff;
    color: #312e81;
    font-size: 14px;
    font-weight: 500;
}
.btn-secondary:hover {
    background: #4f46e5;
    color: #ffffff;
}

/* Lien-bouton simple */
.btn-link {
    text-decoration: none;
    color: #2563eb;
}
.btn-link:hover {
    text-decoration: underline;
}

/* =======================================================
   FORMULAIRES
======================================================= */

/* Base commune */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    background-color: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Focus */
input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb33;
}

/* Harmonisation widgets date/heure */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    -webkit-appearance: none;
       -moz-appearance: textfield;
    appearance: none;
    font-family: inherit !important;
    font-size: 14px;
    color: #111827;
}
input::-webkit-datetime-edit,
input::-webkit-date-and-time-value {
    font-family: inherit !important;
    font-size: 14px;
}

/* Champ email de contact (profil) avec petit icône @ */
input[type="email"][name="email_contact"] {
    border-color: #2563eb;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%236b7280' stroke-width='1.5'%3E%3Cpath d='M8 3.25a4.25 4.25 0 1 0 0 8.5 2.25 2.25 0 0 0 0-4.5 2.25 2.25 0 1 0 0 4.5'/%3E%3Cpath d='M11 7.5V8a3 3 0 1 1-1.5-2.598'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

/* =======================================================
   TABLEAUX
======================================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
th {
    background: #f3f4f6;
    text-align: left;
    padding: 10px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}
td {
    padding: 10px;
    border-bottom: 1px solid #f1f1f1;
    font-size: 13px;
}
tr:hover td {
    background: #f9fafb;
}

/* Liens avec icône dans tableaux (PJ, etc.) */
a.btn-icon,
a.pj-link {
    color: #6A4BFF;
    text-decoration: none;
}
a.btn-icon:hover,
a.pj-link:hover {
    color: #8A6FFF;
}
table a.btn-icon svg.ico,
table a.pj-link svg.ico {
    stroke: #6A4BFF !important;
}

/* =======================================================
   TAGS & BADGES
======================================================= */

.tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
    margin-bottom: 4px;
    background: #eef2ff;
    color: #3730a3;
}

.tag-ok {
    background: #dcfce7;
    color: #166534;
}
.tag-missing {
    background: #fef3c7;
    color: #92400e;
}
.tag-bad {
    background: #fee2e2;
    color: #991b1b;
}

/* Badges par type d’évènement */
.badge-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}
.badge-type-residence { background: #6a1b9a; }
.badge-type-concert   { background: #0277bd; }
.badge-type-atelier   { background: #2e7d32; }
.badge-type-rencontre { background: #c62828; }
.badge-type-autre     { background: #616161; }

/* Pour les lignes de statut dans dashboard_dates, etc. */
.status-row {
    border-left: 4px solid transparent;
}
.status-en-discussion  { border-left-color: #f97316; }
.status-option         { border-left-color: #eab308; }
.status-confirmé       { border-left-color: #22c55e; }
.status-réalisé        { border-left-color: #0ea5e9; }
.status-annulé         { border-left-color: #ef4444; }
.status-à-facturer     { border-left-color: #8b5cf6; }
.status-facturé        { border-left-color: #4f46e5; }

/* =======================================================
   STAT CARDS (Dashboard)
======================================================= */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 600;
}

.stat-total   { border-left: 4px solid #4f46e5; }
.stat-confirm { border-left: 4px solid #22c55e; }
.stat-discuss { border-left: 4px solid #f97316; }
.stat-option  { border-left: 4px solid #eab308; }
.stat-cancel  { border-left: 4px solid #ef4444; }

/* =======================================================
   NAVBAR & TOPBAR
======================================================= */

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-brand {
    font-size: 1rem;
    font-weight: 600;
    color: #4f46e5;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-item {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    color: #374151;
    font-weight: 500;
    transition: 0.2s background, 0.2s color;
}
.nav-item:hover {
    background: #eef2ff;
    color: #4f46e5;
}
.nav-item.active {
    background: #4f46e5;
    color: #ffffff !important;
}

/* CTA "Nouvelle date" à droite */
.nav-cta-wrapper .nav-cta {
    background: #111827;
    color: #f9fafb !important;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}
.nav-cta-wrapper .nav-cta:hover {
    background: #1f2937;
}
.nav-cta-wrapper .nav-cta.active {
    border-color: #f97316;
}

/* Burger pour mobile */
.nav-toggle {
    display: none;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1.2rem;
    color: #4f46e5;
    cursor: pointer;
    transition: 0.2s;
}
.nav-toggle.open {
    background: #eef2ff;
    border-color: #c7d2fe;
}

/* Zone droite : avatar + power */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 16px;
}

/* Pastille avatar profil */
.profil-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background: #111827;
    color: #f9fafb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.profil-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}
.profil-avatar:hover {
    filter: brightness(1.05);
}

/* Bouton power / déconnexion */
.nav-logout {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #c5c9d1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.nav-logout .ico {
    width: 32px;
    height: 32px;
}
.nav-logout svg {
    stroke-width: 2.6;
}
.nav-logout:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Icônes SVG génériques */
.ico,
svg.ico {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    vertical-align: middle;
}

/* Liens d’action avec icône */
.action-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    color: #2563eb;
    text-decoration: none;
    transition: background 0.2s;
}
.action-icon:hover {
    background: #eef2ff;
}

/* =======================================================
   PAGE DE CONNEXION
======================================================= */

.login-body {
    background: #f3f4f6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    padding: 30px 26px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.login-container h1 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #111827;
    text-align: center;
    font-weight: 600;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-container label {
    font-size: 14px;
    color: #374151;
}

.login-container input[type="email"],
.login-container input[type="password"] {
    padding: 10px 12px;
    border-radius: 8px;
}

.login-container button {
    background: #4f46e5;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 8px;
}

/* =======================================================
   PROFIL / LOGO
======================================================= */

.profil-logo-block {
    margin-bottom: 20px;
}
.profil-logo-preview img {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: cover;
    margin-bottom: 6px;
}

/* =======================================================
   DEVIS (mise en page PDF/print)
======================================================= */

.devis-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    margin-bottom:25px;
}
.devis-col-left{
    width:50%;
    font-size:13px;
    line-height:1.35;
}
.devis-col-right{
    width:50%;
    text-align:right;
    font-size:13px;
}
.devis-date-ville{
    font-weight:bold;
    margin-bottom:12px;
    font-size:13px;
}
.devis-attention{
    margin-top:10px;
    font-size:13px;
    line-height:1.35;
}

/* =======================================================
   SPECTACLES / PROJETS
======================================================= */

.spectacles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Formulaire d’ajout/modif */
.spectacle-form-wrapper {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}
.spectacle-form label {
    font-weight: 500;
    margin-top: 8px;
    display: block;
}

/* Liste / cards */
.spectacle-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.spectacle-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    align-items: flex-start;
}

.spectacle-thumb img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
}

.spectacle-main {
    min-width: 0;
}

.spectacle-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.spectacle-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.meta-item {
    font-size: 12px;
}

.spectacle-desc {
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}

/* Actions dans la card (Modifier, Visuels, Dates…) */
.spectacle-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    white-space: nowrap;
}

/* =======================================================
   PRINT
======================================================= */

@media print {
    nav, .topnav, .no-print {
        display: none !important;
    }
    body {
        background: white;
    }
}

/* =======================================================
   RESPONSIVE (MOBILE)
======================================================= */

@media (max-width: 768px) {

    .topnav {
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        order: 2;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        display: none;
        margin-top: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links .nav-item {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
    }

    .nav-cta-wrapper {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .nav-cta-wrapper .nav-cta {
        width: 100%;
        text-align: center;
    }

    .page-container {
        padding: 16px 12px 24px;
    }

    h1 { font-size: 22px; margin-bottom: 16px; }
    h2 { font-size: 18px; }

    .stats-row {
        flex-direction: column;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 12px;
    }
    th, td {
        white-space: nowrap;
    }

    .section-card {
        padding: 12px 12px;
        margin-bottom: 16px;
    }

    .spectacle-card {
        grid-template-columns: 1fr;
    }

    .spectacle-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
}
.tache-select {
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}

.tache-select.a_faire { border-color: #facc15; background:#fefce8; }
.tache-select.bloque  { border-color: #60a5fa; background:#eff6ff; }
.tache-select.fait    { border-color: #4ade80; background:#f0fdf4; }

.booking-link.booking-disabled {
    opacity: 0.6;
    pointer-events: none;
    text-decoration: none;
}

/* Bouton copie : même look que les autres icônes d'action */
.btn-icon-copy {
    border: none;
    background: transparent;
    color: #2563eb;           /* même violet que les liens PJ */
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Hover : léger changement de teinte, sans rond */
.btn-icon-copy:hover {
    background: transparent;
    color: #8A6FFF;
    transform: none;
}

/* Pas d'effet "enfoncé" particulier */
.btn-icon-copy:active {
    transform: none;
}

/* Icône "copie" alignée sur les autres */
.ico-copy {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
    stroke-width: 1;
    fill: none;
}
.action-icon .ico {
    color: #2563eb;
}
.stat-card.stat-deplacements {
    background: #fff7e6;
}
.stat-card.stat-deplacements .stat-value {
    font-weight: 700;
}
.btn-auto-submit-hidden {
    display: none;
}
/* Résumé pliable avec chevron */
/* style commun */
.summary-collapse {
    cursor: pointer;
    font-weight: 600;
    list-style: none; /* vire le marqueur natif sur Firefox */
}

/* vire le marqueur natif sur WebKit */
.summary-collapse::-webkit-details-marker {
    display: none;
}

/* chevron par défaut (détails fermés) */
.summary-collapse::before {
    content: "▸";
    margin-right: 6px;
    font-size: 1.6em;
}

/* chevron quand le <details> est ouvert */
details[open] > .summary-collapse::before {
    content: "▾";
}
/* Base : aligné à droite sur les écrans "normaux" */
summary.summary-bilan {
    display: flex;
    align-items: center;
    gap: 8px;            /* petit espace entre texte et solde */
}

.summary-bilan-label {
    flex: 1 1 auto;      /* prend toute la place dispo */
    min-width: 0;
}

.summary-bilan-solde {
    flex: 0 0 auto;
    margin-left: auto;   /* pousse le solde à droite */
    font-weight: 700;
}

/* Sur petit écran : on autorise le retour à la ligne propre */
@media (max-width: 640px) {
    summary.summary-bilan {
        flex-wrap: wrap;              /* le contenu peut passer sur 2 lignes */
    }

    .summary-bilan-label {
        flex: 1 0 100%;               /* ligne entière pour le texte */
    }

    .summary-bilan-solde {
        flex: 0 0 100%;               /* ligne entière pour le solde */
        text-align: right;            /* mais toujours aligné à droite */
        margin-left: 0;
    }
}
/* Mise en page par défaut : 2 colonnes */
.finance-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 16px;
}

/* Sur petit écran : une seule colonne, Résumé passe dessous */
@media (max-width: 900px) {
    .finance-grid {
        grid-template-columns: 1fr !important;
    }
}
