@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

:root {
    --gold: #f1c40f;
    --green: #2ecc71;
    --blue: #3498db;
    --dark-bg: #1e293b;
    --sidebar-bg: rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

body {
    background: radial-gradient(circle at center, #1e293b 0%, #000 100%);
    color: white;
    font-family: 'Poppins', sans-serif;
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR (ESCRITORIO) --- */
.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
}

#main-logo { max-width: 200px; margin: 0 auto 5px; display: block; }

#ultimo-numero-card {
    border: 3px solid var(--gold);
    border-radius: 20px;
    text-align: center;
    margin-bottom: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
}

#num-grande {
    font-size: 7rem;
    font-weight: bold;
    color: var(--gold);
    line-height: 1;
}

#premio-container {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid var(--green);
    border-radius: 15px;
    padding: 8px;
    text-align: center;
    margin-bottom: 10px;
}

#premio-img { height: 140px; object-fit: cover; border-radius: 10px; }
#premio-texto { font-weight: bold; color: var(--green); text-transform: uppercase; }

#mini-premio-mobile { display: none; }

/* --- BOTONES Y ADMIN --- */
.admin-controls { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.admin-controls input {
    width: 100%; padding: 7px; border-radius: 8px;
    border: 2px solid #475569; background: #0f172a; color: white;
}

.btn-sacar { 
    background: var(--blue); color: white; border: none; padding: 12px; 
    font-weight: bold; width: 100%; border-radius: 12px; cursor: pointer; 
    font-size: 1rem; transition: transform 0.2s; 
}
.btn-success { 
    background: var(--green); color: white; border: none; padding: 14px; 
    width: 100%; border-radius: 10px; cursor: pointer; font-weight: bold; 
}
.btn-primary { 
    background: var(--gold); color: black; border: none; padding: 8px; 
    width: 100%; border-radius: 8px; cursor: pointer; font-weight: bold; 
}
.btn-danger { 
    background: #e74c3c; color: white; border: none; padding: 8px; 
    margin-top: 1px; width: 100%; border-radius: 8px; cursor: pointer; font-size: 0.8rem; 
}

/* --- GRID --- */
.main-content {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-container {
    display: grid;
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 10px;
}

.cell {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2vw;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.15);
}

.marked { background: linear-gradient(135deg, #27ae60, #2ecc71); color: white; border: 2px solid #fff; }
.last-active { animation: pulse 1.5s infinite; border-color: var(--gold); }

/* --- DISEÑO MÓVIL CON MARGEN DE SEGURIDAD --- */
@media (max-width: 900px) {
    body { overflow: hidden; height: 100vh; }
    .app-container { flex-direction: column; height: 100vh; }

    .sidebar {
        width: 100%; 
        height: 65px; 
        padding: 0 15px;
        flex-direction: row !important; 
        align-items: center; 
        justify-content: space-between;
        border-right: none; 
        border-bottom: 1px solid rgba(255,255,255,0.1);
        flex-shrink: 0;
    }

    .sidebar-header-mobile {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    #premio-container { display: none !important; }
    #main-logo { height: 55px; width: auto; margin: 0; }
    
    #ultimo-numero-card { 
        margin: 0; 
        padding: 4px 12px; 
        display: flex !important; 
        flex-direction: row !important; 
        align-items: center; 
        gap: 8px;
        height: 45px;
    }
    #ultimo-numero-card p { font-size: 0.6rem; margin: 0; }
    #num-grande { font-size: 1.8rem; margin: 0; }

    #mini-premio-mobile {
        display: block; width: 38px; height: 38px; 
        border: 2px solid var(--green); border-radius: 8px; overflow: hidden;
        flex-shrink: 0;
    }
    #mini-img-mobile { width: 100%; height: 100%; object-fit: cover; }

    /* AJUSTE AQUÍ: Margen inferior para navegadores móviles */
    .main-content { 
        flex: 1; 
        padding: 8px; 
        margin-bottom: 25px; /* Margen de seguridad inferior */
        overflow: hidden; 
        display: flex;
        align-items: center;
    }
    
    .grid-container { gap: 4px; height: 100%; }
    .cell { font-size: 4.8vw; border-radius: 6px; }

    #admin-panel {
        background: #000; 
        padding: 12px 15px; 
        border-top: 2px solid var(--gold);
        flex-shrink: 0;
        margin-bottom: 0; /* El panel de admin sí puede ir pegado abajo */
    }
    
    .btn-sacar { padding: 12px; font-size: 1rem; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 15px var(--gold); }
    100% { transform: scale(1); }
}

#pin-input{
    width: 100%; padding: 12px; border-radius: 8px;
    border: 2px solid #475569; background: #0f172a; color: white;
    margin-bottom: 5%;
    }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95); display: flex; align-items: center; justify-content: center; z-index: 5000; }
.modal-content { background: var(--dark-bg); padding: 30px; border-radius: 20px; border: 2px solid var(--gold); text-align: center; }
.hidden { display: none !important; }