/* ======================================
   Catálogo Público - Estilos principales
   ====================================== */

:root {
    /* Palette base */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --red: #ef4444;
    --red-hover: #dc2626;
    --green: #10b981;
    --yellow: #f59e0b;
    --yellow-soft: #fef3c7;
    --radius: 16px;
    --shadow: 0 10px 15px rgba(59,130,246,0.2);
    --accent-glow: rgba(59,130,246,0.2);
    --green-soft: rgba(16,185,129,0.1);
    --red-soft: rgba(239,68,68,0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* === HEADER === */
.store-header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.store-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.store-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 14px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 12px var(--accent-glow);
    color: white;
}

.store-brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text);
    margin: 0;
}

.store-brand small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-btn {
    position: relative;
    background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.25);
    color: var(--accent);
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.cart-btn:hover {
    background: rgba(59,130,246,0.2);
    transform: translateY(-1px);
}

.cart-count {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    position: absolute;
    top: -6px; right: -6px;
}

/* === SEARCH === */
.search-section {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
}

.search-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-sel {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 180px;
    cursor: pointer;
    outline: none;
}

/* === PRODUCTS === */
.products-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px;
}

.products-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: fadeInUp 0.5s ease backwards;
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.product-image:hover {
    opacity: 0.9;
}

.promoted-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--yellow);
    color: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
}

.product-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.product-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-cat {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 6px;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.35;
}

.product-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    margin-bottom: 10px;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.price-hidden {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--yellow);
    background: var(--yellow-soft);
    padding: 4px 12px;
    border-radius: 8px;
}

.stock-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stock-ok { background: var(--green-soft); color: #059669; }
.stock-low { background: var(--yellow-soft); color: #d97706; }
.stock-out { background: var(--red-soft); color: #dc2626; }

.add-cart-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.add-cart-btn:hover { 
    background: #4f46e5; 
    transform: scale(1.02); 
}

.add-cart-btn:active { 
    transform: scale(0.98); 
}

.add-cart-btn:disabled {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-logo {
    display: none;
}

@media (min-width: 768px) {
    .hero-logo { display: block; }
}

/* === CART DRAWER === */
.cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
}

.cart-overlay.active { display: block; }

.cart-drawer {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    width: 420px;
    max-width: 92vw;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 1001;
    display: none;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

.cart-drawer.active { display: flex; }

@keyframes slideIn { 
    from { transform: translateX(100%); } 
    to { transform: translateX(0); } 
}

@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

.cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-header h2 { 
    font-size: 1.15rem; 
    font-weight: 700; 
}

.cart-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.cart-close:hover { 
    background: rgba(239,68,68,0.15); 
    color: var(--red); 
    border-color: var(--red); 
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.cart-item-info { flex: 1; }
.cart-item-name { font-size: 0.9rem; font-weight: 600; }
.cart-item-price { font-size: 0.78rem; color: var(--text-muted); }

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 28px; height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: all 0.15s;
}

.qty-btn:hover { 
    border-color: var(--accent); 
    color: var(--accent); 
}

.qty-val {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.cart-item-remove:hover { opacity: 1; }

.cart-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
}

.cart-empty i { 
    font-size: 2.5rem; 
    display: block; 
    margin-bottom: 12px; 
    opacity: 0.3; 
}

.cart-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.cart-form input, .cart-form textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    margin-bottom: 8px;
    outline: none;
}

.cart-form input:focus, .cart-form textarea:focus {
    border-color: var(--accent);
}

.captcha-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.captcha-inline span {
    font-weight: 700;
    color: var(--accent);
    font-family: monospace;
    font-size: 1.05rem;
    white-space: nowrap;
}

.captcha-inline input { 
    width: 70px; 
    margin-bottom: 0; 
    text-align: center; 
}

.send-order-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--green), #16a34a);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.send-order-btn:hover { 
    filter: brightness(1.1); 
    transform: translateY(-1px); 
}

/* === FOOTER === */
.store-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 30px 24px;
    text-align: center;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-info {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.footer-info i { margin-right: 4px; }
.footer-info span { margin: 0 12px; }

.login-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 20px;
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 8px;
    transition: all 0.2s;
}

.login-link:hover { background: rgba(59,130,246,0.1); }

/* Success overlay */
.success-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.success-overlay.active { display: flex; }

.success-box {
    background: var(--bg-card);
    border: 1px solid var(--green);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: fadeIn 0.3s;
}

.success-box i { 
    font-size: 3rem; 
    color: var(--green); 
    margin-bottom: 16px; 
}

.success-box h3 { margin-bottom: 8px; }
.success-box p { 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    margin-bottom: 20px; 
}

.success-close {
    padding: 10px 30px;
    background: var(--green);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* Toast/Notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    z-index: 3000;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(59,130,246,0.4);
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* Image Modal */
.image-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.image-modal-overlay.active { 
    display: flex; 
    animation: fadeIn 0.3s; 
}

.image-modal-content {
    position: relative;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
}

.image-modal-content img {
    width: 100%;
    height: auto;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    object-fit: contain;
    background: var(--bg-surface);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.image-modal-close:hover { opacity: 1; }

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .header-inner { padding: 12px 16px; }
    .store-brand h1 { font-size: 1.1rem; }
    .search-inner { padding: 0; }
    .products-section { padding: 20px 16px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .product-body { padding: 14px; }
    .product-price { font-size: 1rem; }
    .footer-info span { display: block; margin: 4px 0; }
}
