/* ============================================================
   E-Commerce MrBot — Mobile-First Responsive CSS
   ============================================================ */

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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #f59e0b;
    --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;
    --white: #fff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --touch-target: 44px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ---------- Store Header ---------- */
.store-layout header,
.store-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--primary);
    color: var(--white);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height, 64px);
    height: auto;
    box-shadow: var(--shadow-md);
    gap: 1rem;
}

.store-layout header h1,
.store-header .brand {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.store-layout header a,
.store-header a {
    color: var(--white);
    text-decoration: none;
}

.store-layout header a:hover,
.store-header a:hover { opacity: 0.9; text-decoration: none; }

.store-layout header nav,
.store-header nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.store-layout header nav a,
.store-header nav a {
    color: var(--white);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.store-layout header nav a:hover,
.store-header nav a:hover { background: rgba(255,255,255,0.15); text-decoration: none; }

.cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    color: var(--primary);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0 4px;
    margin-left: 4px;
}

.brand.brand-logo {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.brand-logo img {
    display: block;
    max-height: var(--logo-size, 60px);
    height: var(--logo-size, 60px);
    width: auto;
    object-fit: contain;
    transition: all 0.2s ease;
}

.brand-logo-img.logo-circle {
    border-radius: 50%;
    aspect-ratio: 1;
    object-fit: cover;
    width: var(--logo-size, 60px);
    height: var(--logo-size, 60px);
    max-height: var(--logo-size, 60px);
    border: 2px solid rgba(255,255,255,0.85);
}

.brand-logo-img.logo-blur {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.35), 0 0 18px rgba(0,0,0,0.45);
}

.brand-logo-img.logo-circle.logo-blur {
    box-shadow: 0 0 0 4px rgba(255,255,255,0.55), 0 0 22px rgba(0,0,0,0.5);
    /* difuminado del borde vía máscara suave */
    -webkit-mask-image: radial-gradient(circle, black 92%, transparent 100%);
    mask-image: radial-gradient(circle, black 92%, transparent 100%);
}

.brand-logo-img.logo-blur:not(.logo-circle) {
    border-radius: 10px;
    -webkit-mask-image: radial-gradient(ellipse 92% 92% at center, black 88%, transparent 100%);
    mask-image: radial-gradient(ellipse 92% 92% at center, black 88%, transparent 100%);
}

/* ---------- Store Main ---------- */
.store-layout main,
.store-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px;
}

/* ---------- Search Bar ---------- */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    position: sticky;
    top: var(--header-height, 64px);
    z-index: 50;
    background: var(--gray-50);
    padding: 0.75rem 0;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    height: var(--touch-target);
    padding: 0 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
    -webkit-appearance: none;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.search-bar select {
    height: var(--touch-target);
    padding: 0 2rem 0 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* ---------- Product Grid ---------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 600px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}

@media (min-width: 900px) {
    .products-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
    .store-layout main, .store-main { padding: 1.5rem; padding-bottom: 1.5rem; }
}

@media (min-width: 1100px) {
    .products-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Product Card ---------- */
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}

.product-card:active { transform: scale(0.98); }

.product-card img,
.product-card .card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--gray-200);
}

.product-card .card-img-placeholder {
    aspect-ratio: 1;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 0.75rem;
}

.product-card .product-info,
.product-card .card-body {
    padding: 0.625rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-card .product-name,
.product-card .card-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--gray-800);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.product-card .product-name:hover,
.product-card .card-name:hover { color: var(--primary); }

.product-card .product-price,
.product-card .card-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9375rem;
}

.product-card .card-stock-out {
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 500;
}

.card-weight-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

.card-weight-row input {
    width: 60px;
    height: 34px;
    padding: 0.25rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    text-align: center;
    -webkit-appearance: none;
}

.card-weight-row .weight-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.product-card .btn,
.product-card .btn-primary,
.product-card .btn-add,
.combo-card .btn-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    height: 36px;
    margin-top: auto;
    padding: 0 0.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}

.product-card .btn:hover,
.product-card .btn-primary:hover,
.product-card .btn-add:hover,
.combo-card .btn-add:hover { background: var(--primary-hover); }

.product-card .btn:active,
.product-card .btn-primary:active,
.product-card .btn-add:active,
.combo-card .btn-add:active { transform: scale(0.97); }

.product-card .btn:disabled,
.product-card .btn-primary:disabled,
.product-card .btn-add:disabled,
.combo-card .btn-add:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
}

.btn-add.added {
    background: var(--success);
    animation: pulse 0.4s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ---------- Cart Page ---------- */
.cart-page {
    max-width: 1100px;
    margin: 0 auto;
}
.cart-page h1,
.cart-page .cart-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* Two-column layout on desktop */
.cart-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .cart-container {
        flex-direction: row;
        align-items: flex-start;
    }
}

