/* =========================================
   1. RESET Y FUENTES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f8fafc;
    color: #1e293b;
    height: 100vh;
    overflow: hidden; /* Evita doble scroll */
}

/* =========================================
   2. UTILIDADES
   ========================================= */
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

/* FORZAR ALERTA SIEMPRE ARRIBA */
.swal2-container {
    z-index: 10000 !important; 
}

/* =========================================
   3. LOGIN (PANTALLA COMPLETA)
   ========================================= */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100; /* Menor que SweetAlert */
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 3rem 2.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header h2 {
    color: #0f172a;
    margin-top: 10px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 1rem;
    color: #1e293b;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#btnIngresar {
    width: 100%;
    padding: 14px;
    background-color: #0f172a;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#btnIngresar:hover {
    background-color: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

/* =========================================
   4. DASHBOARD (LAYOUT)
   ========================================= */
.dashboard-container {
    display: flex;
    height: 100vh;
}

/* --- SIDEBAR (MENÚ LATERAL) --- */
.sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #f1f5f9;
    color: #475569;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 900;
}

.sidebar.collapsed {
    width: 88px;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f8fafc;
    height: 75px;
}

.logo-text {
    margin-left: 10px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .user-info {
    display: none;
}

.user-info {
    padding: 20px;
    background-color: #ffffff;
    text-align: center;
    border-bottom: 1px solid #f8fafc;
}

.user-info small {
    color: #64748b;
}

.user-info strong {
    display: block;
    font-size: 1.05rem;
    color: #0f172a;
    font-weight: 600;
    margin-top: 4px;
}

/* MENÚ ITEMS */
.menu {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

/* ESTILOS DEL SUBMENÚ */
.menu-item-dropdown {
    width: 100%;
}
.menu-item .chevron {
    transition: transform 0.3s ease;
}
.menu-item.open .chevron {
    transform: rotate(180deg);
}
.submenu {
    background-color: transparent;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.submenu-item {
    width: auto;
    margin: 4px 12px 4px 32px;
    padding: 10px 15px; 
    background: none;
    border: none;
    border-radius: 10px;
    color: #64748b;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}
.submenu-item:hover {
    background-color: #f8fafc;
    color: #0f172a;
}
.submenu-item .material-icons {
    margin-right: 12px;
    font-size: 18px;
}
.sidebar.collapsed .submenu-item {
    margin: 4px 12px;
    padding: 12px;
    justify-content: center;
}
.sidebar.collapsed .chevron {
    display: none;
}

.menu-item {
    width: auto;
    margin: 4px 16px;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 12px;
    color: #64748b;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.menu-item:hover {
    background-color: #f8fafc;
    color: #0f172a;
}

.menu-item.active {
    background-color: #eef2ff;
    color: #4f46e5;
}

.menu-item.active .material-icons {
    color: #4f46e5;
}

.menu-item .material-icons {
    margin-right: 15px;
    font-size: 22px;
    color: #94a3b8;
    transition: color 0.2s;
}

.menu-item:hover .material-icons {
    color: #0f172a;
}

.menu-item.active .material-icons {
    color: #4f46e5;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
    margin: 8px 12px;
}

.sidebar.collapsed .menu-item .material-icons {
    margin-right: 0;
}

.sidebar.collapsed .text {
    display: none;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #f1f5f9;
}

.logout {
    color: #ef4444;
}

.logout .material-icons {
    color: #ef4444 !important;
}

.logout:hover {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
}

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: #f8fafc;
}

.top-bar {
    height: 75px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid #f1f5f9;
    justify-content: space-between;
    z-index: 10;
}

.btn-toggle {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    color: #475569;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-toggle:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* =========================================
   5. SECCIONES Y TABLAS
   ========================================= */
.vista-seccion {
    padding: 30px;
    overflow-y: auto;
    height: calc(100vh - 75px);
}

.header-seccion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-seccion h1 {
    font-size: 1.75rem;
    color: #0f172a;
    font-weight: 600;
}

.btn-nuevo {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.btn-nuevo:hover {
    background-color: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.15);
}

/* CONTENEDOR DE LA TABLA (CARD) */
.table-wrapper {
    background: white;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03), 0 2px 4px -2px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
}

/* DataTables Ajustes */
table.dataTable {
    border-collapse: collapse !important;
}

table.dataTable thead th {
    background-color: #ffffff;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0 !important;
    font-weight: 500;
    padding: 16px 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table.dataTable tbody td {
    padding: 16px 10px;
    border-bottom: 1px solid #f8fafc;
    color: #334155;
    vertical-align: middle;
}

table.dataTable tbody tr {
    transition: background-color 0.2s;
}

table.dataTable tbody tr:hover {
    background-color: #f8fafc;
}

/* =========================================
   6. BOTONES DE ACCIÓN (TABLA)
   ========================================= */
table.dataTable tbody td:last-child {
    white-space: nowrap;
    text-align: center;
    padding: 10px !important;
}

.btn-accion {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: inline-flex;       
    align-items: center;        
    justify-content: center;    
    width: 36px;                
    height: 36px;               
    padding: 0;                 
    margin: 0 4px;              
    border-radius: 10px;         
    transition: all 0.2s ease;
}

.btn-accion:hover {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

/* Colores Específicos */
.btn-editar .material-icons { color: #4f46e5; font-size: 18px; }
.btn-borrar .material-icons { color: #ef4444; font-size: 18px; }
.btn-imprimir .material-icons { color: #8b5cf6; font-size: 18px; }

/* =========================================
   7. TARJETAS DE ESTADÍSTICAS (INICIO)
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.card-stat {
    background: white;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03), 0 2px 4px -2px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0,0,0,0.05);
}

.card-stat h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
}

.card-stat p {
    font-size: 2.25rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    margin-top: 8px !important;
}

.card-stat .material-icons {
    font-size: 48px !important;
    opacity: 1 !important;
}

/* Colores de iconos en stats */
.card-stat:nth-child(1) .material-icons {
    color: #4f46e5 !important;
    background: #e0e7ff;
    padding: 12px;
    border-radius: 16px;
}

.card-stat:nth-child(2) .material-icons {
    color: #10b981 !important;
    background: #d1fae5;
    padding: 12px;
    border-radius: 16px;
}

.listaServicios{
    background-color: #10b981;
    color: #ffffff;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
}

/* =========================================
   8. RESPONSIVE (MÓVIL)
   ========================================= */
.overlay {
    display: none;
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 800;
}

.overlay.active {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 4px 0 20px rgba(0,0,0,0.05);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }

    .main-content {
        width: 100%;
    }

    .sidebar.collapsed {
        width: 260px;
    }

    .btn-txt {
        display: none;
    }
    
    .titulo-movil {
        font-weight: 600;
        margin-left: 15px;
        color: #0f172a;
    }

    .vista-seccion {
        padding: 20px 15px;
    }
}

/* =========================================
   9. MODAL NUEVO PEDIDO (CARRITO POS)
   ========================================= */
.pos-cart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    text-align: left;
    background: #f8fafc;
    padding: 24px;
    border-radius: 20px;
}

.pos-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03);
    border: 1px solid #f1f5f9;
    margin-bottom: 20px;
}

.pos-card.pos-add-card { margin-bottom: 0; }
.pos-card.pos-cart-card { display: flex; flex-direction: column; height: 100%; margin-bottom: 0;}

.pos-card-title {
    font-size: 1.1rem;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    font-weight: 600;
}

.pos-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.pos-col { flex: 1; }

.pos-col label, .pos-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

.pos-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: all 0.2s;
    box-sizing: border-box;
    margin: 0 !important;
    color: #1e293b;
}

.pos-input:focus { border-color: #6366f1; background: #ffffff; outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

/* Input de Precio con símbolo de moneda integrado */
.pos-price-wrapper { position: relative; flex: 1; }

.pos-currency {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-weight: 600;
}

.pos-input-price {
    padding-left: 30px;
    font-weight: 600;
    color: #0f172a;
}

.pos-add-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.pos-btn-add {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.pos-btn-add:hover { background-color: #1e293b; transform: translateY(-1px); }

/* CARRITO DE COMPRAS VISUAL */
.pos-cart-items-wrapper {
    flex: 1;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    background: #ffffff;
}

.pos-cart-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.pos-cart-table th {
    background: #f8fafc;
    padding: 12px 15px;
    color: #475569;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid #e2e8f0;
}

.pos-cart-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.pos-empty-cart {
    text-align: center;
    padding: 40px !important;
    color: #94a3b8 !important;
    font-style: italic;
}

.pos-btn-delete {
    background: #fef2f2;
    color: #ef4444;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.pos-btn-delete:hover { background: #ef4444; color: white; }

/* TOTALES */
.pos-cart-totals {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.pos-total-row, .pos-restante-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: #475569;
}

.pos-total-val { font-weight: 700; font-size: 1.4rem; color: #0f172a; }

.pos-anticipo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.pos-anticipo-row label { margin: 0; color: #4f46e5; font-weight: 600; }

.pos-restante-row {
    margin-bottom: 0;
    padding-top: 15px;
    border-top: 2px dashed #cbd5e1;
}

.pos-restante-val { color: #ef4444; font-weight: 800; font-size: 1.5rem; }

/* Responsive para pantallas pequeñas */
@media (max-width: 800px) {
    .pos-cart-container { grid-template-columns: 1fr; padding: 15px; gap: 15px;}
}

/* =========================================
   10. MODAL DE COBRO Y BILLETES
   ========================================= */
.btn-rapido {
    background-color: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.btn-rapido:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.copy-rigth {
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    color: #94a3b8;
}