/* ========== VARIABLES CSS ========== */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* ========== ESTILOS GENERALES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
}

/* ========== PÁGINA DE LOGIN ========== */
.min-vh-100 {
    min-height: 100vh;
}

.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
}

/* Apply a subtle purple halo to all Bootstrap-style cards */
.card {
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.06);
    overflow: visible;
    border: 2px solid rgba(124,58,237,0.06) !important;
}
.card:hover {
    box-shadow: 0 26px 68px rgba(124, 58, 237, 0.12) !important;
}
.with-halo .card {
    box-shadow: 0 22px 72px rgba(124, 58, 237, 0.18) !important;
}
.with-halo .card:hover {
    box-shadow: 0 38px 110px rgba(124, 58, 237, 0.26) !important;
}

/* ========== LAYOUT PRINCIPAL ========== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1060;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.sidebar-header small {
    font-size: 0.95rem;
}

.sidebar-logo {
    width: 65px;
    height: 65px;
    background: var(--primary-color);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.sidebar-logo i {
    font-size: 2.2rem !important;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    margin: 0.3rem 0;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-size: 1.1rem;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.2);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-link i {
    margin-right: 0.8rem;
    font-size: 1.5rem;
    width: 24px;
}

.sidebar-footer {
    flex-shrink: 0;
    width: 100%;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.8rem;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* ========== HEADER ========== */
.app-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--light-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
}

/* ========== CONTENT AREA ========== */
.content-area {
    padding: 2rem;
}

