/* ==========================================================================
   1. VARIABLES Y PALETA DE COLORES (ALTO CONTRASTE NEÓN AZUL / NEÓN ROJO)
   ========================================================================== */
:root {
    --bg-dark: #090b10;
    --bg-panel: #111520;
    --bg-card: #161b29;
    --border-subtle: rgba(255, 255, 255, 0.12);
    --text-main: #f3f6fc;
    --text-muted: #9aa5b8;
    --neon-blue: #00d2ff;
    --neon-blue-glow: rgba(0, 210, 255, 0.35);
    --neon-red: #ff2a55;
    --neon-red-glow: rgba(255, 42, 85, 0.35);
    --status-green: #10b981;
    --whatsapp-green: #16a34a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   2. BARRA SUPERIOR Y BOTONES
   ========================================================================== */
.topbar {
    background-color: rgba(17, 21, 32, 0.95);
    border-bottom: 1px solid rgba(0, 210, 255, 0.3);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 0 12px var(--neon-blue-glow);
}

.brand-area h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    cursor: pointer;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.84rem;
    padding: 9px 15px;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
}

.btn-neon-blue {
    background: rgba(0, 210, 255, 0.16);
    border: 1px solid var(--neon-blue);
    color: #ffffff;
    box-shadow: 0 0 14px var(--neon-blue-glow);
}

.btn-neon-blue:hover {
    background: var(--neon-blue);
    color: #05070b;
}

.btn-neon-red {
    background: rgba(255, 42, 85, 0.18);
    border: 1px solid var(--neon-red);
    color: #ffffff;
    box-shadow: 0 0 14px var(--neon-red-glow);
}

.btn-neon-red:hover {
    background: var(--neon-red);
    color: #ffffff;
}

.btn-whatsapp-send {
    background: var(--whatsapp-green);
    color: #ffffff;
    border: 1px solid #22c55e;
}

.btn-whatsapp-send:hover {
    background: #15803d;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

/* ==========================================================================
   3. CONTENEDOR PRINCIPAL, KPIs Y FILTROS
   ========================================================================== */
.main-container {
    width: 94%;
    max-width: 1320px;
    margin: 22px auto;
    flex: 1;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-card.kpi-green { border-left: 4px solid var(--status-green); }
.kpi-card.kpi-blue { border-left: 4px solid var(--neon-blue); }
.kpi-card.kpi-red { border-left: 4px solid var(--neon-red); }

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    background: var(--bg-panel);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.search-box {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 9px 14px;
}

.search-box i { color: var(--neon-blue); }

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-size: 0.9rem;
}

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 13px;
}

.pill.active, .pill:hover {
    border-color: var(--neon-blue);
    color: #ffffff;
    background: rgba(0, 210, 255, 0.14);
}

/* ==========================================================================
   4. CUADRÍCULA DE PRODUCTOS DEL CATÁLOGO
   ========================================================================== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: var(--neon-blue);
}

.product-card.agotado {
    opacity: 0.72;
    border-top: 3px solid var(--neon-red);
}

.product-card.disponible {
    border-top: 3px solid var(--status-green);
}

.product-media {
    position: relative;
    width: 100%;
    height: 180px;
    background: #07090d;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-no-photo {
    color: var(--text-muted);
    font-size: 2.3rem;
    opacity: 0.45;
}

.price-badge-tag {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(9, 11, 16, 0.92);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 800;
}

.stock-badge-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffffff;
}

.stock-badge-tag.ok { background: var(--status-green); }
.stock-badge-tag.out { background: var(--neon-red); }

.product-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.product-category {
    font-size: 0.73rem;
    color: var(--neon-blue);
    text-transform: uppercase;
    font-weight: 700;
}

.product-title {
    font-size: 1.03rem;
    font-weight: 800;
    color: #ffffff;
}

.product-desc {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.product-actions {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.product-actions .btn-add-order {
    flex: 1;
    justify-content: center;
}

.btn-icon-only {
    padding: 8px 11px !important;
}

/* ==========================================================================
   5. CARRITO EXPRESS, MODALES Y FORMULARIOS
   ========================================================================== */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.cart-item-row {
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-qty-controls button {
    padding: 4px 9px;
    font-size: 0.8rem;
}

.cart-total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(0, 210, 255, 0.08);
    border: 1px solid rgba(0, 210, 255, 0.35);
    border-radius: 8px;
    font-size: 1rem;
}

.cart-total-bar strong {
    color: var(--neon-blue);
    font-size: 1.15rem;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 11, 0.88);
    backdrop-filter: blur(6px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-panel);
    border: 1px solid rgba(0, 210, 255, 0.45);
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    padding: 22px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85);
}

.modal-box.modal-wide {
    max-width: 680px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.modal-header h3 {
    font-size: 1.05rem;
    color: var(--neon-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.5rem;
    padding: 0 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-group {
    margin-bottom: 13px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--neon-blue);
}

.help-text {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.modal-footer-btns {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modal-footer-btns button {
    flex: 1;
    justify-content: center;
}

/* Botón flotante de pedido rápido */
.floating-whatsapp-btn {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--whatsapp-green);
    color: #ffffff;
    font-size: 1.5rem;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(22, 163, 74, 0.45);
    z-index: 250;
}

.floating-whatsapp-btn span {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--neon-red);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.app-footer {
    text-align: center;
    padding: 18px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 30px;
}

.app-footer a {
    color: var(--neon-blue);
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}