.cart-items-col {
    flex: 1;
    min-width: 0;
}

.cart-summary-col {
    width: 100%;
}

@media (min-width: 768px) {
    .cart-summary-col {
        width: 340px;
        flex-shrink: 0;
        position: sticky;
        top: 72px;
    }
}

/* Summary card */
.cart-summary-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
}

.cart-summary-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.cart-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.cart-summary-label {
    color: var(--gray-600);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.cart-summary-val {
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
}

/* Cart item */
.cart-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.625rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: box-shadow 0.15s;
}

.cart-item:hover {
    box-shadow: var(--shadow);
}

.cart-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-item-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
}

.cart-item-unit-price {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cart-item-discount {
    color: var(--success);
    font-size: 0.6875rem;
    font-weight: 600;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--gray-300);
}

.cart-item-qty button {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-50);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.cart-item-qty button:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.cart-item-qty span,
.cart-item-qty .qty-unit {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0 0.5rem;
    background: var(--white);
}

.cart-item-qty .qty-unit {
    min-width: auto;
    color: var(--gray-500);
    padding: 0 0.5rem 0 0.25rem;
}

.cart-item-qty .qty-input {
    width: 56px;
    height: 36px;
    border: none;
    border-top: 1px solid var(--gray-300);
    border-bottom: 1px solid var(--gray-300);
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
    background: var(--white);
    -moz-appearance: textfield;
    outline: none;
    padding: 0;
}

.cart-item-qty .qty-input::-webkit-outer-spin-button,
.cart-item-qty .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-item-qty .qty-input:focus {
    background: var(--primary-light);
    color: var(--primary);
}

.cart-item-subtotal {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.0625rem;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.btn-delete {
    padding: 0.5rem;
    background: none;
    border: 1px solid transparent;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.15s;
}

.btn-delete:hover {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    border-top: 2px solid var(--gray-100);
    margin-top: 0.5rem;
}

.cart-total .total-amount { color: var(--primary); font-size: 1.375rem; }

.btn-checkout,
a.btn-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: var(--white) !important;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius);
    text-decoration: none;
    margin-bottom: 0.625rem;
    transition: background 0.15s, transform 0.1s;
}

.btn-checkout:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-continue,
a.btn-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    color: var(--gray-500) !important;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.btn-continue:hover {
    color: var(--gray-700) !important;
    background: var(--gray-50);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 400px;
    margin: 0 auto;
}

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

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.empty-state .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 1.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Bottom Bar (Mobile) ---------- */
.bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-bar a,
.bottom-bar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--gray-500);
    font-size: 0.625rem;
    font-weight: 500;
    border: none;
    background: none;
    text-decoration: none;
    padding: 0;
    height: 100%;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.bottom-bar a.active,
.bottom-bar a:hover { color: var(--primary); }

.bottom-bar .bar-icon { font-size: 1.375rem; line-height: 1; }

.bottom-bar .bar-cart-count {
    position: absolute;
    top: 4px;
    margin-left: 18px;
    background: var(--danger);
    color: var(--white);
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
}

@media (min-width: 768px) {
    .bottom-bar { display: none; }
    .store-layout main, .store-main { padding-bottom: 1.5rem; }
}

/* ---------- Toast notification ---------- */
.toast-container {
    position: fixed;
    top: 64px;
    right: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: var(--gray-800);
    color: var(--white);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
}

.toast .toast-icon { font-size: 1.125rem; }
.toast .toast-action { color: #93c5fd; font-weight: 600; margin-left: auto; white-space: nowrap; }

@keyframes slideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ========== ADMIN ========== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--gray-800);
    color: var(--white);
    padding: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-600);
}

.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 0.125rem; }

.sidebar a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.sidebar a:hover { background: var(--gray-700); color: var(--white); text-decoration: none; }

.content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.content h1 { margin-bottom: 1rem; font-size: 1.5rem; }

/* ---------- Admin: configuraciones esteticas ---------- */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    margin-top: 0.375rem;
}

.palette-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--white);
    font-size: 0.8125rem;
}

