/**
 * =============================================================================
 * EVANTURA PRO — Styles du module générateur de billets
 * =============================================================================
 *
 * Ce fichier CSS est dédié UNIQUEMENT à la page generateur-billet.html
 * et au module d'aperçu / export. Il n'altère pas billets-physiques.html.
 *
 * Structure :
 *   1. Variables & tokens de design
 *   2. Layout de la page de démonstration
 *   3. Zone d'aperçu (canvas)
 *   4. Panneau de contrôle minimal (test du module)
 *   5. Utilitaires & responsive
 */

/* ==========================================================================
   1. VARIABLES — Alignées sur la charte billet (#18623A / #E15E12)
   ========================================================================== */
:root {
    --billet-green:        #18623A;
    --billet-green-dark:   #0f4227;
    --billet-orange:       #E15E12;
    --billet-orange-soft:  #fff3eb;
    --billet-ink:          #131A16;
    --billet-muted:        #6B756F;
    --billet-line:         #E2E7E3;
    --billet-paper:        #F5F7F5;
    --billet-surface:      #FFFFFF;

    --billet-font-display: 'Sora', system-ui, sans-serif;
    --billet-font-body:    'Inter', system-ui, sans-serif;
    --billet-font-mono:    'JetBrains Mono', monospace;
}

/* ==========================================================================
   2. PAGE — Enveloppe du module autonome
   ========================================================================== */
.billet-module-page {
    background: var(--billet-paper);
    font-family: var(--billet-font-body);
    color: var(--billet-ink);
    min-height: 100vh;
}

.billet-module-header {
    border-bottom: 1px solid var(--billet-line);
    padding: 24px 0 20px;
    margin-bottom: 32px;
}

.billet-module-header h1 {
    font-family: var(--billet-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.billet-module-header .tag {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--billet-orange);
    background: var(--billet-orange-soft);
    border: 1px solid #ffd9ad;
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 8px;
}

.billet-module-header p {
    color: var(--billet-muted);
    font-size: .85rem;
    margin: 6px 0 0;
}

/* ==========================================================================
   3. CARTES — Conteneurs visuels (aperçu + contrôles)
   ========================================================================== */
.billet-card {
    background: var(--billet-surface);
    border: 1px solid var(--billet-line);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(19, 26, 22, .03);
}

.billet-card-title {
    font-family: var(--billet-font-display);
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: 4px;
}

.billet-card-hint {
    color: var(--billet-muted);
    font-size: .8rem;
    margin-bottom: 20px;
}

/* ==========================================================================
   4. APERÇU — Canvas temps réel
   ========================================================================== */
.billet-preview-zone {
    text-align: center;
}

.billet-preview-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--billet-muted);
    margin-bottom: 16px;
}

/* Conteneur avec ombre pour simuler le billet physique posé sur le bureau */
.billet-preview-frame {
    display: inline-block;
    padding: 12px;
    background: linear-gradient(145deg, #fafbfa, #eef1ee);
    border-radius: 16px;
    border: 1px solid var(--billet-line);
    box-shadow:
        0 24px 48px -18px rgba(19, 26, 22, .22),
        0 2px 6px rgba(19, 26, 22, .05);
    max-width: 100%;
    overflow-x: auto;
}

#billet-preview-canvas {
    display: block;
    border-radius: 4px;
    /* Dimensions réelles injectées par billet-preview.js */
}

