/* 1. CARICAMENTO FONT */
@font-face {
    font-family: 'Cream Cake Bold';
    src: url('Cream Cake Bold.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

/* 2. LAYOUT GENERALE */
body {
    background: #1a1a1a;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1 {
    font-family: 'Cream Cake', sans-serif;
    font-size: 76px;
    color: #ff00ff;
    text-shadow: 2px 2px 10px rgba(255, 0, 255, 0.5), 2px 2px 0px #000;
    margin-bottom: 10px;
}

.booth-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* 3. RIQUADRO VIDEO E PREVIEW */
.video-wrap, #preview-area {
    position: relative; /* Necessario per i bottoni assoluti */
    width: 90vw;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    border: 5px solid #ff00ff;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.6);
}

video, #photo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    display: block;
}

video { transform: scaleX(-1); }

/* 4. BOTTONI AI LATI DELLA FOTO (OK e X) */
#preview-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: none; /* Gestito da JS */
    width: 100%;
    z-index: 110;
    pointer-events: none; /* Non blocca gli sticker sotto */
}

.preview-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
    pointer-events: auto; /* Riattiva i click sui bottoni */
}

.preview-buttons button {
    width: 70px;
    height: 70px;
    border-radius: 50%; /* Tondi */
    border: 3px solid white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

#confirm-btn { 
    background: #28a745; 
    order: 2; /* OK a DESTRA */
}

#cancel-btn { 
    background: #dc3545; 
    order: 1; /* X a SINISTRA */
}

.preview-buttons button:active { transform: scale(0.9); }

/* 5. STICKERS GIPHY */
.placed-sticker {
    position: absolute;
    z-index: 100;
    cursor: move;
    width: 120px;
}

#giphy-results img {
    height: 80px;
    cursor: grab;
    border-radius: 8px;
    transition: 0.2s;
}

#giphy-results img:hover { transform: scale(1.1); }

/* 6. ALTRI ELEMENTI (Countdown, QR, Snap) */
#countdown {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 4px 4px 15px rgba(0, 0, 0, 0.8);
    z-index: 10;
    pointer-events: none;
}

#snap {
    background: #00f2ff;
    color: black;
    border: none;
    padding: 18px 60px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
    transition: 0.3s;
}

#qr-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.qr-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    color: #333;
}

/* Stile per il tasto CHIUDI ALBUM rosso in alto a destra */
#close-album {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ff0000; /* Rosso puro */
    color: white;
    border: 3px solid white;
    padding: 15px 25px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
    z-index: 310; /* Sopra la griglia dell'album */
    transition: transform 0.2s;
}

#close-album:hover {
    background: #cc0000;
    transform: scale(1.1);
}