@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/**
 * Sistema Sufarma - Estilos Principales
 * Diseño moderno basado en referencia del usuario
 */

/* ===== Variables CSS - Premium Design System ===== */
:root {
    /* Elegant Palette - Light/Vibrant System based on brand colors */
    --background: #FFFFFF; /* White */
    --card-bg: #FFFFFF;    /* White */
    --surface-elevated: #FFFFFF; /* White */
    
    --primary-color: #020e17; /* Darkest Ocean Blue */
    --primary-light: #052137; /* Darker Ocean Blue */
    --primary-dark: #0B0119;  /* Deep Black-Plum */
    
    --secondary-color: #D2C8DD; /* Lavender Plum */
    --secondary-light: rgba(210, 200, 221, 0.4);
    
    /* Ivory Text for deep blue backgrounds */
    --text-on-primary: #FFFFFF; /* White */
    
    /* Functional Colors */
    --success-color: #22C55E;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #020e17; /* Darkest Ocean Blue */
    --vencido-color: #8B5CF6;
    
    /* Legacy variables for compatibility */
    --neon-cyan: var(--primary-color);
    --neon-green: var(--success-color);
    --neon-red: var(--danger-color);
    --neon-orange: var(--warning-color);
    --neon-purple: var(--vencido-color);

    /* Text Colors */
    --text-primary: #0B0119; /* Deep Black-Plum */
    --text-secondary: #052137; /* Darker Ocean Blue */
    --text-tertiary: #747474; /* Monochrome Gray */

    /* Border Colors */
    --border-light: rgba(210, 200, 221, 0.3);
    --border-color: #D2C8DD; /* Lavender Plum */
    --border-dark: #020e17;  /* Darkest Ocean Blue */

    /* Clean Shadows */
    --shadow-sm: 0 1px 3px rgba(9, 48, 149, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(9, 48, 149, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(9, 48, 149, 0.12);
    
    /* Functional Shadows (Redefined as elegant rings) */
    --shadow-glow-cyan: 0 0 0 3px rgba(9, 48, 149, 0.15);
    --shadow-glow-red: 0 0 0 3px rgba(239, 68, 68, 0.15);
    --shadow-glow-green: 0 0 0 3px rgba(34, 197, 94, 0.15);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .logo, .product-name, .cart-title, .brand-label, .price-label, .sales-amount, .sales-label {
    font-family: 'League Spartan', sans-serif;
}


/* ===== Header ===== */
.header {
    background: var(--primary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.logo-icon {
    font-size: 2rem;
}

/* Sales Summary */
.sales-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: white;
    font-size: 0.85rem;
    margin-left: var(--space-6);
}

.sales-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.sales-label {
    font-size: 0.7rem;
    opacity: 0.85;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sales-amount {
    font-size: 0.95rem;
    font-weight: 700;
}

.sales-total {
    font-size: 1.1rem;
    color: var(--amber-200);
}

.sales-divider {
    opacity: 0.3;
    font-size: 1.2rem;
    font-weight: 300;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-on-primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--text-on-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: var(--background);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: var(--secondary-light);
}

/* ===== Main Layout ===== */
.main-container {
    max-width: 100%;
    margin: 0;
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 450px; /* Cart increased from 400px to 450px */
    gap: 1.5rem;
}

/* ===== Search Bar ===== */
.search-section {
    margin-bottom: 1.5rem;
}

.search-bar {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2), inset 0 2px 4px rgba(0,0,0,0.2);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.25rem;
}


/* ===== Product Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); /* Slightly increased to prevent price cutoff */
    gap: 1rem;
}

/* Product Card - Elegant Design */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s ease;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 20px;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* Product Image Section - Gentle Background */
.product-image-section {
    background-color: #F1F5F9;
    /* Soft greyish-silver background */
    margin: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    position: relative;
    overflow: hidden; /* Prevent overlay spill and respect border-radius */
}

.product-image {
    width: 140px;
    height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}

/* Stock Badge - Floating in Top Right */
.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--card-bg);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    z-index: 10;
}

.stock-badge.in-stock {
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
}

.stock-badge.low-stock {
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.stock-badge.out-stock {
    color: var(--neon-red);
    border: 1px solid var(--neon-red);
}

/* =========================================
   Branch Stock Overlay - Solid Design
   ========================================= */
.branch-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    padding: 10px;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

/* Show overlay on hover with spring effect */
.product-image-section:hover .branch-stock-overlay {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Stock Title */
.branch-stock-overlay .branch-stock-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary-color);
    text-align: left;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
}

.branch-stock-overlay .branch-stock-title::before {
    content: '🏬';
    font-size: 0.9rem;
}

/* Branch stock list container */
.branch-stock-overlay .branch-stock-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Reducido de 8px */
    /* Eliminamos overflow-y para evitar el scroll innecesario si cabe */
    /* overflow-y: auto; */
}