.palette-option:hover { border-color: var(--gray-400); }
.palette-option.selected { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.palette-option input { margin: 0; accent-color: var(--primary); }
.palette-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.palette-name { color: var(--gray-600); }

.color-inputs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.color-inputs label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.color-inputs input[type='color'] {
    width: 64px;
    height: 36px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 2px;
    background: var(--white);
    cursor: pointer;
}

.logo-preview {
    max-height: var(--logo-preview-size, 120px);
    height: var(--logo-preview-size, 120px);
    width: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    background: var(--white);
    object-fit: contain;
    transition: all 0.2s ease;
}

.logo-preview.logo-circle {
    border-radius: 50%;
    aspect-ratio: 1;
    object-fit: cover;
    width: var(--logo-preview-size, 120px);
    border: 2px solid var(--gray-200);
}

.logo-preview.logo-blur {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 0 14px rgba(0,0,0,0.35);
}

.logo-preview.logo-circle.logo-blur {
    box-shadow: 0 0 0 4px rgba(255,255,255,0.6), 0 0 18px rgba(0,0,0,0.45);
    -webkit-mask-image: radial-gradient(circle, black 92%, transparent 100%);
    mask-image: radial-gradient(circle, black 92%, transparent 100%);
}

.logo-preview.logo-blur:not(.logo-circle) {
    border-radius: 12px;
    -webkit-mask-image: radial-gradient(ellipse 92% 92% at center, black 88%, transparent 100%);
    mask-image: radial-gradient(ellipse 92% 92% at center, black 88%, transparent 100%);
}

.settings-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.settings-section h2 { font-size: 1.125rem; margin-bottom: 0.75rem; }

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 0.75rem;
    }
    .sidebar ul { display: flex; flex-wrap: wrap; gap: 0.25rem; }
    .sidebar li { margin: 0; }
    .sidebar a { font-size: 0.75rem; padding: 0.375rem 0.5rem; }
    .content { padding: 1rem; }
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: var(--touch-target);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    -webkit-appearance: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 18px;
    height: 18px;
    min-height: auto;
    padding: 0;
    margin-right: 0.5rem;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}
.palette-option input[type="radio"] {
    -webkit-appearance: auto;
    appearance: auto;
    width: 16px;
    height: 16px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.15s, transform 0.1s;
    min-height: var(--touch-target);
    text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); color: var(--white); text-decoration: none; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-hover); color: var(--white); }

.btn-ghost { background: none; color: var(--gray-600); border: 1px solid var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; min-height: 36px; }
.btn-block { width: 100%; }

/* ---------- Admin: filtros y reportes ---------- */
.filters-bar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.filters-bar .form-group input[type="date"] { width: auto; min-width: 150px; }

.report-range {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(6, 1fr); }
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.125rem 0.875rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-200);
}

