/* Estilos modernos y actualizados para VFIT */
:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #a78bfa;
    --secondary-dark: #8b5cf6;
    --success: #10b981;
    --success-dark: #059669;
    --info: #06b6d4;
    --info-dark: #0891b2;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --light: #f8fafc;
    --dark: #1f2937;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    color: var(--gray-800);
    line-height: 1.6;
}

/* Sidebar Styles */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    position: fixed;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.sidebar.collapsed {
    margin-left: -280px;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    margin: 8px 16px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.sidebar .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.sidebar .nav-link:hover::before {
    left: 100%;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar .nav-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

/* Topbar Styles */
.topbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin-left: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid var(--gray-200);
}

.topbar.expanded {
    margin-left: 0;
}

/* Content Wrapper */
.content-wrapper {
    margin-left: 280px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-wrapper.expanded {
    margin-left: 0;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    padding: 20px 24px;
    color: var(--gray-800);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 0 4px 6px -2px rgba(99, 102, 241, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.1);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-dark) 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.2), 0 4px 6px -2px rgba(16, 185, 129, 0.1);
}

.btn-factura {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.1);
}

.btn-factura:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -3px rgba(16, 185, 129, 0.3), 0 4px 6px -2px rgba(16, 185, 129, 0.2);
}

.btn-imprimir-factura {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 1px solid #4e73df;
    color: #4e73df;
    background: white;
    border-radius: 4px;
    transition: all 0.3s;
}

.btn-imprimir-factura:hover {
    background: #4e73df;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Table Styles */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.table th {
    font-weight: 600;
    color: var(--gray-700);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border: none;
    padding: 16px 20px;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 16px 20px;
    border: none;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: linear-gradient(135deg, var(--gray-50) 0%, rgba(99, 102, 241, 0.02) 100%);
}

/* Product Card Styles */
.product-card {
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: white;
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.product-card:hover::before {
    transform: scaleX(1);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

.product-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.03) 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* Tasa de Cambio */
.tasa-cambio {
    background: linear-gradient(45deg, var(--success), var(--info));
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.badge-currency {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 0 4px 6px -2px rgba(99, 102, 241, 0.1);
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.stat-card.total-products {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
}

.stat-card.low-stock {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(217, 119, 6, 0.02) 100%);
}

.stat-card.total-sales {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.02) 100%);
}

.stat-card.total-profit {
    border-color: var(--info);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05) 0%, rgba(8, 145, 178, 0.02) 100%);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="50" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="50" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="90" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.login-card {
    width: 420px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

/* Factura Success */
.factura-success {
    border-left: 4px solid var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-radius: 8px;
}

/* Report Card */
.report-card {
    transition: all 0.3s;
}

.report-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Catalogo Card */
.catalogo-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    border-radius: 12px;
}

.catalogo-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.catalogo-card .card-img-container {
    position: relative;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.catalogo-card .card-img-container img {
    transition: transform 0.3s ease;
}

.catalogo-card:hover .card-img-container img {
    transform: scale(1.05);
}

.catalogo-card .card-title {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.catalogo-card .card-text {
    flex-grow: 1;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar Overlay/Backdrop para móvil */
.sidebar-overlay {
    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-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* En móvil, el sidebar está oculto por defecto */
    .sidebar {
        margin-left: -280px;
        width: 280px;
    }

    /* Cuando NO tiene collapsed (está abierto), se muestra */
    .sidebar:not(.collapsed) {
        margin-left: 0;
    }

    /* Cuando tiene collapsed, está oculto */
    .sidebar.collapsed {
        margin-left: -280px;
    }

    .topbar {
        margin-left: 0;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
        /* Prevenir activación accidental con scroll */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        /* Mover botón a posición más segura - esquina superior derecha */
        top: 15px;
        left: auto;
        right: 15px;
    }
    
    /* Prevenir scroll del body cuando el menú está abierto */
    body.menu-open {
        overflow: hidden;
    }

    .card-header h5 {
        font-size: 1rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    .btn-sm-mobile {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 6px;
    }

    .login-card {
        width: 90%;
        margin: 20px;
    }

    .stat-card {
        margin-bottom: 16px;
    }

    .product-card {
        margin-bottom: 12px;
        padding: 12px;
    }
}

/* Ventas Section Specific Styles */
.venta-info-card {
    height: 100%;
    border-left: 4px solid;
}

.venta-info-card.tasa {
    border-color: var(--primary);
}

.venta-info-card.cliente {
    border-color: var(--info);
}

.venta-info-card.pago {
    border-color: var(--success);
}

.venta-info-card .card-body {
    padding: 1rem;
}

.venta-info-card .info-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.venta-info-card .info-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.venta-info-card .info-value small {
    font-size: 0.85rem;
    font-weight: 400;
}

/* Carrito de Ventas */
.carrito-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.carrito-card .table {
    margin-bottom: 0;
}

.carrito-card .card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* Catalogo en Ventas */
.catalogo-ventas-card {
    max-height: 600px;
    overflow-y: auto;
}

.catalogo-ventas-card .product-card {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.catalogo-ventas-card .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.catalogo-ventas-card .product-image-container {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalogo-ventas-card .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.catalogo-ventas-card .product-card:hover .product-image {
    transform: scale(1.05);
}

.catalogo-ventas-card .product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
    line-height: 1.3;
    min-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.catalogo-ventas-card .product-price {
    font-size: 1rem;
}

.catalogo-ventas-card .product-price strong {
    color: var(--success);
    font-size: 1.1rem;
}

/* Toast Container */
.toast-container {
    z-index: 9999;
}

/* Form Controls */
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.25);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.25);
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: 16px 16px 0 0;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 0 0 16px 16px;
}

/* Configuracion Styles */
.config-logo-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 2px dashed var(--gray-300);
    padding: 10px;
}

.config-logo-preview img {
    max-width: 100%;
    max-height: 130px;
    object-fit: contain;
}