/* Branch stock items - Modern Card Style */
.branch-stock-overlay .branch-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.branch-stock-overlay .branch-stock-item:hover {
    background: var(--secondary-light);
    transform: translateX(4px);
    border-color: var(--primary-light);
}

.branch-stock-overlay .branch-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 4px;
}

.branch-stock-overlay .branch-name::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.branch-stock-overlay .branch-stock {
    font-size: 0.75rem;
    font-weight: 800;
    text-align: right;
    padding: 1px 6px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.branch-stock-overlay .branch-stock.in-stock {
    color: var(--green-300);
}

.branch-stock-overlay .branch-stock.out-stock {
    color: var(--red-300);
}

.branch-stock-overlay .branch-stock.loading {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-style: italic;
    background: transparent;
}

/* Product Info Section - Clean White Background */
.product-info-section {
    background: transparent;
    padding: 10px 16px; /* Reduced vertical padding */
}

/* Brand Label */
.brand-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

/* Product Name */
.product-name {
    font-size: 1.05rem; /* Slightly smaller to save space */
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px; /* Reduced margin */
    line-height: 1.15;
    text-transform: uppercase;
}

/* Product Codes */
.product-codes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Facturado styles removed to be replaced by per-price checkboxes */

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--secondary-light);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--card-bg);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-input:checked+.toggle-slider {
    background-color: var(--neon-cyan);
    box-shadow: var(--shadow-glow-cyan);
}

