:root {
    --bg-color: #e3f2fd;
    --container-bg: rgba(255, 255, 255, 0.9);
    --text-color: #2c3e50;
    --accent-color: #007bb5;
    --accent-glow: 0 0 10px #007bb5, 0 0 20px #007bb5;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --border-color: #bdc3c7;
}

/* Estilos globais e de layout do novo design */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Roboto', sans-serif; background: url('https://images.unsplash.com/photo-1508780709619-79562169bc64?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat; color: var(--text-color); }
body { display: flex; justify-content: center; align-items: center; padding: 20px; }
.main-container {
    width: 90%;
    max-width: 1000px;
    padding: 40px;
    background: var(--container-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Estilos do cabeçalho */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.branding { display: flex; align-items: center; text-align: left; }
.logo { margin-right: 15px; }
.logo img { width: 160px; height: 70px;}
h1 { font-size: 1.8em; font-weight: 700; margin: 0; color: var(--accent-color); }
.subtitle { font-size: 1,5em; font-weight: 300; margin: 5px 0 0; letter-spacing: 2px; color: #000000; }
.time-info { text-align: right; }
#clock {
    font-size: 3em;
    font-weight: 700;
    margin: 0;
    color: var(--accent-color);
    text-shadow: var(--accent-glow);
    animation: none;
}

/* Estilos dos botões de ação */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.action-card {
    background: var(--border-color);
    padding: 20px;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.action-card:hover { transform: translateY(-5px); box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); }
.btn {
    width: 100%;
    padding: 20px;
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.btn-entrada { background-color: var(--success-color); }
.btn-entrada:hover { box-shadow: 0 0 15px var(--success-color); }
.btn-saida { background-color: var(--error-color); }
.btn-saida:hover { box-shadow: 0 0 15px var(--error-color); }

.btn i.fa-chevron-right { display: none; }
.btn i.fas { margin: 0; font-size: 1.2em; }

/* Estilos do rodapé e links */
.links-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}
.dicas, .links-container a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1em;
    transition: text-shadow 0.3s ease;
}
.dicas:hover, .links-container a:hover { text-shadow: var(--accent-glow); text-decoration: none; }

.footer {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    font-size: 0.9em;
    color: #7f8c8d;
}
.footer a { color: #000000; text-decoration: none; font-weight: 600; }
.footer a:hover { text-decoration: underline; }

/* Estilos dos modais */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); display: none; justify-content: center; align-items: center; z-index: 1000;
}
.modal.active { display: flex; animation: fadeIn .4s ease-in-out; }
.modal-content {
    background: var(--container-bg); padding: 30px; border-radius: 10px;
    max-width: 450px; width: 90%; color: var(--text-color); text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); animation: fadeIn 0.3s ease-out;
}
.modal-content h2 { margin-bottom: 20px; color: var(--accent-color); font-size: 1.5rem; text-align: center; }
.modal-content input {
    width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color);
    background: #fff; color: var(--text-color); margin-bottom: 10px; font-size: 1rem;
}
.modal-content input.invalid { border-color: var(--error-color); animation: shake .3s ease-in-out; }
.modal-content small { display: block; margin-bottom: 10px; color: var(--error-color); font-size: .85rem; }
.btn-submit {
    background: var(--accent-color); color: #fff; padding: 12px; width: 100%;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: .3s;
}
.btn-submit:hover { box-shadow: var(--accent-glow); }
.btn-close {
    margin-top: 10px; background: none; border: none; color: #7f8c8d;
    font-weight: 600; cursor: pointer; text-align: center; width: 100%;
}
.success-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 30px;
    max-width: 500px;
    background: #f0fdf4;
    border: 2px solid #22c55e;
    color: #166534;
    animation: successIn 0.5s ease-out;
}

.success-modal-content h2 {
    color: #166534;
    font-size: 1.8em;
    margin-top: 20px;
    text-align: center;
}

.success-icon {
    font-size: 5em;
    color: #22c55e;
}

@keyframes successIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Animações e Toasts */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%{transform:translateX(0)}25%{transform:translateX(-4px)}50%{transform:translateX(4px)}75%{transform:translateX(-4px)}100%{transform:translateX(0)}}
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--accent-color); color: #fff; padding: 14px 24px; border-radius: 8px;
    font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    animation: fadeToast .5s ease; z-index: 9999;
}
.toast.erro { background: var(--error-color); }
@keyframes fadeToast { from { opacity: 0; transform: translate(-50%,20px); } to { opacity: 1; transform: translate(-50%,0); } }

/* Estilos da câmera e responsividade */
#videoPreview, #videoPreviewSaida { width: 100%; max-height: 240px; border-radius: 12px; margin-bottom: 10px; background: #000; object-fit: cover; display: block; }

/* Início das alterações de responsividade */
@media (max-width: 768px) {
    /* Ajuste o padding do container principal para usar mais a tela */
    .main-container {
        padding: 20px;
    }
    
    /* Faz o cabeçalho se organizar em coluna */
    .header-content {
        flex-direction: column;
        align-items: center;
        margin-bottom: 20px;
    }
    .branding { 
        text-align: center; 
        width: 100%; 
        margin-bottom: 15px; 
        flex-direction: column; /* Faz o logo e o texto ficarem um em cima do outro */
    }
    
    /* Ajusta o tamanho do logo para não ser muito grande */
    .logo img {
        width: 100px;
        height: auto;
        margin-right: 0;
        margin-bottom: 10px; /* Adiciona espaço entre o logo e o texto */
    }

    .time-info { 
        text-align: center; 
        width: 100%;
        margin-top: 15px;
    }
    #clock { 
        font-size: 2.2em; /* Diminui o tamanho do relógio */
    }
    
    /* Faz os botões de ação ficarem em uma coluna em vez de 2 */
    .controls-grid { 
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* Faz os links do rodapé se alinharem em coluna para não quebrar */
    .links-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    /* Ajusta o tamanho dos textos para ficarem mais compactos */
    h1 { font-size: 1.5em; }
    .subtitle { font-size: 0.9em; letter-spacing: 1px; }
    .btn { font-size: 1em; padding: 15px; }
}