/* =========================================
   1. VARIABLES Y RESET
========================================= */
:root {
    /* Paleta de colores Meraki */
    --primary: #E65100; /* Naranja fuerte - da hambre/energía */
    --primary-hover: #BF360C;
    --bg-color: #F4F6F8; /* Gris muy claro para el fondo */
    --card-bg: #FFFFFF;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    
    /* Tamaños y bordes */
    --radius-lg: 16px;
    --radius-sm: 8px;
    --touch-size: 48px; /* Tamaño mínimo para botones en móvil */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent; /* Quita el recuadro azul al tocar en Android */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* =========================================
   2. PANTALLA DE LOGIN (Mobile First)
========================================= */
.login-screen {
    width: 100%;
    padding: 20px;
    /* En móvil ocupa todo el ancho, en PC se limita */
    max-width: 400px; 
}

.login-card {
    background: var(--card-bg);
    padding: 30px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
}

.brand-header {
    text-align: center;
    margin-bottom: 30px;
}

.brand-header .logo-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.brand-header h1 {
    font-size: 1.8rem;
    color: var(--primary);
}

.brand-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================
   3. FORMULARIOS OPTIMIZADOS PARA TÁCTIL
========================================= */
.form-mobile {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    height: var(--touch-size); /* Fácil de tocar */
    padding: 0 15px;
    border: 1px solid #DCDFE6;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
}

.btn-primary {
    width: 100%;
    height: var(--touch-size);
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 10px;
}

.btn-primary:active {
    transform: scale(0.98); /* Efecto de hundimiento al tocar */
}

.msg-box {
    margin-top: 15px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 20px; /* Evita que el layout salte cuando aparece el texto */
}

/* =========================================
   4. MEDIA QUERIES (Escalando a Escritorio)
========================================= */
@media (min-width: 768px) {
    .login-screen {
        /* En pantallas más grandes le damos un poco más de aire */
        max-width: 450px;
    }
    
    .login-card {
        padding: 40px;
    }
}

/* =========================================
   5. LAYOUT PRINCIPAL Y BOTTOM NAV
========================================= */
.app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.content-area {
    flex: 1; /* Ocupa todo el espacio disponible */
    overflow-y: auto; /* Permite scrollear el contenido */
    padding: 20px;
    padding-bottom: 90px; /* Espacio para que la barra no tape el contenido final */
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    height: 70px;
    
    /* MAGIA PWA: Respeta la barra inferior de los iPhone modernos */
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    width: 20%;
    transition: color 0.2s;
}

.nav-item .icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.nav-item .label {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Estado Activo */
.nav-item.active {
    color: var(--primary);
}

.nav-item.active .icon {
    transform: translateY(-2px);
}

/* Botón Central Flotante (FAB - Floating Action Button) */
.nav-fab {
    position: relative;
    top: -15px; /* Lo subimos un poco para que destaque */
}

.fab-button {
    background-color: var(--primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(230, 81, 0, 0.4);
    margin-bottom: 4px;
    color: white;
}

.nav-fab .icon {
    font-size: 1.5rem;
    margin-bottom: 0;
}

/* =========================================
   6. RESPONSIVE (Escritorio / Bodega)
========================================= */
@media (min-width: 768px) {
    /* En PC, la barra inferior pasa a ser una barra lateral (Sidebar) */
    .app-container {
        flex-direction: row;
    }
    
    .bottom-nav {
        position: static;
        flex-direction: column;
        justify-content: flex-start;
        width: 100px;
        height: 100vh;
        padding-top: 20px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    }
    
    .nav-item {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .nav-fab {
        top: 0;
    }
    
    .content-area {
        padding-bottom: 20px;
    }
}

/* =========================================
   7. DASHBOARD WIDGETS
========================================= */
.header-dashboard {
    margin-bottom: 20px;
}

.header-dashboard h2 {
    color: var(--text-main);
    font-size: 1.5rem;
}

.header-dashboard p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas iguales */
    gap: 15px;
    margin-bottom: 25px;
}

.widget-card {
    background: var(--card-bg);
    padding: 20px 15px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #E4E7ED;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.widget-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.widget-value.highlight {
    color: var(--primary); /* Resaltamos los pendientes en Naranja Meraki */
}

/* =========================================
   MÓDULO USUARIOS
========================================= */
.usuarios-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
}

.user-card.inactive {
    opacity: 0.6;
    background-color: #f1f1f1;
}

.user-info h3 {
    margin-bottom: 2px;
    font-size: 1.1rem;
    color: var(--text-main);
}

.user-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
}
.badge-administrador { background-color: #E74C3C; }
.badge-vendedor { background-color: #3498DB; }
.badge-deposito { background-color: #F39C12; }
.badge-compras { background-color: #9B59B6; }

.user-actions button {
    background: none;
    border: none;
    font-size: 1.2rem;
    margin-left: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}
.user-actions button:hover { transform: scale(1.2); }

/* FAB Corner (Botón flotante inferior derecho) */
.fab-corner {
    position: fixed;
    bottom: 90px; /* Arriba del bottom nav */
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 1.5rem;
    border: none;
    box-shadow: 0 4px 15px rgba(255,109,0,0.4);
    cursor: pointer;
    z-index: 999;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-overlay.hidden { display: none; }

.modal-content {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-content h3 { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-secondary {
    background: #E4E7ED; color: var(--text-main);
    border: none; padding: 10px; border-radius: var(--radius-sm);
    flex: 1; font-weight: 600; cursor: pointer;
}
.modal-actions .btn-primary { flex: 1; margin-top: 0; }
.checkbox-group { flex-direction: row; align-items: center; gap: 10px; }

/* =========================================
   SECCIÓN DE ADMINISTRACIÓN (Dashboard)
========================================= */
.admin-section {
    margin-top: 30px;
}

.section-title {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 15px;
    font-weight: 700;
}

/* Tarjetas convertidas en botones/enlaces */
.action-card {
    text-decoration: none;
    align-items: center;
    text-align: center;
    padding: 20px 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.action-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
}

.action-card:active {
    transform: scale(0.95);
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.action-card h4 {
    color: var(--text-main);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.action-card p {
    color: var(--text-muted);
    font-size: 0.75rem;
}
/* FAB Corner (Botón flotante inferior derecho) */
.fab-corner {
    position: fixed;
    bottom: 90px; /* Lo levanta para que no lo tape el menú inferior */
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-size: 1.5rem;
    border: none;
    box-shadow: 0 4px 15px rgba(255,109,0,0.4);
    cursor: pointer;
    z-index: 999;
}

/* =========================================
   ADAPTACIÓN PARA PC / ESCRITORIO
========================================= */
@media (min-width: 768px) {
    
    /* 1. Transformamos el botón flotante en un botón clásico de PC */
    .fab-corner {
        bottom: auto; /* Le quitamos el anclaje de abajo */
        top: 100px;    /* Lo subimos cerca del título */
        right: 200px;
        width: auto;
        height: 48px;
        border-radius: var(--radius-sm);
        padding: 0 20px;
        display: flex;
        align-items: center;
        font-size: 1rem;
        font-weight: 600;
    }

    /* Le agregamos la palabra mágicamente con CSS en PC */
    .fab-corner::after {
        content: ' Nuevo Usuario';
        margin-left: 8px;
    }

    /* 2. Aprovechamos el ancho del monitor para mostrar las tarjetas en 2 columnas */
    .usuarios-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .user-card {
        width: calc(50% - 8px); /* Divide las tarjetas a la mitad de la pantalla */
    }

    /* 3. Ajustamos el modal para que no se vea gigante en la compu */
    .modal-content {
        max-width: 500px;
    }
}