/* ==========================================================================
   styles.css - TODO POR MAYOR (E-COMMERCE PREMIUM + ERP/POS SARMII V2.0)
   ========================================================================== */

/* INYECCIÓN DE TIPOGRAFÍA PREMIUM PARA BOUTIQUE */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    /* Paleta Extraída de tu Imagen (Estilo Boutique Nude/Pastel) */
    --color-pink-soft: #E6C3CD;   /* Rosa pastel suave */
    --color-nude-warm: #C8967D;   /* Nude/Camel cálido (Usado en iconos hover) */
    --color-pale-bg: #F0E6EB;     /* Lila/Rosa súper pálido */
    
    /* Controles de Marca e Interfaz (Suavizados) */
    --primary: #52443E;          /* Marrón/Taupe oscuro elegante (Textos, Iconos y Sidebar) */
    --primary-hover: #C8967D;    /* Nude cálido para botones */
    --accent: #E6C3CD;           /* Rosa suave principal */
    --accent-hover: #D6B1BD;
    
    /* FONDOS ADMIN: Blanco puro y grises neutros para no cansar la vista */
    --secondary: #F4F4F4;        /* Gris claro neutro para inputs */
    --text-main: #52443E;        
    --text-muted: #8A7D78;       
    --bg-main: #FFFFFF;          /* Blanco puro para tarjetas */
    --bg-body: #FFFFFF;          /* BLANCO PURO para el fondo general y el CPanel */
    --border: #EAEAEA;           /* Bordes grises suaves y neutros */

    /* Semántica ERP SARMII */
    --success: #659C82;          
    --success-bg: #EDF3F0;
    --success-text: #395D4D;
    
    --warning: #D99D55;          
    --warning-bg: #FBF5EE;
    --warning-text: #825827;
    
    --danger: #D27676;           
    --danger-bg: #F9EFEF;
    --danger-text: #8A3D3D;
    
    --info: #6A8EAE;             
    --info-bg: #EFF3F6;
    --info-text: #39556E;

    /* Efectos y Estructura */
    --bg-glass: rgba(255, 255, 255, 0.98);
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(82, 68, 62, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(82, 68, 62, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(82, 68, 62, 0.1);
    --shadow-floating: 0 20px 40px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    --z-header: 100; --z-drawer: 200; --z-toast: 3000;
}

/* ==========================================
   RESETEO GLOBAL Y TIPOGRAFÍA ELEGANTE
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { 
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    background-color: var(--bg-body); 
    color: var(--text-main); 
    line-height: 1.6; 
    overflow-x: hidden; 
}

ul { list-style: none; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

.view-active { display: block; animation: fadeIn var(--transition) forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Clases Utilitarias */
.text-center { text-align: center; }
.text-gray { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.85rem; }
.text-md { font-size: 1.1rem; }
.text-xl { font-size: 1.5rem; font-weight: 600; }
.w-100 { width: 100%; }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; } .mb-3 { margin-bottom: 0.75rem; } .mb-4 { margin-bottom: 1rem; }
.pb-2 { padding-bottom: 0.5rem; } .pb-3 { padding-bottom: 0.75rem; }
.border-bottom { border-bottom: 1px solid var(--border); }
.border-top { border-top: 1px dashed var(--border); }
.block { display: block; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow-1 { flex-grow: 1; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 1rem; }

/* ==========================================
   BOTONES Y FORMULARIOS
   ========================================== */
button { cursor: pointer; border: none; transition: var(--transition); border-radius: var(--radius); font-weight: 500; }
.btn-primary { background: var(--primary-hover); color: white; padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-primary:hover:not(:disabled) { background: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline { background: transparent; border: 1px solid var(--primary-hover); color: var(--primary-hover); padding: 0.5rem 1rem; border-radius: var(--radius); }
.btn-outline:hover:not(:disabled) { background: var(--primary-hover); color: white; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Iconos de Ajustes y Carrito */
.btn-icon { 
    background: transparent !important; 
    color: var(--primary); 
    font-size: 1.4rem; 
    position: relative; 
    padding: 0.5rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: 44px; 
    height: 44px; 
    transition: 0.2s;
}
.btn-icon:hover { color: var(--primary-hover); transform: scale(1.05); }

.btn-close { background: transparent; color: var(--text-muted); font-size: 1.25rem; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-close:hover { color: var(--danger); background: var(--danger-bg); }
.btn-text { background: transparent; color: var(--text-muted); padding: 0.75rem; text-decoration: underline; }
.btn-text:hover { color: var(--primary-hover); }

/* Burbuja de cantidad en el carrito */
.badge { position: absolute; top: 0; right: 0; background: var(--accent); color: var(--primary); font-size: 0.75rem; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; border: 2px solid var(--bg-main); transform: translate(10%, -10%); }
.badge-pulse { animation: pulseAnim 2s infinite; }
@keyframes pulseAnim { 0% { box-shadow: 0 0 0 0 rgba(230, 195, 205, 0.6); } 70% { box-shadow: 0 0 0 6px rgba(230, 195, 205, 0); } 100% { box-shadow: 0 0 0 0 rgba(230, 195, 205, 0); } }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea { width: 100%; padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; outline: none; transition: var(--transition); background: var(--bg-main); color: var(--text-main); font-weight: 400;}
input:focus, select:focus, textarea:focus { border-color: var(--primary-hover); box-shadow: 0 0 0 3px rgba(200, 150, 125, 0.15); }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; min-width: 0; }
textarea { resize: vertical; min-height: 80px; }

/* ==========================================
   HEADER 3-COLUMNAS & GLASSMORPHISM
   ========================================== */
.glass-header { 
    position: sticky; top: 0; z-index: var(--z-header); 
    background: var(--bg-glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); 
    border-bottom: 1px solid var(--border); 
}

.header-container {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 12px 5%; max-width: 1600px; margin: 0 auto; width: 100%; height: 76px;
}

.h-col { display: flex; align-items: center; }
.h-left { flex: 1; justify-content: flex-start; min-width: 0; }
.h-center { flex: 2; justify-content: center; width: 100%; }
.h-right { flex: 1; justify-content: flex-end; gap: 8px; min-width: 0; }

.search-input { border-radius: var(--radius-pill); background: var(--secondary); border: 1px solid var(--border); }
.search-input:focus { background: var(--bg-main); }
.mobile-flex { display: none; }

/* ==========================================
   CATÁLOGO E-COMMERCE
   ========================================== */
.category-scroll::-webkit-scrollbar { display: none; }
.category-scroll { -ms-overflow-style: none; scrollbar-width: none; }
.cat-item { padding: 8px 20px; border-radius: var(--radius-pill); font-size: 0.9rem; font-weight: 400; color: var(--text-muted); cursor: pointer; transition: var(--transition); border: 1px solid transparent; }
.cat-item:hover { background: var(--secondary); color: var(--primary); }
.cat-item.active { background: var(--primary); color: white; box-shadow: var(--shadow-sm); font-weight: 500;}

.hero { max-width: 1400px; margin: 3.5rem auto 2rem; padding: 0 5%; text-align: center; }
.hero h2 { 
    font-size: 2.2rem; font-weight: 600; text-transform: uppercase; 
    letter-spacing: 1.5px; margin-bottom: 0.8rem; color: var(--primary); line-height: 1.4;
}
.hero p { color: var(--text-muted); font-size: 1rem; font-weight: 400; text-transform: uppercase; letter-spacing: 2px; max-width: 800px; margin: 0 auto; }

.catalog { max-width: 1400px; margin: 0 auto 5rem; padding: 2rem 5%; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

.product-card { background: var(--bg-main); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition); display: flex; flex-direction: column; border: 1px solid var(--border); }
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--primary-hover); }

.product-img { width: 100%; aspect-ratio: 4/5; object-fit: contain; background: var(--bg-main); border-bottom: 1px solid var(--border); }

.product-info { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.product-title { font-size: 1.15rem; font-weight: 500; color: var(--primary); margin-bottom: 0.3rem; line-height: 1.3; }
.price-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; font-size: 0.95rem; }
.section-title { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.6rem; }

.size-selector { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1rem; }
.btn-size { background: var(--bg-main); border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 400; text-align: center; color: var(--text-main); font-size: 0.85rem; transition: var(--transition); }
.btn-size:hover { border-color: var(--primary-hover); background: var(--secondary); }
.btn-size.selected { background: var(--primary-hover); color: white; border-color: var(--primary-hover); font-weight: 500;}

.btn-cart-unit { background: var(--primary); color: white; border: none; padding: 0.9rem; border-radius: 8px; width: 100%; font-weight: 500; font-size: 0.95rem; cursor: pointer; transition: var(--transition); display: flex; justify-content: center; align-items: center; gap: 8px; }
.btn-cart-unit:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(200,150,125,0.2); }

.wholesale-dropdown {
    position: absolute; bottom: 100%; left: 0; width: 100%; background: var(--bg-main); padding: 15px; border-radius: var(--radius-md); box-shadow: 0 -10px 25px rgba(82, 68, 62, 0.15); border: 1px solid var(--border); z-index: 50; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; animation: slideUpFade 0.2s ease forwards;
}
@keyframes slideUpFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.btn-pack-outline { display: flex; justify-content: space-between; align-items: center; background: var(--bg-main); border: 1px solid var(--primary-hover); color: var(--primary); padding: 0.8rem 1rem; border-radius: 8px; font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: var(--transition); width: 100%; }
.btn-pack-outline span:last-child { color: var(--text-muted); font-weight: 500; }
.btn-pack-outline:hover { background-color: var(--primary-hover); color: white; transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-hover);}
.btn-pack-outline:hover span:last-child { color: rgba(255,255,255,0.9); }