/* ========== TARJETAS ESTADÍSTICAS ========== */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: none;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Purple soft halo around stats cards */
.stats-card {
    /* subtle purple halo */
    box-shadow: 0 6px 22px rgba(124, 58, 237, 0.10), 0 0 26px rgba(124, 58, 237, 0.04) inset;
    /* allow halo to extend outside if parent clips */
    overflow: visible;
    border: 2px solid rgba(124,58,237,0.08) !important;
}
.stats-card:hover {
    box-shadow: 0 14px 40px rgba(124, 58, 237, 0.16), 0 0 36px rgba(124, 58, 237, 0.07) inset;
    border-color: rgba(124,58,237,0.14) !important;
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.stats-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* ========== TABLA DE DATOS ========== */
.data-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Purple soft halo around data tables */
.data-table {
    box-shadow: 0 8px 26px rgba(124, 58, 237, 0.08);
    overflow: visible; /* permitir halo fuera del contenedor */
    border: 2px solid rgba(124,58,237,0.06) !important;
}
.data-table:hover {
    box-shadow: 0 18px 44px rgba(124, 58, 237, 0.12);
    border-color: rgba(124,58,237,0.12) !important;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table thead {
    background-color: var(--light-color);
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
    border: none;
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* ========== BADGES ========== */
.badge {
    padding: 0.4rem 0.8rem;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* ========== BOTONES ========== */
.btn {
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: var(--success-color);
}

.btn-danger {
    background: var(--danger-color);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* ========== FORMULARIOS ========== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 0.7rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========== MODALES ========== */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1.5rem;
}

/* Modal con espacio para sidebar en desktop */
@media (min-width: 992px) {
    .modal.show {
        padding-left: 260px !important; /* Espacio para el sidebar */
    }
    
    .modal-dialog {
        margin-left: 5%;
        margin-right: auto;
    }
}

/* Botones de acción en tablas */
.btn-group-actions {
    display: flex;
    gap: 0.5rem; /* Espacio entre botones */
    flex-wrap: wrap;
}

.btn-group-actions .btn {
    min-width: 40px;
    padding: 0.375rem 0.75rem;
}

/* Mejoras para móvil */
@media (max-width: 991px) {
    /* Modal ocupa todo el ancho en móvil */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    /* Botones más grandes y separados en móvil */
    .btn-group-actions {
        gap: 0.75rem;
        justify-content: center;
    }
    
    .btn-group-actions .btn {
        min-width: 45px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Iconos más grandes en móvil */
    .btn-group-actions .btn i {
        font-size: 1.1rem;
    }
}

/* ========== CARRITO DE COMPRAS (POS) ========== */
.cart-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-footer {
    border-top: 2px solid #e5e7eb;
    padding: 1.5rem;
    background: var(--light-color);
}

.total-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ========== PRODUCTO CARD (POS) ========== */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: center;
    min-height: 180px; /* Altura mínima fija */
    justify-content: space-between; /* Distribuye contenido uniformemente */
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    border-color: rgba(37, 99, 235, 0.12);
}

.product-card.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Imagen y diseño amigable para usuarios mayores */
.product-image {
    width: 100%;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    position: relative; /* para colocar badge encima */
}
.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
/* Imagen real del producto (cuando exista) */
.product-photo {
    width: 84%;
    height: 76px;
    object-fit: contain;
    border-radius: 6px;
}
.product-initial {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}

/* Purple soft halo around product cards */
.product-card {
    /* subtle purple halo under the existing shadow */
    box-shadow: 0 10px 28px rgba(124, 58, 237, 0.09);
    overflow: visible;
}
.product-card:hover {
    box-shadow: 0 20px 52px rgba(124, 58, 237, 0.16);
}

/* Optional class to force a stronger halo when needed */
.with-halo .product-card,
.with-halo .stats-card,
.with-halo .data-table {
    box-shadow: 0 18px 60px rgba(124, 58, 237, 0.18) !important;
}
.with-halo .product-card:hover,
.with-halo .stats-card:hover,
.with-halo .data-table:hover {
    box-shadow: 0 30px 90px rgba(124, 58, 237, 0.24) !important;
}

/* Badge de existencias en la parte superior, centrada (color acorde con la app) */
/* antigua badge circular: la mantenemos oculta por compatibilidad
   ahora mostramos una pill discreta debajo del nombre */
.stock-badge-top { display:none !important; }

/* Pill discreta para mostrar existencias (no obstruye icono) */
.stock-pill {
    display: inline-block;
    background: white;
    color: var(--dark-color);
    border: 1px solid rgba(15,23,42,0.06);
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.85rem;
    /* mostrar en la parte superior centrada */
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.98);
    box-shadow: 0 4px 10px rgba(2,6,23,0.04);
}
.product-name {
    font-size: 1.05rem;
    font-weight: 800;
}
.product-meta {
    color: #52525b;
    font-size: 0.92rem;
    /* nothing here */
}

/* Miniatura en el carrito */
.cart-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
}

/* Aumentar tamaño de botones y textos para accesibilidad */
.btn, .form-control, .form-select {
    font-size: 1rem;
}

.total-amount {
    font-size: 2.4rem;
}

/* ========== BARRA DE NAVEGACIÓN INFERIOR (MÓVIL) ========== */
.mobile-bottom-nav {
    display: none; /* Oculto por defecto en desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.5rem 0;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.bottom-nav-item i {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-item span {
    font-size: 0.9rem;
    font-weight: 500;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
}

/* Botón hamburguesa para móvil */
.mobile-menu-toggle {
    display: none; /* Oculto por defecto en desktop */
    background: transparent;
    border: none;
    color: var(--dark-color);
    padding: 0.5rem;
}

.mobile-menu-toggle i {
    font-size: 2rem;
}

/* Backdrop oscuro para sidebar en móvil */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* ========== RESPONSIVE ========== */

/* Tablets grandes y desktop pequeño (768px - 992px) */
@media (max-width: 992px) {
    .stats-card {
        padding: 1.25rem;
    }
    
    .stats-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stats-value {
        font-size: 1.75rem;
    }
}

/* Tablets (max 768px) */
@media (max-width: 768px) {
    /* Mostrar barra inferior en móvil */
    .mobile-bottom-nav {
        display: flex;
    }
    
    /* Mostrar botón hamburguesa */
    .mobile-menu-toggle {
        display: block;
    }
    
    /* Sidebar: oculto por defecto, se muestra como overlay */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    /* Main content ocupa todo el ancho */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-bottom: 90px; /* Espacio para bottom nav */
    }

    .app-header {
        padding: 0.75rem 1rem;
        height: 60px;
    }
    
    .header-title h2 {
        font-size: 1.5rem;
    }
    
    .header-title i {
        display: none; /* Ocultar icono en móvil para ahorrar espacio */
    }

    .content-area {
        padding: 1rem;
    }
    
    /* Tarjetas de estadísticas: 2 columnas en tablet */
    .stats-card {
        padding: 1rem;
    }
    
    .stats-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }
    
    .stats-value {
        font-size: 1.5rem;
    }
    
    .stats-label {
        font-size: 0.85rem;
    }

    /* Tablas responsive */
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .data-table {
        margin-bottom: 1rem;
    }
}

/* Móviles pequeños (max 576px) */
@media (max-width: 576px) {
    .app-header {
        padding: 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
        height: auto;
        min-height: var(--header-height);
        position: relative;
    }
    
    .header-title {
        flex: 1;
        text-align: left;
    }
    
    .header-title h2 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
        order: 3;
    }
    
    .header-actions .btn {
        flex: 1;
        font-size: 0.7rem;
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 50px;
        border-radius: 8px;
    }
    
    .header-actions .btn i {
        font-size: 1rem;
        margin: 0 0 0.2rem 0 !important;
    }
    
    .header-actions .btn .me-2 {
        margin: 0 !important;
    }
    
    /* Table header responsive */
    .table-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        align-items: stretch;
    }
    
    .table-header h5 {
        text-align: center;
    }
    
    .table-header .form-control {
        max-width: 100% !important;
    }
    
    .content-area {
        padding: 0.75rem;
    }
    
    /* Tarjetas: más compactas */
    .stats-card {
        padding: 0.875rem;
    }
    
    .stats-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .stats-value {
        font-size: 1.35rem;
        margin-bottom: 0.2rem;
    }
    
    .stats-label {
        font-size: 0.8rem;
    }
    
    /* Botones de acceso rápido más pequeños */
    .quick-access-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .quick-access-btn i {
        font-size: 1.5rem;
    }
    
    /* Tablas más pequeñas */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* Bottom nav items más pequeños */
    .bottom-nav-item i {
        font-size: 1.6rem;
    }
    
    .bottom-nav-item span {
        font-size: 0.8rem;
    }

    /* Modales en móvil */
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    /* Formularios más compactos */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .form-control, .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Móviles MUY pequeños (max 400px) - Botones más compactos */
@media (max-width: 400px) {
    .header-actions {
        gap: 0.35rem;
    }
    
    .header-actions .btn {
        font-size: 0.65rem;
        padding: 0.4rem 0.3rem;
        min-height: 45px;
    }
    
    .header-actions .btn i {
        font-size: 0.9rem;
    }
}