/* Badge dimensions techniques (rappel pour l'organisateur) */
.billet-dimensions-badge {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

.billet-dimensions-badge span {
    font-family: var(--billet-font-mono);
    font-size: .68rem;
    background: var(--billet-paper);
    border: 1px solid var(--billet-line);
    border-radius: 20px;
    padding: 4px 10px;
    color: var(--billet-muted);
}

.billet-dimensions-badge strong {
    color: var(--billet-green);
}

/* ==========================================================================
   5. PANNEAU DE CONTRÔLE — Minimal (démo / test du module)
   ========================================================================== */
.billet-control-group {
    margin-bottom: 18px;
}

.billet-control-group label {
    display: block;
    font-weight: 600;
    font-size: .83rem;
    color: #39443d;
    margin-bottom: 6px;
}

.billet-control-group input,
.billet-control-group select {
    width: 100%;
    border: 1px solid var(--billet-line);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: .92rem;
    font-family: var(--billet-font-body);
}

.billet-control-group input:focus,
.billet-control-group select:focus {
    outline: none;
    border-color: var(--billet-green);
    box-shadow: 0 0 0 .2rem rgba(24, 98, 58, .12);
}

.billet-control-group .hint {
    font-size: .76rem;
    color: var(--billet-muted);
    margin-top: 6px;
}

/* Zone d'import affiche — bordure en pointillés pour signaler la zone centrale */
.billet-poster-upload {
    border: 2px dashed var(--billet-line);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    background: #fbfcfb;
    transition: border-color .2s, background .2s;
}

.billet-poster-upload:hover,
.billet-poster-upload.dragover {
    border-color: var(--billet-green);
    background: #f0f7f2;
}

.billet-poster-upload i {
    color: var(--billet-orange);
    font-size: 1.4rem;
    margin-bottom: 8px;
}

/* ==========================================================================
   6. BOUTONS D'ACTION
   ========================================================================== */
.btn-billet-primary {
    background: var(--billet-green);
    color: #fff;
    border: none;
    font-family: var(--billet-font-display);
    font-weight: 600;
    letter-spacing: .3px;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s, transform .15s;
    box-shadow: 0 8px 20px rgba(24, 98, 58, .18);
    width: 100%;
}

.btn-billet-primary:hover {
    background: var(--billet-green-dark);
    transform: translateY(-1px);
}

.btn-billet-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.btn-billet-secondary {
    background: transparent;
    color: var(--billet-green);
    border: 1px solid var(--billet-green);
    font-family: var(--billet-font-display);
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.btn-billet-secondary:hover {
    background: #f0f7f2;
}

/* ==========================================================================
   7. ALERTES & STATUT
   ========================================================================== */
.billet-alert {
    display: none;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: .85rem;
    margin-bottom: 16px;
}

.billet-alert.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.billet-alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.billet-alert.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.billet-alert.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ==========================================================================
   8. SPECS TECHNIQUES — Tableau récapitulatif des dimensions
   ========================================================================== */
.billet-specs-table {
    width: 100%;
    font-size: .78rem;
    border-collapse: collapse;
    margin-top: 12px;
}

.billet-specs-table th,
.billet-specs-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--billet-line);
    text-align: left;
}

.billet-specs-table th {
    font-weight: 600;
    color: var(--billet-muted);
    width: 45%;
}

.billet-specs-table td {
    font-family: var(--billet-font-mono);
    color: var(--billet-ink);
}

.billet-specs-table tr:last-child td,
.billet-specs-table tr:last-child th {
    border-bottom: none;
}

.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid rgba(0, 0, 0, .1);
}

/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */
.billet-module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 991px) {
    .billet-module-grid {
        grid-template-columns: 1fr;
    }

    .billet-preview-frame {
        padding: 8px;
    }
}


/* --- Modal Backdrop & Animation --- */
#eventSelectorModal.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6); /* Arrière-plan sombre moderne */
    backdrop-filter: blur(5px);          /* Flou d'arrière-plan */
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#eventSelectorModal.show,
#eventSelectorModal[style*="display: block"] {
    display: flex !important;
    animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Arrière-plan sombre & positionnement fixe --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Affichage dynamique (via JS) */
.modal.show,
.modal[style*="display: block"] {
    display: flex !important;
    animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Boîte Blanche --- */
.modal .modal-content {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Header & Bouton Fermer --- */
.modal-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-header-custom h4 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.modal .close-btn {
    background: #f1f5f9;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.modal .close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* --- Champs de Recherche --- */
.modal input[type="text"].form-control {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 14px;
    background-color: #f8fafc;
}

.modal input[type="text"].form-control:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

/* --- Conteneurs de Listes (Événements & Catégories) --- */
#eventsListContainer,
#categoriesListContainer {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Scrollbar Personnalisée */
#eventsListContainer::-webkit-scrollbar,
#categoriesListContainer::-webkit-scrollbar {
    width: 5px;
}
#eventsListContainer::-webkit-scrollbar-track,
#categoriesListContainer::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}
#eventsListContainer::-webkit-scrollbar-thumb,
#categoriesListContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}
#eventsListContainer::-webkit-scrollbar-thumb:hover,
#categoriesListContainer::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Cartes des Éléments de Liste --- */
.event-list-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-list-item:hover {
    border-color: #3b82f6;
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.event-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
}

.event-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    color: #475569;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
}

.event-list-item:hover .event-badge {
    background: #eff6ff;
    color: #1d4ed8;
}

/* --- Onglets de Filtrage (Catégories) --- */
.category-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.btn-filter {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    background: #e2e8f0;
}

.btn-filter.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* --- Éléments de la modale Catégories --- */
.cat-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.cat-price {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
}