/* assets/style.css — Estilos globales del Portal Lavatec Supervisión */

/* ── Reset básico ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }
body {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    background: #e8edf2;
    color: #222;
    line-height: 1.5;
}

/* ── Layout principal (barra top + sidebar + contenido) ─────────────────────── */
.layout {
    display: grid;
    grid-template-rows: 54px 1fr;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

/* ── Barra superior ─────────────────────────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1;
    background: #3992C6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo   { font-size: 1.5rem; }
.brand-name   { font-size: 1.05rem; font-weight: bold; letter-spacing: .5px; }
.topbar-user  { display: flex; align-items: center; gap: 14px; font-size: .85rem; }
.user-info    { opacity: .9; }
.btn-logout {
    background: rgba(255,255,255,.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    padding: 5px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: .82rem;
    transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.32); }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
    background: #2c3e50;
    overflow-y: auto;
    padding: 10px 0 20px;
}

/* ── Contenido principal ────────────────────────────────────────────────────── */
.main-content {
    padding: 24px 28px;
    overflow-y: auto;
}

/* ── Encabezado de página ───────────────────────────────────────────────────── */
.page-heading {
    font-size: 1.35rem;
    color: #2c3e50;
    margin-bottom: 20px;
}
.page-heading__sub {
    font-size: .85rem;
    color: #666;
    font-style: italic;
    margin-left: 6px;
}

/* ── Tarjetas ───────────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    padding: 22px 24px;
    margin-bottom: 22px;
}
.card-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 16px;
    border-bottom: 2px solid #3992C6;
    padding-bottom: 8px;
}

/* ── Tablas ─────────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
table.data-table th {
    background: #3992C6;
    color: #fff;
    padding: 9px 12px;
    text-align: left;
    white-space: nowrap;
}
table.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e3e8ef;
}
table.data-table tr:hover td { background: #f0f6fb; }
table.data-table tr:nth-child(even) td { background: #f8fafc; }
table.data-table tr:nth-child(even):hover td { background: #e9f3fa; }

/* ── Formularios ────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .83rem; color: #555; font-weight: bold; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: .9rem;
    font-family: inherit;
    transition: border .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #3992C6; outline: none; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Botones ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: .88rem;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background .2s, opacity .2s;
}
.btn:focus-visible { outline: 2px solid #3992C6; outline-offset: 2px; }
.btn:active { opacity: .8; }
.btn-primary            { background: #3992C6; color: #fff; }
.btn-primary:hover      { background: #2a7ab5; }
.btn-secondary          { background: #6c757d; color: #fff; }
.btn-secondary:hover    { background: #555; }
.btn-danger             { background: #e74c3c; color: #fff; }
.btn-danger:hover       { background: #c0392b; }
.btn-success            { background: #27ae60; color: #fff; }
.btn-success:hover      { background: #1e8449; }
.btn-sm                 { padding: 4px 12px; font-size: .78rem; }

/* ── Alertas ────────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: .88rem;
    border-left: 4px solid;
}
.alert-success { background: #d4edda; border-color: #28a745; color: #155724; }
.alert-error   { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #ffc107; color: #856404; }
.alert-info    { background: #d1ecf1; border-color: #17a2b8; color: #0c5460; }

/* ── Badges de estado ───────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: bold;
}
.badge-active   { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-repair   { background: #fff3cd; color: #856404; }
.badge-pending  { background: #d1ecf1; color: #0c5460; }
.badge-almacen  { background: #e2e3e5; color: #383d41; }  /* equipo en flujo almacén (gris, como chip de la app) */
.badge-recibir  { background: #d1f2eb; color: #0b7285; }  /* pendiente de recibir en cliente (verde azulado) */

/* ── Dashboard — tarjetas de estadísticas ───────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}
.stat-card .stat-icon  { font-size: 1.8rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: bold; color: #3992C6; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; color: #888; text-transform: uppercase; letter-spacing: .04em; }

/* ── Dashboard — grid de dos columnas (tablas) ──────────────────────────────── */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

/* ── Accesos rápidos ────────────────────────────────────────────────────────── */
.quick-access {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: 54px auto 1fr;
    }
    .sidebar       { grid-row: 2; }
    .main-content  { grid-row: 3; padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .two-col-grid   { grid-template-columns: 1fr; }
    .form-grid      { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .main-content   { padding: 12px; }
}

/* ── Layout general (topbar + sidebar + contenido) ──────────────────────────── */
:root {
    --sidebar-width: 260px;
    --topbar-height: 60px;
}

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
        "header header"
        "nav main";
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Cuando el menú está oculto */
.layout.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}
.layout.sidebar-collapsed .sidebar {
    width: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-100%);
}

.topbar {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: #2c3e50;
    color: white;
    z-index: 1000;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-logo img { display: block; }

.sidebar {
    grid-area: nav;
    background: #34495e;
    overflow-y: auto;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-content {
    grid-area: main;
    padding: 20px;
    background: #f4f7f6;
    transition: all 0.3s ease;
}

/* Botón hamburguesa (desktop: dentro del topbar; móvil: también) */
.btn-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: transform 0.2s;
}
.btn-toggle:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* Responsive móvil: el sidebar pasa a una fila horizontal bajo el topbar */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--topbar-height) auto 1fr;
        grid-template-areas:
            "header"
            "nav"
            "main";
    }
    .layout.sidebar-collapsed {
        grid-template-columns: 1fr;
    }
    .sidebar {
        overflow-y: auto;
        padding: 6px 0;
    }
    .layout.sidebar-collapsed .sidebar {
        width: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .nav-group summary { padding: 10px 12px; }
    .nav-logout a { padding: 10px 12px; }
    .nav-menu li a { padding: 8px 12px 8px 20px; }
}

/* ── Alertas (incluye .alert-danger) ────────────────────────────────────────── */
.alert-danger {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #dc3545;
    color: #721c24;
    padding: 10px 14px;
    border-radius: 5px;
    margin-bottom: 14px;
    font-size: .85rem;
}

/* ── Variantes de botón ─────────────────────────────────────────────────────── */
.btn-warning {
    background: #f1c40f;
    color: #2c3e50;
    border: none;
}
.btn-warning:hover { background: #e0b50e; }

/* ── Contador de menú (badge junto al título del grupo) ─────────────────────── */
.tab-badge {
    background: #3992C6;
    color: #fff;
    font-size: .7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: bold;
    vertical-align: middle;
}

/* ── Barra de filtros estándar ──────────────────────────────────────────────── */
.filter-bar {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: .88rem;
    height: 38px;
    box-sizing: border-box;
}
.filter-bar .btn { height: 38px; display: flex; align-items: center; }

/* ── Modal estándar ─────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

/* ── Paginación estándar ────────────────────────────────────────────────────── */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}
.page-link {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    background: #fff;
    font-size: .9rem;
}
.page-link:hover { background: #f8f9fa; }
.page-link.active { background: #007bff; color: #fff; border-color: #007bff; }
.page-link.disabled { color: #ccc; pointer-events: none; }

/* ── Spinner (loading) ──────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(57,146,198,.25);
    border-top-color: #3992C6;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}
.spinner-lg { width: 32px; height: 32px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Overlay de carga al navegar entre páginas ─────────────────────────────── */
.page-loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.page-loading-overlay.visible { display: flex; }
.page-loading-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 14px 22px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,.2);
    font-size: .95rem;
    color: #333;
}