/* ========== RESPONSIVE - MODO PAISAJE MÓVIL ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    
    .stats-card {
        padding: 0.75rem;
    }
    
    .stats-icon {
        width: 35px;
        height: 35px;
        margin-bottom: 0.25rem;
    }
    
    .stats-value {
        font-size: 1.2rem;
    }
}

/* ========== ANIMACIONES ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ========== LOADING SPINNER ========== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========== ALERTAS PERSONALIZADAS ========== */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
}

.alert-dismissible .btn-close {
    padding: 1.25rem;
}

/* ========== UTILIDADES ========== */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-primary-light { background-color: rgba(37, 99, 235, 0.1) !important; }
.bg-success-light { background-color: rgba(34, 197, 94, 0.1) !important; }
.bg-danger-light { background-color: rgba(239, 68, 68, 0.1) !important; }
.bg-warning-light { background-color: rgba(245, 158, 11, 0.1) !important; }

/* Botones con color agradable y alto contraste para la UI del POS */
.btn-pretty-primary {
    /* Más amigable: verde suave (legible para usuarios mayores) */
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.16);
}
.btn-pretty-primary:hover {
    transform: translateY(-2px);
}

.btn-pretty-secondary {
    /* Alternativa cálida para el botón secundario */
    background: linear-gradient(180deg, #f59e0b 0%, #f97316 100%);
    color: white;
    box-shadow: 0 6px 18px rgba(249, 115, 22, 0.12);
}
.btn-pretty-secondary[disabled], .btn-pretty-secondary.disabled {
    opacity: 0.7;
}

.btn-block-lg {
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
}

/* Icono grande para producto (mejor visibilidad) */
.product-icon-wrap {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(2,6,23,0.04);
    border: 1px solid rgba(15,23,42,0.04);
}
.product-icon {
    width: 56px;
    height: 56px;
    display: block;
}

/* Cuando la tarjeta es sólo texto centrado (sin icono) */
.product-card.text-center { 
    min-height: 150px !important; /* Altura mínima reducida */
    height: 100% !important; /* Ocupa todo el espacio disponible */
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important; /* Centra el contenido */
    align-items: stretch !important;
    padding: 10px 8px !important; /* Padding reducido */
}
.product-card.text-center .product-icon-wrap { display: none !important; }
.product-card.text-center .product-body-center { 
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px !important; /* Espacio entre elementos */
    width: 100% !important;
}
.product-card.text-center .product-name { 
    margin: 0 !important;
    margin-bottom: 2px !important;
    font-size: 0.95rem;
    line-height: 1.2;
}
.product-card.text-center .product-meta { 
    margin: 0 !important;
    margin-bottom: 4px !important;
    font-size: 0.8rem;
}
.product-card.text-center .stock-pill {
    margin: 4px auto !important;
    font-size: 0.75rem;
    padding: 2px 8px !important;
}
.product-card.text-center .product-price {
    margin: 0 !important;
    margin-top: 4px !important;
    font-size: 1.2rem !important;
    font-weight: 800 !important;
}

/* Forzar que todas las columnas de productos tengan la misma altura */
#productosGrid > [class*="col-"] {
    display: flex !important;
    flex-direction: column !important;
}

