:root {
    --primary-color: #0d1b2a;
    --secondary-color: #1b263b;
    --accent-color: #415a77;
    --highlight-color: #778da9;
    --text-light: #e0e1dd;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f1c40f;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--primary-color);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    /* Evita scroll na app principal */
}

/* Telas */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--primary-color);
    transition: transform 0.3s ease-in-out;
    z-index: 1;
}

.screen.hidden {
    transform: translateX(100%);
    pointer-events: none;
    z-index: 0;
}

.screen.active {
    transform: translateX(0);
    z-index: 10;
}

/* Login */
.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.logo-area {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-area h1 {
    margin-top: 1rem;
    font-size: 2rem;
    letter-spacing: 2px;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--highlight-color);
}

.input-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: none;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

.input-group input:focus {
    outline: 2px solid var(--highlight-color);
    background-color: rgba(255, 255, 255, 0.15);
}

/* Dashboard */
.app-header {
    padding: 1rem;
    background-color: var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.clock-display {
    font-size: 0.9rem;
    color: var(--highlight-color);
    font-family: monospace;
    margin-top: 2px;
}

.dashboard-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.status-card {
    background-color: var(--secondary-color);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--text-light);
}

.recording .pulse {
    background-color: var(--danger-color);
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--highlight-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.action-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.btn-primary,
.btn-large {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-large {
    height: 80px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.btn-start {
    background-color: var(--success-color);
    color: white;
}

.btn-stop {
    background-color: var(--danger-color);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    /* Aumentar área de toque */
}

.secondary-actions {
    margin-top: 1rem;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* History List */
.filter-area {
    padding: 1rem 1rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 5px;
    flex: 1;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    background-color: var(--secondary-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent-color);
}

.history-info h4 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.history-info p {
    font-size: 0.85rem;
    color: var(--highlight-color);
}

.history-action {
    color: var(--highlight-color);
}

.hidden {
    display: none !important;
}

/* Map */
#map {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Loading */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--highlight-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.action-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.btn-primary,
.btn-large {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-large {
    height: 80px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.btn-start {
    background-color: var(--success-color);
    color: white;
}

.btn-stop {
    background-color: var(--danger-color);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    /* Aumentar área de toque */
}

.secondary-actions {
    margin-top: 1rem;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* History List */
.filter-area {
    padding: 1rem 1rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.date-input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px;
    border-radius: 5px;
    flex: 1;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    width: 100%;
}

.history-item {
    background-color: var(--secondary-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--accent-color);
}

.history-info h4 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.history-info p {
    font-size: 0.85rem;
    color: var(--highlight-color);
}

.history-action {
    color: var(--highlight-color);
}

.hidden {
    display: none !important;
}

/* Map */
#map {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Loading */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Ícone de Dispositivo */
.device-icon {
    margin-left: 8px;
    font-size: 0.9rem;
    color: #aaa;
}

/* Modo Bolso (Overlay) */
#pocket-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #333;
    /* Texto bem escuro para economizar bateria mas ser legível */
    touch-action: none;
    /* Desabilita toques padrão */
}

#pocket-mode-overlay.hidden {
    display: none;
}

#pocket-mode-overlay i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #222;
}

#pocket-mode-overlay p {
    font-size: 1.2rem;
    text-align: center;
    padding: 0 20px;
}

#pocket-mode-unlock {
    margin-top: 50px;
    padding: 15px 30px;
    border: 1px solid #333;
    border-radius: 50px;
    background: transparent;
    color: #444;
    font-size: 1rem;
}

/* Botão Modo Bolso no Dashboard */
.btn-pocket {
    background-color: #34495e;
    color: white;
    margin-top: 10px;
    width: 100%;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--secondary-color);
    padding: 20px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 15px;
    color: white;
}

.modal-content p {
    margin-bottom: 15px;
    color: var(--highlight-color);
    font-size: 0.9rem;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 5px;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
}

/* Info Overlay no Mapa */
#map-info-overlay {
    position: absolute;
    top: 80px;
    /* Abaixo do header */
    left: 10px;
    z-index: 1000;
    /* Acima do mapa Leaflet */
    pointer-events: none;
    /* Deixar clicar no mapa através dele se necessário, mas aqui tem conteúdo */
}

.info-content {
    background: rgba(13, 27, 42, 0.9);
    /* Quase opaco para leitura */
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    /* Reabilitar cliques no card */
    min-width: 200px;
}

.info-content h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--success-color);
}

.info-content p {
    font-size: 0.85rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-content small {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #aaa;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 5px;
}

/* Busca de Clientes */
.client-search-area {
    padding: 1rem;
    background-color: var(--secondary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-row {
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 2;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.status-select {
    flex: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.clients-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.client-item {
    background-color: var(--secondary-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--highlight-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.client-item:active {
    background-color: rgba(255, 255, 255, 0.1);
}

.client-item.status-ausente {
    border-left-color: var(--danger-color);
}

.client-item.status-presente {
    border-left-color: var(--success-color);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.client-header h4 {
    font-size: 1.1rem;
    color: white;
}

.client-status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.badge-ausente {
    background-color: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
}

.badge-presente {
    background-color: rgba(46, 204, 113, 0.2);
    color: var(--success-color);
}

.client-details p {
    font-size: 0.9rem;
    color: var(--highlight-color);
    margin-bottom: 2px;
}

.client-details i {
    width: 20px;
    text-align: center;
    margin-right: 5px;
}

/* Modal de Ausência */
.absence-history-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 2px solid var(--warning-color);
}

.absence-date {
    font-size: 0.85rem;
    color: var(--highlight-color);
    margin-bottom: 5px;
}

.absence-obs {
    font-size: 0.95rem;
    color: white;
}