.btn-pack-green { border-color: var(--success); color: var(--success-text); background: var(--success-bg); }
.btn-pack-green span:last-child { color: var(--success); }
.btn-pack-green:hover { background-color: var(--success); border-color: var(--success); color: white; }
.btn-pack-green:hover span:last-child { color: rgba(255,255,255,0.9); }

/* ==========================================
   CARRITO Y CHECKOUT (SIDEBAR & MODALS)
   ========================================== */
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(82,68,62,0.6); backdrop-filter: blur(4px); z-index: 1500; display: flex; justify-content: flex-end; opacity: 1; transition: opacity 0.3s; }
.sidebar-overlay.hidden { opacity: 0; pointer-events: none; }
.sidebar-content { width: 100%; max-width: 450px; background: var(--bg-main); height: 100%; display: flex; flex-direction: column; transform: translateX(0); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: -10px 0 30px rgba(0,0,0,0.05); }
.sidebar-overlay.hidden .sidebar-content { transform: translateX(100%); }

.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 600; color: var(--primary); }
.sidebar-body { padding: 1.5rem; flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1.2rem; }
.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border); background: var(--secondary); }

.cart-item { display: flex; gap: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 1.2rem; position: relative; }
.cart-item:last-child { border-bottom: none; padding-bottom: 0; }
.cart-item-img { width: 80px; height: 100px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-main); }
.cart-item-info { flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between;}
.cart-item-title { font-weight: 500; font-size: 0.95rem; color: var(--primary); line-height: 1.2; padding-right: 30px;}
.cart-item-meta { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; margin-top: 4px; }
.cart-item-price { font-weight: 600; color: var(--primary); font-size: 1.1rem; }