.stat-accent-blue::before { background: var(--primary); }
.stat-accent-indigo::before { background: #4f46e5; }
.stat-accent-amber::before { background: var(--warning); }
.stat-accent-green::before { background: var(--success); }
.stat-accent-purple::before { background: #7c3aed; }
.stat-accent-cyan::before { background: #0891b2; }

.stat-highlight {
    border-color: var(--success);
    background: linear-gradient(180deg, #f0fdf4, var(--white));
}

.stat-highlight .stat-value { color: var(--success); }

.stat-icon {
    font-size: 1.375rem;
    line-height: 1;
    margin-bottom: 0.375rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
    word-break: break-word;
}

.stat-label {
    color: var(--gray-500);
    font-size: 0.6875rem;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.table-report {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.table-report thead th {
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--gray-200);
}

.table-report tbody td {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.table-report tbody tr:last-child td { border-bottom: none; }
.table-report tbody tr:hover { background: var(--gray-50); }

.text-right { text-align: right !important; }

.rank { width: 2.5rem; text-align: center; color: var(--gray-400); }

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--white);
}

.rank-1 { background: #f59e0b; }
.rank-2 { background: #94a3b8; }
.rank-3 { background: #b45309; }

/* ---------- Alerts ---------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ---------- Login ---------- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--gray-100);
}

.login-form {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.login-form h1 { text-align: center; margin-bottom: 1.5rem; color: var(--gray-800); font-size: 1.25rem; }

/* ---------- Preparation ---------- */
.preparation-layout { padding: 1rem; max-width: 1400px; margin: 0 auto; }
.preparation-layout h1 { margin-bottom: 1rem; }

.columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .columns { grid-template-columns: 1fr 1fr; }
}

.column {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    min-height: 300px;
}

.column h2 {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
    font-size: 1rem;
}

/* ---------- Product Detail ---------- */
.product-detail-page { max-width: 600px; margin: 0 auto; }

.product-detail-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.product-detail-card img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

@media (min-width: 768px) {
    .product-detail-card img { max-height: 400px; }
}

.product-detail-body { padding: 1rem; }

/* ---------- Success Page ---------- */
.success-page {
    text-align: center;
    padding: 3rem 1rem;
}

.success-page .success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.success-page h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.success-page p { color: var(--gray-500); margin-bottom: 1.5rem; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }


/* Order card in preparation */
.order-card {
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.order-card .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.order-card .order-number {
    font-weight: 700;
    font-size: 1.125rem;
}

.order-card .order-time {
    color: #6b7280;
    font-size: 0.875rem;
}

.order-card .order-items {
    font-size: 0.875rem;
    color: #4b5563;
}

.order-card .btn-ready {
    margin-top: 0.75rem;
    width: 100%;
}

/* ---------- Checkout Form ---------- */
.checkout-form {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-100);
    color: var(--gray-800);
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-row {
    margin-bottom: 0.75rem;
}

.form-row-2 {
    display: flex;
    gap: 0.75rem;
}

.form-row-2 > label {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row-2 {
        flex-direction: column;
    }
}

.checkout-form label {
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    gap: 0.25rem;
}

.checkout-form input,
.checkout-form textarea {
    width: 100%;
    height: 44px;
    padding: 0 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    background: var(--white);
    -webkit-appearance: none;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.checkout-form input:focus,
.checkout-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.checkout-form textarea {
    height: auto;
    padding: 0.5rem 0.75rem;
    resize: vertical;
    min-height: 70px;
}

.delivery-row {
    display: flex;
    gap: 0.75rem;
}

.delivery-option {
    flex: 1;
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.delivery-option:hover {
    border-color: var(--primary-light);
}

.delivery-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-hover);
}

.delivery-option input {
    width: auto;
    height: auto;
}

.btn-confirm {
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 1.0625rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: background 0.15s, transform 0.1s;
}

.btn-confirm:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-confirm:active {
    transform: scale(0.98);
}

.notification-hint {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin: -0.25rem 0 0.75rem;
    padding-left: 0.25rem;
}

/* ---------- Promociones y combos (tienda) ---------- */
.promotions-section {
    margin-bottom: 1rem;
}

.promotions-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.combos-carousel {
    margin-bottom: 1rem;
}

.combos-carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.combos-carousel-header .promotions-title {
    margin-bottom: 0.75rem;
}

.combos-carousel-controls {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.carousel-control {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--gray-300);
    border-radius: 50%;
    background: var(--white);
    color: var(--gray-700);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.carousel-control:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.combos-track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0.125rem 0.125rem 0.75rem;
}

.combos-track::-webkit-scrollbar {
    display: none;
}

.combo-card {
    flex: 0 0 100%;
    min-width: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-snap-align: start;
}

@media (min-width: 600px) {
    .combo-card { flex-basis: calc((100% - 0.75rem) / 2); }
}

@media (min-width: 900px) {
    .combo-card { flex-basis: calc((100% - 1.5rem) / 3); }
}

.combo-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-combo {
    display: inline-block;
    background: var(--warning);
    color: var(--gray-900);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.125rem 0.4rem;
    border-radius: 999px;
    white-space: nowrap;
}

.combo-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-900);
}

.combo-desc {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.combo-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.combo-items li {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
}

.combo-item-qty {
    color: var(--primary);
    font-weight: 700;
    min-width: 1.5rem;
}

.combo-item-name {
    flex: 1;
    color: var(--gray-700);
}

.combo-item-price {
    color: var(--gray-400);
    font-size: 0.75rem;
}

.combo-price-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.combo-price-block {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.combo-price-label {
    color: var(--gray-500);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.combo-price {
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--primary);
}

.combo-regular {
    font-size: 0.8125rem;
    color: var(--gray-400);
    text-decoration: line-through;
}

.combo-savings {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
}

.combo-card .btn-add {
    margin-top: 0.25rem;
}

.promos-banners {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.promo-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.42rem 0.7rem;
    font-size: 0.8125rem;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
}

.promo-banner:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.promo-banner:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.promo-banner--active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.promo-badge {
    background: var(--gray-900);
    color: var(--white);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.promo-banner--active .promo-badge {
    background: var(--primary);
}

.promo-name {
    font-weight: 600;
    color: var(--gray-800);
}

.promo-min {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--gray-500);
    white-space: nowrap;
}

.promo-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary-light);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--gray-200));
    border-radius: 8px;
    font-size: 0.8125rem;
}

.promo-filter-bar[hidden] { display: none !important; }

.promo-filter-label { color: var(--gray-700); }

.promo-filter-clear {
    margin-left: auto;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.promo-filter-clear:hover { border-color: var(--gray-400); }

/* ---------- Precio con descuento ---------- */
.price-original {
    text-decoration: line-through;
    color: var(--gray-400);
    font-weight: 500;
    font-size: 0.75rem;
}

.price-discount {
    color: var(--danger);
    font-weight: 800;
}

.badge-discount {
    display: inline-block;
    background: var(--danger);
    color: var(--white);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