#productosGrid .product-card {
    flex: 1 !important;
    height: 100% !important;
}

/* Ajustes para iconos de Bootstrap dentro de product-icon */
.product-icon.bi {
    font-size: 2.4rem;
    color: var(--dark-color);
}

/* Icono fallback: oculto por defecto (cuando se muestra imagen real) */
.product-icon-fallback {
    display: none;
}

.product-icon-photo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
}

/* Cuando no hay imagen, el .product-photo no existe y el fallback debe mostrarse */
.product-image .product-photo[style*="display: none"] + .product-icon-fallback,
.product-image .product-icon-fallback[style*="display: flex"] {
    display: flex !important;
}

/* Precio con alto contraste y mayor tamaño */
.product-price {
    color: #0f172a; /* casi negro */
    font-size: 1.6rem;
    font-weight: 800;
}

/* Borde morado visible SOLO para tarjetas de productos */
.product-card {
    border: 4px solid rgba(124,58,237,0.28) !important;
    border-radius: 12px; /* mantener curva uniforme */
}
.product-card:hover {
    border-color: rgba(124,58,237,0.42) !important;
}
.with-halo .product-card {
    border-color: rgba(124,58,237,0.52) !important;
    box-shadow: 0 30px 90px rgba(124, 58, 237, 0.22) !important;
}
.with-halo .product-card:hover {
    border-color: rgba(124,58,237,0.68) !important;
}

/* ========== MODAL CANTIDAD VENTA ========== */
#modalCantidadVenta .modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#modalCantidadVenta .modal-header {
    border-radius: 20px 20px 0 0;
    padding: 1.5rem;
}

#modalCantidadVenta .modal-body {
    padding: 2rem 1.5rem;
}

#modalCantidadVenta #inputCantidadVenta {
    font-size: 2rem;
    font-weight: 700;
    height: 70px;
    color: var(--primary-color);
}

#modalCantidadVenta #inputCantidadVenta:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}

#modalCantidadVenta .btn-outline-secondary {
    height: 70px;
    width: 70px;
    font-size: 1.5rem;
    border-color: #dee2e6;
}

#modalCantidadVenta .btn-outline-secondary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#modalCantidadVenta .bg-light {
    background-color: #f0f9ff !important;
    border: 2px dashed var(--primary-color);
}

#modalCantidadVenta .modal-footer {
    padding: 1.5rem;
    border-top: 2px solid #f1f5f9;
}

/* ========== MÓDULO CLIENTES - MEJORADO ========== */
/* Lista de clientes */
#clientesList .list-group-item {
    font-size: 1.1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

#clientesList .list-group-item:hover {
    background-color: #f0f9ff;
    border-left-color: var(--primary-color);
    transform: translateX(5px);
}

#clientesList .list-group-item.active {
    background-color: var(--primary-color);
    border-left-color: var(--success-color);
    font-weight: 600;
}

#clientesList .badge {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}

/* Ficha del cliente */
#clienteFicha h3 {
    color: var(--dark-color);
    font-weight: 700;
}

#clienteFicha .bg-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
}

#clienteFicha .alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border: 2px solid #ffc107;
}

#clienteFicha .alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border: 2px solid #17a2b8;
}

/* Botones más grandes */
#btnAgregarFiado, #btnAbonar {
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

/* Filtros de fecha */
#fiadoFilters .btn {
    font-size: 1rem;
    padding: 0.6rem 1rem;
    font-weight: 500;
}

#fiadoFilters .btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* Listas con mejor espaciado */
#deudasList .list-group-item,
#fiadosDiaList .list-group-item {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

#deudasList .list-group-item:hover,
#fiadosDiaList .list-group-item:hover {
    background-color: #f8f9fa;
    border-left-color: var(--info-color);
}

/* Iconos más visibles */
.card-title i {
    font-size: 1.3rem;
}

/* Sombras suaves */
.shadow-sm {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.075) !important;
}

/* ========== MODAL ALERTAS DE DEUDAS ========== */
.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-circle i {
    font-size: 1.5rem;
}

#modalAlertaDeudas .list-group-item {
    border-left: none;
    border-right: none;
    padding: 1rem 1.5rem;
    transition: background-color 0.2s ease;
}

#modalAlertaDeudas .list-group-item:first-child {
    border-top: none;
}