.cart-qty-control { display: flex; align-items: center; background: var(--bg-main); border: 1px solid var(--border); border-radius: 6px; width: fit-content; overflow: hidden;}
.cart-qty-btn { background: transparent; border: none; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 500; color: var(--primary); transition: 0.2s; }
.cart-qty-btn:hover { background: var(--secondary); color: var(--primary-hover); }
.qty-display { font-size: 0.95rem; font-weight: 500; min-width: 30px; text-align: center; border-left: 1px solid var(--border); border-right: 1px solid var(--border); line-height: 30px;}

.cart-summary .summary-row { display: flex; justify-content: space-between; margin-bottom: 0.6rem; font-size: 1rem; color: var(--text-muted); }
.cart-summary .total { font-size: 1.3rem; font-weight: 600; margin-top: 1rem; border-top: 2px dashed var(--border); padding-top: 1rem; color: var(--primary); }

.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(255, 255, 255, 0.92); 
    backdrop-filter: blur(6px); 
    z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; 
    opacity: 1; transition: opacity 0.2s; 
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content { 
    background: var(--bg-main); width: 100%; border-radius: 16px; 
    box-shadow: var(--shadow-floating); border: 1px solid var(--border); 
    max-height: 95vh; overflow-y: auto; position: relative; transform: scale(1); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.modal-overlay.hidden .modal-content { transform: scale(0.95); }
.checkout-flow { max-width: 550px; }
.login-box { max-width: 400px; padding: 2.5rem 2rem; }

.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--bg-main); z-index: 10; }
.modal-header h2 { font-size: 1.25rem; font-weight: 600; color: var(--primary); margin: 0; }
.modal-body { padding: 1.5rem; }
.checkout-step h3 { margin-bottom: 1.2rem; font-size: 1.1rem; font-weight: 500; color: var(--primary); border-bottom: 2px solid var(--primary-hover); padding-bottom: 0.5rem; display: inline-block; }
.checkout-summary-box { background: var(--secondary); padding: 1.5rem; border-radius: var(--radius-md); text-align: center; border: 1px dashed var(--border); }

