/* ============================================================
   PONTOAZT — Terminal Kiosk CSS
   Layout full-screen, robusto para tablets
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=JetBrains+Mono:wght@700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-panel: #111827;
    --bg-card: #1f2937;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 1.5rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Alertas Fixos (Toasts) */
.alerts-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.alert {
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: dropIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.alert-success { border-bottom: 4px solid var(--success); }
.alert-error { border-bottom: 4px solid var(--danger); }
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Layout Principal */
.terminal-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Esquerda (Relógio e Status) */
.terminal-sidebar {
    width: 400px;
    background: var(--bg-panel);
    padding: 40px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.branding {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}
.logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
}
.branding h1 { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.branding span { color: #06b6d4; }

.clock-container {
    text-align: center;
    margin: 0 0 auto 0;
}
.time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 40px var(--primary-glow);
    margin-bottom: 10px;
}
.date {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.status-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: auto;
    margin-bottom: 30px;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: color 0.3s;
}
.status-item.active { color: var(--success); }
.status-item.error { color: var(--danger); }

.device-info {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.2);
    text-align: center;
}

/* Main Content Direita (Câmera e Ações) */
.terminal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
    gap: 30px;
    position: relative;
}

.camera-wrapper {
    flex: 1;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.1);
}
#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Espelhar */
}
.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, transparent 30%, rgba(0,0,0,0.6) 100%);
}
.face-guide {
    width: 300px;
    height: 400px;
    border: 4px dashed rgba(255,255,255,0.3);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.face-guide.active {
    border-color: var(--success);
    border-style: solid;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}
.camera-message {
    position: absolute;
    bottom: 40px;
    background: rgba(0,0,0,0.8);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 1.25rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.actions-wrapper {
    height: 240px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}
.action-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.action-panel.active {
    opacity: 1;
    pointer-events: all;
}

/* Botões */
.btn-capture {
    background: var(--success);
    color: white;
    border: none;
    padding: 24px 60px;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    transition: transform 0.1s, opacity 0.3s, background 0.3s;
    width: 100%;
}
.btn-capture:active:not(:disabled) { transform: scale(0.95); }
.btn-capture:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); box-shadow: none; }
.hint { margin: 20px 0 10px; color: var(--text-muted); font-size: 1.1rem; }
.btn-text { background: none; border: none; color: var(--primary); font-size: 1.2rem; font-weight: 600; cursor: pointer; }

/* Numpad (PIN) */
#action-pin { flex-direction: row; gap: 40px; justify-content: center; }
.pin-display { flex: 1; max-width: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pin-display input {
    width: 100%;
    background: var(--bg-card);
    border: 2px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 3rem;
    text-align: center;
    padding: 15px;
    border-radius: 16px;
    letter-spacing: 10px;
    outline: none;
}
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.num-key {
    width: 70px;
    height: 70px;
    background: var(--bg-card);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s;
}
.num-key:active { background: rgba(255,255,255,0.2); }
.num-key.action-key { font-size: 1.5rem; background: rgba(255,255,255,0.05); }
.num-key.confirm { background: var(--success); color: white; }

/* Overlay de Setup */
.overlay-screen {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}
.overlay-screen.active { opacity: 1; pointer-events: all; }
.setup-card {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    border: 1px solid rgba(255,255,255,0.1);
}
.setup-card h2 { margin-bottom: 10px; font-size: 2rem; }
.setup-card p { color: var(--text-muted); margin-bottom: 30px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-weight: 600; }
.form-group input { width: 100%; padding: 15px; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 10px; font-size: 1.1rem; }
.btn-primary { width: 100%; padding: 15px; background: var(--primary); color: white; border: none; border-radius: 10px; font-size: 1.2rem; font-weight: 700; margin-top: 10px; cursor: pointer; }
.error-msg { color: var(--danger); margin-top: 15px; text-align: center; }

@media (max-width: 767px) {
    body { overflow: hidden; height: 100vh; margin: 0; padding: 0; }
    .terminal-layout { flex-direction: column; height: 100vh; min-height: 100vh; padding: 0; }
    
    /* Remover a sidebar completamente (relógio e logo) para dar espaço em CELULARES */
    .terminal-sidebar { display: none !important; }
    
    /* Dividir a tela no meio */
    .terminal-main { padding: 0; flex: 1; height: 100vh; display: flex; flex-direction: column; gap: 0; }
    .camera-wrapper { height: 50vh; flex: none; border-radius: 0 0 24px 24px; border: none; }
    .face-guide { width: 200px; height: 280px; }
    
    /* A parte inferior com as ações e dados */
    .actions-wrapper { height: 50vh; flex: none; padding: 15px 20px; border: none; background: transparent; display: flex; flex-direction: column; justify-content: center; }
    .action-panel { position: relative; opacity: 1; padding: 0; pointer-events: all; display: none; height: 100%; }
    .action-panel.active { display: flex; flex-direction: column; justify-content: center; align-items: center; }
    
    .mobile-user-info { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: auto; margin-top: 10px; }
    
    .btn-capture { 
        padding: 16px 20px; 
        font-size: 1.2rem; 
        width: 100%; 
        justify-content: center; 
        margin-top: auto;
        margin-bottom: 10px;
    }
    
    .hint { margin: 5px 0; font-size: 0.9rem; }
    .btn-text { font-size: 1rem; margin-bottom: 10px; }

    #action-pin { flex-direction: column; gap: 15px; justify-content: center; }
    .pin-display input { font-size: 1.8rem; padding: 10px; }
    .numpad { gap: 10px; max-width: 250px; margin: 0 auto; }
    .num-key { width: 50px; height: 50px; font-size: 1.2rem; }
}