#modalAlertaDeudas .list-group-item:hover {
    background-color: #f8f9fa;
}

#modalAlertaDeudas .modal-content {
    border-radius: 15px;
}

#modalAlertaDeudas .modal-header {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

/* ========== BOTÓN FLOTANTE DE VOZ ========== */
.voice-button {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.voice-button:active {
    transform: scale(0.95);
}

.voice-button.listening {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: voicePulseAnimation 1.5s infinite;
}

.voice-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(102, 126, 234, 0.6);
    opacity: 0;
    pointer-events: none;
}

.voice-button.listening .voice-pulse {
    animation: pulseRing 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes voicePulseAnimation {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(239, 68, 68, 0.8);
    }
}

/* Responsive para móvil */
@media (max-width: 768px) {
    .voice-button {
        bottom: 90px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* ========== BOTÓN FLOTANTE DEL CARRITO ========== */
.cart-button {
    position: fixed;
    bottom: 180px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounceIn 0.5s ease;
}

.cart-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(16, 185, 129, 0.6);
}

.cart-button:active {
    transform: scale(0.95);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive para móvil */
@media (max-width: 768px) {
    .cart-button {
        bottom: 160px;
        right: 20px;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .cart-badge {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
}

/* ========== CALCULADORA DE VOZ ========== */
.calculadora-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.calculadora-icon-circle {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculadora-icon-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.calculadora-status {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.resultado-calculadora {
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.calculadora-instrucciones {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #667eea;
}

#btnActivarCalculadora {
    transition: all 0.3s ease;
}

#btnActivarCalculadora:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

#btnDetenerCalculadora:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

#btnReiniciarCalculadora:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

/* ========== FACTURA / TICKET ========== */
.factura-ticket {
    padding: 20px;
    background: #fff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.factura-ticket .factura-header h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.factura-ticket hr {
    border: none;
    border-top: 1px dashed #ccc;
    margin: 10px 0;
}

.factura-ticket .factura-info {
    font-size: 12px;
}

.factura-ticket .factura-productos table {
    font-size: 12px;
}

.factura-ticket .factura-totales {
    font-size: 14px;
}

.factura-ticket .factura-footer {
    font-size: 12px;
    color: #666;
}

/* Modal de factura */
#modalFactura .modal-body {
    background: #f5f5f5;
}

#modalFactura .factura-ticket {
    max-width: 280px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* Estilos para impresión */
@media print {
    body * {
        visibility: hidden;
    }
    
    .factura-ticket, 
    .factura-ticket * {
        visibility: visible;
    }
    
    .factura-ticket {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        padding: 5mm;
        box-shadow: none;
    }
}

/* Evitar que las tarjetas (login .card) sigan animándose cuando un modal está abierto
   Esto previene parpadeos causados por transform/box-shadow heredados de .card
   Bootstrap añade la clase `modal-open` al <body> cuando un modal está activo. */
body.modal-open .card {
    transform: none !important;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.06) !important;
    transition: none !important;
}

/* Asegurar que los hover effects no se apliquen mientras el modal esté abierto */
body.modal-open .card:hover {
    transform: none !important;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.06) !important;
}

/* Clase para desactivar animaciones en elemento específico (login card) */
.no-anim {
    -webkit-animation: none !important;
    animation: none !important;
    transition: none !important;
    transform: none !important;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.06) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* SISTEMA DE MULTI-CARRITOS - Estilos para selector de carritos   */
/* ═══════════════════════════════════════════════════════════════ */

.selector-carritos-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid rgba(102, 126, 234, 0.2) !important;
}

.selector-carritos {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-carrito {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-carrito:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    border-color: #667eea;
}

.btn-carrito.activo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-carrito.con-items:not(.activo) {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0ea5e9;
    color: #0369a1;
}

.btn-carrito.con-items.activo {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-carrito .carrito-numero {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0.9;
}

.btn-carrito .carrito-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-nuevo-carrito {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 2px dashed #94a3b8;
    color: #64748b;
}

.btn-nuevo-carrito:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0ea5e9;
    color: #0369a1;
}

/* Responsive para móvil */
@media (max-width: 768px) {
    .selector-carritos-card .card-body {
        padding: 10px !important;
    }
    
    .selector-carritos-card .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .selector-carritos-card small.text-muted {
        display: none;
    }
    
    .btn-carrito {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    
    .btn-carrito .carrito-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
        top: -5px;
        right: -5px;
    }
}

/* Animación de entrada para carritos con items */
@keyframes carritoLleno {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.btn-carrito.con-items {
    animation: carritoLleno 0.3s ease;
}