/* ==========================================
   TOASTS Y ANIMACIONES DE CARGA
   ========================================== */
.toast-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--primary); color: white; padding: 14px 24px; border-radius: var(--radius-pill); box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 12px; animation: toastUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; font-weight: 400; font-size: 0.95rem; }
.toast.success { background: var(--primary); border-left: 4px solid var(--success); }
.toast.error { background: var(--danger); border-left: 4px solid var(--danger-text);}
.toast.warning { background: var(--warning); color: var(--primary); }
@keyframes toastUp { from { transform: translateY(20px) scale(0.9); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.global-loader { position: fixed; inset: 0; background: rgba(255,255,255,0.85); backdrop-filter: blur(4px); z-index: 10000; display: flex; justify-content: center; align-items: center; }
.spinner { width: 50px; height: 50px; border: 4px solid var(--color-pale-bg); border-top-color: var(--primary-hover); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   LA "GALLETITA" FLOTANTE MÓVIL
   ========================================== */
.mobile-floating-cart { 
    display: none; position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%) translateY(150%); 
    width: 90%; max-width: 360px; background: var(--primary); color: white; padding: 12px 20px; 
    z-index: 99; justify-content: space-between; align-items: center; box-shadow: var(--shadow-floating); 
    cursor: pointer; transition: transform var(--transition-bounce); border-radius: var(--radius-pill); 
}
.mobile-floating-cart.active { display: flex; transform: translateX(-50%) translateY(0); }
.floating-cart-info { display: flex; align-items: center; gap: 12px; }
.floating-badge { background: var(--accent); color: var(--primary); font-size: 0.9rem; font-weight: 600; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.floating-text { font-weight: 500; font-size: 0.95rem; }
.floating-cart-total { font-weight: 600; font-size: 1.1rem; background: rgba(255,255,255,0.15); padding: 4px 12px; border-radius: var(--radius-pill); }

/* ==========================================
   SISTEMA SARMII: ADMIN CPANEL / DASHBOARD
   ========================================== */
.admin-layout { display: flex; height: 100vh; background: var(--bg-body); overflow: hidden; }

.admin-sidebar { width: 260px; background: var(--primary); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.admin-brand { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.admin-nav { display: flex; flex-direction: column; padding: 1rem 0; flex-grow: 1; overflow-y: auto; }

.nav-item { 
    padding: 1rem 1.5rem; color: rgba(255, 255, 255, 0.75); text-decoration: none; 
    display: flex; align-items: center; gap: 1rem; transition: var(--transition); border-left: 4px solid transparent; font-size: 0.95rem; font-weight: 400;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.1) !important; color: #FFFFFF !important; border-left-color: #FFFFFF !important; font-weight: 500; }

.admin-content { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; background: #FFFFFF; }
.admin-topbar { background: #FFFFFF; padding: 1.25rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); z-index: 10;}
.admin-topbar h2 { font-size: 1.25rem; font-weight: 500; color: var(--primary); margin: 0;}
.admin-body { padding: 2rem; overflow-y: auto; flex-grow: 1; background: #FFFFFF; }

.card { background: #FFFFFF; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.p-4 { padding: 1.5rem; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.stat-card { background: #FFFFFF; padding: 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: center;}
.stat-card h3 { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; font-weight: 500; letter-spacing: 0.5px;}
.stat-value { font-size: 1.8rem; font-weight: 600; color: var(--primary); line-height: 1;}

.orders-tabs { display: flex; gap: 1.5rem; border-bottom: 2px solid var(--border); }
.order-tab-btn { background: transparent; border: none; padding: 0.75rem 0.5rem; font-size: 0.95rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: var(--transition); display: flex; align-items: center; gap: 8px; }
.order-tab-btn:hover { color: var(--primary); }
.order-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600;}
.order-tab-content { display: none; animation: fadeIn 0.3s ease; }
.order-tab-content.active { display: block; }

.sub-tabs-container { background: var(--secondary); padding: 6px; border-radius: 8px; display: inline-flex; border: 1px solid var(--border); }
.sub-tab-btn { background: transparent; border: none; padding: 8px 24px; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); border-radius: 6px; transition: var(--transition); display: flex; align-items: center; gap: 8px; }
.sub-tab-btn.active { background: #FFFFFF; color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600;}
.sub-tab-content { display: none; animation: fadeIn 0.3s ease; }
.sub-tab-content.active { display: block; }

.table-responsive { overflow-x: auto; background: #FFFFFF; border-radius: var(--radius); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
.table th { font-weight: 500; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; padding: 1rem; border-bottom: 2px solid var(--border); background: #FFFFFF; white-space: nowrap;}
.table td { font-size: 0.9rem; vertical-align: middle; padding: 1rem; border-bottom: 1px solid var(--border); color: var(--text-main); }
.table tbody tr:hover { background-color: var(--secondary); } 
.table tbody tr:last-child td { border-bottom: none; }

.modern-select { appearance: none; background: transparent url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%238A7D78%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E") no-repeat right .8rem top 50%; background-size: .65rem auto; padding: 0.4rem 2rem 0.4rem 1rem; border-radius: 9999px; font-size: 0.85rem; font-weight: 500; border: 1px solid var(--border); cursor: pointer; transition: var(--transition); outline: none; }
.modern-select.pending { color: var(--warning-text); background-color: var(--warning-bg); border-color: #E8D3B9; }
.modern-select.prepared { color: var(--success-text); background-color: var(--success-bg); border-color: #BDD4C8; }

.btn-action { background: var(--secondary); color: var(--text-muted); border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); cursor: pointer; font-size: 0.95rem;}
.btn-action:hover { background: var(--border); color: var(--primary); }
.btn-action.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: #EAC4C4; }

.empty-state { padding: 4rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 3rem; color: #D1CDCB; margin-bottom: 1rem; display: block; }
.status-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; display: inline-block;}

.border-l-warning { border-left: 5px solid var(--warning); border-radius: var(--radius-md); }
.border-l-success { border-left: 5px solid var(--success); border-radius: var(--radius-md); }
.input-active { border-color: var(--success) !important; background-color: var(--success-bg) !important; color: var(--success-text); font-weight: 500;}

.toggle-switch-container { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-switch-container:last-child { border-bottom: none; }
.toggle-label { font-size: 0.95rem; font-weight: 400; color: var(--primary); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #D1CDCB; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(82,68,62,0.1); }
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* ==========================================
   PUNTO DE VENTA (POS) - ESTRUCTURA BASE
   ========================================== */
.pos-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 1.5rem; height: calc(100vh - 170px); min-height: 0; }
.pos-container-relative { position: relative; height: 100%; border-radius: var(--radius-lg); }

.pos-overlay { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); z-index: 50; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s; opacity: 1; }
.pos-overlay.hidden { opacity: 0; pointer-events: none; }
.pos-overlay-content { background: #FFFFFF; padding: 2.5rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-floating); text-align: center; max-width: 400px; width: 90%; border: 1px solid var(--border); }

.pos-products-area { background: #FFFFFF; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 1.5rem; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pos-cart-area { background: #FFFFFF; border-radius: var(--radius-lg); border: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.5rem; height: 100%; min-height: 0; }

/* ==========================================
   CORRECCIÓN CRÍTICA: GRILLA Y TARJETAS POS
   ========================================== */

/* 1. La grilla debe permitir que las filas crezcan sin aplastar a las tarjetas */
.pos-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* 3 COLUMNAS EXACTAS COMO EN LA FOTO 1 */
    grid-auto-rows: max-content; /* ESTO EVITA EL APLASTAMIENTO DE LOS BOTONES */
    gap: 15px; 
    flex: 1 1 auto; 
    align-content: start; 
    overflow-y: auto; 
    padding-right: 8px; 
    padding-bottom: 10px; 
}
@media (max-width: 1300px) {
    .pos-grid { grid-template-columns: repeat(2, 1fr); }
}
.pos-grid::-webkit-scrollbar { width: 6px; }
.pos-grid::-webkit-scrollbar-thumb { background: #D1CDCB; border-radius: 4px; }

/* 2. La Tarjeta JAMÁS debe colapsar su contenido */
.pos-item-card { 
    display: flex; 
    flex-direction: column; 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    overflow: hidden; 
    background: #FFFFFF; 
    transition: var(--transition); 
    height: max-content; /* ESENCIAL: Obliga a mostrar la tarjeta COMPLETA */
    min-height: min-content; 
}
.pos-item-card:hover { border-color: var(--primary-hover); transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* 3. Imagen limpia y ancha en la parte superior */
.pos-img-wrapper { 
    width: 100%; 
    height: 140px; 
    background: #FFFFFF; 
    border-bottom: 1px solid var(--border); 
    padding: 0; 
    flex-shrink: 0; 
}
.pos-img-wrapper img { width: 100%; height: 100%; object-fit: contain; }

/* 4. Textos idénticos a tu Foto 1 (Cód: Físico: ) */
.pos-info-wrapper { padding: 12px; display: flex; flex-direction: column; flex-grow: 1; text-align: center; justify-content: flex-start; gap: 4px;}
.pos-info-wrapper h4 { font-size: 0.95rem; font-weight: 700; margin: 0; color: var(--primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; white-space: normal; line-height: 1.2; }

/* Para que JS no ponga cajas verdes de fondo al stock, sobreescribimos los estilos desde CSS */
.pos-stock-badge { 
    display: block; 
    background: transparent !important; 
    border: none !important; 
    padding: 0; 
    font-size: 0.9rem; 
    font-weight: 600; 
    margin: 4px auto 10px auto; 
}

/* 5. Botones apilados ocupando todo el ancho */
.pos-buttons-grid { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    width: 100%; 
    margin-top: auto; 
}

.pos-btn { 
    background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 6px; 
    padding: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-main); 
    transition: 0.2s; cursor: pointer; width: 100%; 
}
.pos-btn:hover { background: var(--secondary); color: var(--primary); border-color: var(--primary-hover); }

/* Botón de caja embalaje */
.pos-btn-pack { color: #10b981; border-color: #10b981; background: #f0fdf4; }
.pos-btn-pack:hover { background: #10b981; color: white; border-color: #10b981; }

/* ==========================================
   PAGINACIÓN Y RESTO DEL POS
   ========================================== */
.page-btn {
    background: var(--primary); color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: 0.2s;
}
.page-btn:hover:not(:disabled) { background: var(--primary-hover); }
.page-btn:disabled { background: var(--secondary); color: var(--text-muted); cursor: not-allowed; }

.pos-cart-items-container { flex: 1 1 auto; overflow-y: auto; min-height: 0; margin-bottom: 15px; border-bottom: 1px dashed var(--border); padding-bottom: 10px;}
.pos-pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.inline-price-input { width: 80px; padding: 4px; font-size: 0.95rem; font-weight: 600; color: var(--primary); border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: right; transition: 0.2s; cursor: pointer; }
.inline-price-input:hover, .inline-price-input:focus { border-color: var(--primary-hover); background: #FFFFFF; cursor: text; box-shadow: 0 0 0 2px rgba(200,150,125,0.15); }

/* ==========================================
   IMPRESIÓN (HIDE EVERYTHING EXCEPT TICKET)
   ========================================== */
.print-only { display: none; }
@media print {
    body * { visibility: hidden; }
    #print-section, #print-section * { visibility: visible; }
    #print-section { position: absolute; left: 0; top: 0; width: 100%; padding: 20px; background: white; }
    .modal-overlay, #store-view, #admin-view, #toast-container, header, aside { display: none !important; }
    @page { margin: 0; }
}

/* ==========================================
   DISEÑO MÓVIL (APP NATIVA / BOTTOM SHEET)
   ========================================== */
@media (max-width: 900px) {
    .desktop-only { display: none !important; }
    .mobile-flex { display: flex; z-index: 2; }
    
    .header-container { flex-wrap: wrap; padding: 12px 5% 16px; height: auto; gap: 16px; position: relative; }
    .h-center { order: 3; flex: 1 1 100%; max-width: 100%; }
    .brand-logo { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); }
    .brand-logo img { height: 40px; }
    
    .hero { margin: 1.5rem auto; }
    .hero h2 { font-size: 1.8rem; letter-spacing: 1px;}
    .catalog { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 0 5%; margin-bottom: 100px; }
    .product-card { border-radius: 16px; }
    .product-info { padding: 1rem; }
    .product-title { font-size: 1rem; }
    .btn-cart-unit { padding: 0.75rem; font-size: 0.9rem; }
    .btn-pack-outline { padding: 0.75rem; font-size: 0.85rem; flex-direction: column; align-items: flex-start; gap: 4px; }
    .btn-pack-outline span:last-child { align-self: flex-end; }

    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-content { border-radius: 24px 24px 0 0; max-height: 90vh; animation: slideUpSheet 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform: none !important;}
    @keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
    
    .sidebar-content { max-width: 100%; }
    
    .admin-layout { flex-direction: column; height: 100vh; overflow: hidden; }
    
    .admin-sidebar { 
        position: fixed; top: 0; left: -300px; width: 280px; height: 100%; 
        z-index: 999; transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
        box-shadow: 4px 0 15px rgba(82,68,62,0.15); 
        flex-direction: column !important; padding: 0 !important; border-right: none; 
    }
    .admin-sidebar.open { left: 0; }
    
    .admin-brand { padding: 1.5rem; justify-content: flex-start; }
    .admin-nav { flex-direction: column !important; overflow-y: auto !important; padding: 1rem 0 !important; border-bottom: none !important; }
    .admin-nav::-webkit-scrollbar { display: none; }
    .nav-item { border-radius: 0 !important; border-left: 4px solid transparent !important; white-space: normal !important; background: transparent !important; }
    
    .nav-item.active { background: rgba(255,255,255,0.1) !important; color: #FFFFFF !important; border-left-color: #FFFFFF !important; }
    
    #admin-menu-toggle { display: flex !important; }
    .admin-topbar { flex-direction: row; justify-content: space-between; align-items: center; padding: 1rem; gap: 10px; background: #FFFFFF;}
    
    .admin-content { overflow: visible; background: #FFFFFF;}
    .admin-body { padding: 1rem; background: #FFFFFF;}
    
    .pos-layout { grid-template-columns: 1fr; height: auto; gap: 1rem; }
    .pos-grid { grid-template-columns: repeat(2, 1fr); max-height: 50vh; }
    .pos-products-area, .pos-cart-area { padding: 1rem !important; }
}
@media (max-width: 400px) {
    .catalog { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
}