/* ============================================
   BASE
============================================ */
body {
    font-family: "Roboto", sans-serif;
    margin: 0;
    background: #f5f7fa;
    color: #333;
}

.main-container,
.container-fluid {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

/* ============================================
   TOPBAR (solo escritorio)
============================================ */
.topbar {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

.topbar nav a {
    margin-left: 20px;
    text-decoration: none;
    color: #2196F3;
    font-weight: 500;
}

/* ============================================
   TARJETAS
============================================ */
.card {
    background: white;
    padding: 20px;
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ============================================
   FORMULARIOS (escritorio)
============================================ */
.grid-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.grid-form input,
.grid-form select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

/* ============================================
   BOTONES
============================================ */
button,
.btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
}

button:hover {
    background: #1976D2;
}

/* Botón pequeño para filtros */
.btn-filter {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

.btn-filter:hover {
    background: #1976D2;
}

/* Botones pequeños para acciones */
.btn-small {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
}

.btn-small:hover {
    background: #1976D2;
}

/* Contenedor para alinear botones en fila */
.acciones {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.acciones form {
    margin: 0;
}

/* ============================================
   TABLAS
============================================ */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th {
    background: #2196F3;
    color: white;
    padding: 10px;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

/* ============================================
   KPIs (ESCRITORIO)
============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.kpi {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.kpi-icon {
    font-size: 2em;
}

.kpi-valor {
    font-size: 1.8em;
}

/* Colores */
.kpi-green { background: #4CAF50; }
.kpi-red { background: #F44336; }
.kpi-blue { background: #2196F3; }
.kpi-purple { background: #9C27B0; }
.kpi-orange { background: #FF9800; }

/* ============================================
   MODO MÓVIL (por tamaño de pantalla)
============================================ */
@media (max-width: 768px) {

    .topbar nav {
        display: none !important;
    }

    .grid-form {
        grid-template-columns: 1fr !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: white;
        border-top: 1px solid #ddd;
        justify-content: space-around;
        align-items: center;
        z-index: 9999;
    }

    .mobile-nav .nav-item {
        text-align: center;
        color: #000;
        font-size: 0.85em;
        flex: 1;
    }

    .mobile-nav .icon {
        display: block;
        font-size: 1.5em;
    }

    .main-container,
    .container-fluid {
        margin-bottom: 80px;
    }
}

/* ============================================
   BLOQUEO TOTAL DE BARRA INFERIOR EN ESCRITORIO
============================================ */
@media (min-width: 769px) {
    .mobile-nav {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

.autocomplete-list {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    display: none;
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
}

.autocomplete-item:hover {
    background: #e3f2fd;
}

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 999;
}
.nav-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    padding: 0 10px;
}

/* ============================================
   POPUPS MODALES
============================================ */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none; /* se activa con JS */
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.popup-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    animation: popupFade 0.2s ease-out;
}

@keyframes popupFade {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.alerta-popup {
    background: #ffeb3b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
    border: 2px solid #fbc02d;
}
