/* ==========================================
   1. Estilos Base (Escritorio y General)
   ========================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    color: #333;
    background-color: #f4f7f6;
}

header {
    background: #2c3e50;
    color: white;
    padding: 1rem; /* Reducido de 2rem */
}

nav {
    display: flex;
    flex-direction: column; /* Por defecto móvil */
    gap: 15px;
    align-items: center;
}

.logo {
    font-size: 1.2rem;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* Permite que el menú baje si no cabe */
    justify-content: center;
    gap: 12px;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 5px 8px;
    border-radius: 4px;
}

main {
    max-width: 900px;
    margin: 1rem auto;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 95%; /* Asegura que no toque los bordes del móvil */
    box-sizing: border-box;
}

/* ==========================================
   2. Componentes y Formularios
   ========================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: bold; 
    font-size: 0.9rem;
}

input, select, button {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem; /* Evita zoom automático en iPhone al hacer focus */
    width: 100%;
    box-sizing: border-box;
}

button {
    background-color: #27ae60;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

button:hover { background-color: #219150; }

.btn-logout {
    color: #e74c3c !important;
    border: 1px solid #e74c3c;
}

/* Tablas Responsivas */
.table-container {
    overflow-x: auto; /* Permite scroll horizontal si la tabla es grande */
    margin-top: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

/* ==========================================
   3. Utilidades y Badges
   ========================================== */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; color: white; display: inline-block; }
.entrada { background-color: #2ecc71; }
.salida { background-color: #e74c3c; }

.switch { position: relative; display: inline-block; width: 60px; height: 30px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #27ae60; }
input:checked + .slider:before { transform: translateX(30px); }

/* ==========================================
   4. Adaptación para Pantallas Grandes (Escritorio)
   ========================================== */
@media (min-width: 768px) {
    nav {
        flex-direction: row;
        justify-content: space-between;
    }
    nav ul {
        gap: 20px;
    }
    header {
        padding: 1rem 2rem;
    }
    main {
        margin: 2rem auto;
        padding: 2rem;
    }
}

/* ==========================================
   5. Impresión y Especiales
   ========================================== */
@media print {
    header, .no-print, .btn-mapa { display: none !important; }
    body { background: white; }
    main { box-shadow: none; border: none; width: 100%; max-width: 100%; margin: 0; padding: 0; }
    table { font-size: 10pt; }
}
/* Estilos para el Menú Hamburguesa */
.menu-toggle {
    display: none; /* Oculto en escritorio */
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
}

/* Ajustes Móvil (Debajo de 768px) */
@media (max-width: 767px) {
    nav {
        flex-direction: row !important; /* Logo y hamburguesa en la misma línea */
        justify-content: space-between;
        position: relative;
    }

    .menu-toggle {
        display: flex; /* Mostrar en móvil */
    }

    nav ul {
        display: none; /* Escondemos el menú por defecto */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px; /* Debajo del header */
        left: 0;
        background-color: #34495e;
        padding: 20px 0;
        z-index: 1000;
        box-shadow: 0 5px 10px rgba(0,0,0,0.2);
    }

    nav ul.active {
        display: flex; /* Se muestra al pulsar la hamburguesa */
    }

    nav ul li {
        width: 100%;
        text-align: center;
    }

    nav ul li a {
        display: block;
        padding: 15px;
        font-size: 1.1rem;
    }

    .separator { display: none; } /* Ocultar el palito "|" en móvil */
}
footer { text-align: center; padding: 2rem; font-size: 0.8rem; color: #666; }