.toggle-input:checked+.toggle-slider::before {
    transform: translateX(24px);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

/* Price Grid - 3 Equal Columns */
.price-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.price-item {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.price-item:hover {
    background: var(--secondary-light);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

/* Highlight for Unit Price in Green - User Request */
.price-item.price-unit {
    border: 2px solid #22C55E;
    background: #F0FDF4;
}

.price-item.price-unit .price-label {
    color: #166534;
}

.price-item.price-unit:hover {
    background: #DCFCE7;
    border-color: #16A34A;
}

.price-item.active {
    background: #E0F2FE;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* Active Price Item */
.price-item.active {
    background: #E0F2FE;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.price-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
}

.price-info-content {
    padding: 12px 4px 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Per-Price Facturar Checkbox Styles - Divided Section */
.price-facturar-action {
    background: var(--secondary-color);
    padding: 8px 4px;
    border-top: 1.5px solid var(--border-color);
    width: 100%;
    transition: all 0.2s ease;
}

.price-item:hover .price-facturar-action {
    background: var(--secondary-light);
}

.price-check-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.price-check-container input {
    cursor: pointer;
    width: 20px; /* Increased from 16px */
    height: 20px; /* Increased from 16px */
    accent-color: var(--neon-cyan);
}

.price-check-label {
    font-size: 0.75rem; /* Increased from 0.65rem */
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.price-check-container:hover .price-check-label {
    color: var(--neon-cyan);
}

.price-value {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    width: 100%;
    white-space: nowrap;
}




/* ===== Cart Sidebar ===== */
.cart-sidebar {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.cart-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.cart-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.cart-items {
    margin-bottom: 1.25rem;
}

.cart-item {
    padding: 1rem;
    background-color: var(--secondary-color);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.cart-item-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cart-item-remove {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.125rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.cart-item-remove:hover {
    background-color: rgba(239,68,68,0.1);
}

.cart-item-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:hover {
    background-color: var(--secondary-light);
    color: white;
    border-color: var(--border-color);
}

.qty-input {
    width: 50px;
    text-align: center;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.cart-item-total {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-color);
}

.cart-totals {
    padding: 1rem 0;
    border-top: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--neon-cyan);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--border-color);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary-light);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 0.875rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.75rem;
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
}

/* ===== Loading States ===== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .cart-sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .price-buttons {
        grid-template-columns: 1fr;
    }
}


/**
 * Sistema Sufarma - Estilos Principales
 * Diseño moderno basado en referencia del usuario
 */

/* ... (MANTÉN TODO EL CÓDIGO CSS ANTERIOR AQUÍ) ... */

/* ===== AGREGAR AL FINAL DEL ARCHIVO ===== */

/* Modal Styles (Respaldo) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    background: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: white;
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.modal-body {
    padding: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--neon-red);
}

/* ===== User Selection Modal Styles ===== */
.user-error-message {
    display: none;
    padding: 0.75rem 1rem;
    background-color: var(--red-50);
    border: 1px solid var(--red-200);
    border-radius: var(--radius-md);
    color: var(--red-600);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.user-error-message.show {
    display: block;
}

.user-modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.user-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-form-select,
.user-form-input {
    padding: 0.75rem 1rem;
    background: var(--background);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: '' Inter'', sans-serif;
}

.user-form-select:focus,
.user-form-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: var(--shadow-glow-cyan);
}

.user-form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.user-modal-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: '' Inter'', sans-serif;
}

.btn-cancel {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: var(--border-color);
    color: var(--neon-red);
    border-color: var(--neon-red);
    box-shadow: var(--shadow-glow-red);
}

.btn-confirm {
    background: var(--neon-cyan);
    color: var(--background);
    box-shadow: var(--shadow-glow-cyan);
    border: none;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    background: #0ea5e9;
}

.btn-confirm:active {
    transform: translateY(0);
}

/* ===== Ventas del Día Modal Styles ===== */
.modal-ventas-dia {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
}

/* Filter Buttons Styling */
.filter-icon {
    font-size: 1.1rem;
}

.filter-text {
    font-weight: 600;
}

/* Table Container */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}

/* Sales Table */
.ventas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.ventas-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.ventas-table thead tr {
    background: var(--primary-color);
    color: white;
}

.ventas-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ventas-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
}

.ventas-table tbody tr:nth-child(even) {
    background-color: var(--secondary-color);
}

.ventas-table tbody tr:hover {
    background-color: var(--secondary-light);
}

.ventas-table td {
    padding: 0.875rem 0.75rem;
    vertical-align: middle;
}

/* Table Cell Specific Styles */
.venta-id-cell {
    font-weight: 700;
    color: var(--teal-600);
    font-size: 0.85rem;
}

.fecha-cell {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tipo-cell {
    text-align: center;
}

.producto-cell {
    max-width: 250px;
}

.producto-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.producto-codes {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cantidad-cell {
    text-align: center;
    font-weight: 600;
}

.precio-cell {
    text-align: right;
    font-weight: 600;
    color: var(--teal-700);
}

.estado-cell {
    text-align: center;
}

.total-cell {
    text-align: right;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--teal-700);
    background-color: rgba(0, 191, 165, 0.05);
}

/* Clickable Total Button for No Facturadas */
.total-cell-button {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.total-cell-button:hover {
    background-color: rgba(0, 191, 165, 0.15);
    transform: scale(1.02);
}

.total-cell-button:active {
    transform: scale(0.98);
}

.total-button-content {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.total-amount {
    font-weight: 800;
}

.invoice-icon {
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.total-cell-button:hover .invoice-icon {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-normal {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-especial {
    background-color: #F3E8FF;
    color: #6B21A8;
}

.badge-facturado {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-pendiente {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-no-facturar {
    background-color: #F3F4F6;
    color: #4B5563;
}

.badge-no-facturado {
    background-color: #D1FAE5;
    color: #065F46;
}

/* Empty State for Sales */
.empty-state-sales {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-sales p {
    font-size: 1rem;
    font-weight: 500;
}

/* Scrollbar Styling for Table */
.table-container::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #2D3748; /* Darkest */
    border-radius: 10px;
    border: 2px solid white;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #1A202C;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .modal-ventas-dia {
        width: 98%;
        max-height: 95vh;
    }

    .ventas-filters {
        gap: 0.5rem;
    }

    .filter-ventas-btn {
        min-width: 110px;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .filter-icon {
        font-size: 1rem;
    }

    .ventas-table {
        font-size: 0.75rem;
    }

    .ventas-table th,
    .ventas-table td {
        padding: 0.5rem 0.4rem;
    }
}

/* ===== Ventas del Día - Standalone Page Styles ===== */
.ventas-dia-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.ventas-dia-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.ventas-dia-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.ventas-dia-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Adjust table container for full page */
.ventas-dia-container .table-container {
    max-height: calc(100vh - 350px);
    min-height: 500px;
}

/* ===== Action Buttons for Sales Table ===== */
.actions-cell {
    text-align: center;
    padding: 0.5rem !important;
}

.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.edit-btn,
.delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.edit-btn {
    background: #0ea5e9;
    color: white;
}

.edit-btn:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(14, 165, 233, 0.3);
}

.edit-btn:active {
    transform: translateY(0);
}

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

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.delete-btn:active {
    transform: translateY(0);
}

/* ===== Ventas del Día Redesign ===== */
.ventas-dia-container {
    padding: 1rem;
    max-width: 100%;
}

.ventas-dia-header {
    margin-bottom: 2rem;
    text-align: center;
}

.ventas-dia-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.ventas-dia-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Filters */
.ventas-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-ventas-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    min-width: 160px;
    justify-content: center;
}

.filter-ventas-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.filter-ventas-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
    box-shadow: var(--shadow-md);
}

.filter-icon {
    font-size: 1.2rem;
}

/* Table Container */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    overflow-x: auto;
}

.ventas-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.ventas-table th {
    text-align: left;
    padding: 12px 16px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
}

.ventas-table tr {
    transition: all 0.2s ease;
}

.ventas-table tbody tr {
    background: var(--card-bg);
}

.ventas-table tbody tr:hover {
    background: var(--secondary-light);
}

.ventas-table td {
    padding: 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.ventas-table td:first-child {
    border-left: 1px solid var(--border-light);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.ventas-table td:last-child {
    border-right: 1px solid var(--border-light);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-normal { background: rgba(59, 130, 246, 0.1); color: var(--neon-cyan); border: 1px solid var(--neon-cyan); }
.badge-especial { background: rgba(139, 92, 246, 0.1); color: var(--neon-purple); border: 1px solid var(--neon-purple); }
.badge-facturado { background: rgba(34, 197, 94, 0.1); color: var(--neon-green); border: 1px solid var(--neon-green); }
.badge-pendiente { background: rgba(245, 158, 11, 0.1); color: var(--neon-orange); border: 1px solid var(--neon-orange); }
.badge-no-facturar { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border: 1px solid var(--border-color); }

/* Action Buttons in Table */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-edit-sale, .btn-delete-sale {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.btn-edit-sale {
    background: rgba(14, 165, 233, 0.1);
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.btn-edit-sale:hover {
    background: #0ea5e9;
    color: white;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
}

.btn-delete-sale {
    background: rgba(250, 0, 94, 0.1);
    border-color: var(--neon-red);
    color: var(--neon-red);
}

.btn-delete-sale:hover {
    background: var(--neon-red);
    color: white;
    box-shadow: var(--shadow-glow-red);
    transform: translateY(-2px);
}

/* Total Cell Button Style */
.total-cell-button {
    cursor: pointer;
    transition: all 0.3s ease;
}

.total-button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.1);
    padding: 8px;
    border-radius: 8px;
    border: 1px dashed var(--neon-green);
    color: var(--neon-green);
}

.total-cell-button:hover .total-button-content {
    background: var(--neon-green);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    border-style: solid;
}

.total-amount {
    font-weight: 800;
    font-size: 1rem;
}

.invoice-icon {
    font-size: 0.8rem;
    opacity: 0.8;
}

.ventas-dia-container .search-input {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    padding: 12px 12px 12px 45px;
    border-radius: var(--radius-md);
    width: 100%;
    transition: all 0.3s ease;
}

.ventas-dia-container .search-input:focus {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
    outline: none;
}
