:root {
    --primary: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --bg: #f4f7f6;
    --warning: #f1c40f;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    margin: 0;
    padding: 20px;
    color: var(--dark);
    /* Espace de sécurité pour ne pas cacher de contenu sous la bannière */
    padding-bottom: 100px; 
}

.container {
    max-width: 900px;
    margin: auto;
}

header { text-align: center; margin-bottom: 30px; }

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.ticket-display {
    font-size: 4.5rem;
    font-family: 'Courier New', monospace;
    background: #222;
    color: var(--warning);
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
    border: 5px solid #333;
}

/* --- BOUTONS --- */
button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    width: 100%;
    text-transform: uppercase;
}

button:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; font-size: 1.1rem; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); width: auto; }

/* --- LISTE D'ATTENTE --- */
ul { list-style: none; padding: 0; max-height: 300px; overflow-y: auto; }
li {
    background: #fff;
    margin: 8px 0;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ticket-id { font-weight: bold; font-size: 1.2rem; }
.ticket-time { color: #7f8c8d; font-size: 0.9rem; }

/* --- IMAGE PUBLICITAIRE / LOGO --- */
#adImageDisplay {
    max-height: 150px;
    max-width: 100%;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none; /* Apparaît via JS si une image est chargée */
    border: 2px solid #ddd;
}

/* --- BANNIÈRE PUBLICITAIRE DÉFILANTE --- */
.footer-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--warning);
    color: #000;
    height: 80px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border-top: 4px solid #d4ac0d;
    z-index: 9999;
}

.pub-text {
    font-weight: bold;
    font-size: 2.2rem;
    white-space: nowrap;
    position: absolute;
    will-change: transform;
    animation: scroll-left 25s linear infinite;
}

@keyframes scroll-left {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* --- ADAPTATION MOBILE --- */
@media (max-width: 600px) {
    .controls {
        grid-template-columns: 1fr;
    }
    
    .footer-banner {
        height: 60px;
    }

    .pub-text {
        font-size: 1.4rem;
    }

    #ticketDisplay {
        font-size: 8rem; /* Pour l'écran afficheur sur mobile */
    }
}

/* --- IMPRESSION TICKET (CORRIGÉ) --- */
@media print {
    /* Cache tout sauf la zone d'impression */
    body * { 
        visibility: hidden !important; 
    }
    
    #printArea, #printArea * { 
        visibility: visible !important; 
        color: black !important;
        background: white !important;
    }
    
    #printArea { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
        display: block !important; 
        border: none !important;
    }
}