/* assets/css/styles.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Inter:wght@400;500;700&display=swap');

:root {
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-primary: #b91c1c; /* Tono rojo no tan claro (Crimson / Red-700) */
    --accent-hover: #991b1b;
    --accent-light: #fee2e2;
    --border-color: #e2e8f0;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-white);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Navbar rediseñado estilo UI retail */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    height: 32px;
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}


.brand:hover img {
    transform: scale(1.05);
}

/* Buscador en la navbar */
.search-container {
    flex: 1;
    max-width: 600px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    border: none;
    background: white;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-input:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.4);
}

.search-btn {
    position: absolute;
    right: 5px;
    background: var(--warning);
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.8;
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--warning);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Container global */
.container {
    padding: 3rem 5%;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Category Grid like the example */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-img-bg {
    width: 150px;
    height: 90px;
    background: #f1f5f9;
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    overflow: visible;
}

.category-img-bg img {
    height: 120px;
    object-fit: contain;
    transform: translateY(-15px);
}

.category-name {
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

/* Product Carousel / Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

.product-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.product-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border-color: var(--accent-light);
}

.product-img-wrapper {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.product-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.add-btn {
    position: absolute;
    top: 200px;
    left: 15px;
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
    transition: background 0.2s;
    z-index: 10;
}

.add-btn:hover { background: var(--accent-hover); }

.qty-pill {
    position: absolute;
    top: 200px;
    left: 15px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.2rem 0.8rem;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 110px;
    user-select: none;
}

.qty-pill button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-pill span {
    font-weight: bold;
    font-size: 0.95rem;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    margin-top: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
}

.product-old-price {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.promo-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Product Detail Page */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    background: white;
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.gallery-main {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 12px;
    background: var(--bg-light);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.gallery-thumbs img {
    width: 80px; height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: white;
}
.gallery-thumbs img.active { border: 2px solid var(--accent-primary); }

.price-indicator {
    padding: 1rem;
    border-radius: 8px;
    background: var(--accent-light);
    border: 1px solid rgba(220, 38, 38, 0.3);
    margin-bottom: 1.5rem;
    display: none;
    color: var(--accent-hover);
}
.price-indicator.active { display: block; }

.stock-badge {
    display: inline-block;
    font-size: 0.8rem; padding: 4px 10px;
    border-radius: 20px; font-weight: 600;
    margin-bottom: 1rem;
}
.stock-ok { background: #d1fae5; color: var(--success); }
.stock-out { background: #fee2e2; color: var(--danger); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
    text-decoration: none;
}
.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-light); border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-block { width: 100%; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.form-control {
    width: 100%; padding: 0.8rem 1rem;
    border-radius: 8px; border: 1px solid var(--border-color);
    background: white; color: var(--text-primary);
}
.form-control:focus { outline: none; border-color: var(--accent-primary); }

/* Auth and Admin Container */
.auth-page-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: calc(100vh - 80px);
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    height: 50px;
    margin-bottom: 1.5rem;
    filter: brightness(0); /* Black logo for the light card */
}

.auth-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-msg {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--danger);
}

.auth-container, .glass {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.toast {
    position: fixed; bottom: 2rem; right: 2rem;
    padding: 1rem 2rem; border-radius: 8px;
    background: var(--text-primary); color: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transform: translateY(100px); opacity: 0;
    transition: all 0.3s; z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }

.qty-control {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--bg-light); border-radius: 8px;
    padding: 0.3rem; border: 1px solid var(--border-color);
    width: max-content;
}
.qty-btn {
    width: 30px; height: 30px; border-radius: 6px;
    border: none; background: white; cursor: pointer;
    font-weight: bold; color: var(--text-primary);
}
.qty-input {
    width: 40px; text-align: center; border: none; background: transparent; font-weight: 600;
}

/* Sidebar & Category Page Layout */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.breadcrumb a {
    color: var(--text-primary);
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}

.category-page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.category-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
}

.category-layout .product-grid {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1400px) {
    .category-layout .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .category-layout .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sidebar {
    background: transparent;
    padding-right: 1rem;
}

.filter-group {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-group h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.filter-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-inputs input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
}

.price-inputs input:focus {
    border-color: var(--accent-primary);
}

.main-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sort-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    outline: none;
    cursor: pointer;
}


/* --- Responsive Enhancements --- */

@media (max-width: 1024px) {
    .container { padding: 2rem 4%; }
    .category-layout { gap: 2rem; }
}

@media (max-width: 768px) {
    /* Global */
    .container { padding: 1.5rem 3%; }
    .section-title { font-size: 1.4rem; margin-bottom: 1.5rem; }

    /* Navbar */

    .navbar { 
        padding: 0.5rem 3%; 
        gap: 0.8rem;
        flex-wrap: wrap;
    }
    .brand { font-size: 1.2rem; }
    .brand img { height: 26px; }

    .search-container { 
        order: 3; 
        min-width: 100%; 
        margin-top: 0.5rem; 
    }
    .search-input { padding: 0.7rem 1.2rem; font-size: 0.9rem; }
    .nav-links { gap: 1rem; }
    .nav-links a { font-size: 0.85rem; }
    .nav-links span { display: none; }

    /* Grids */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2 columns on mobile */
        gap: 0.8rem !important;
    }
    .product-card { padding: 1rem; }
    .product-img-wrapper { height: 140px; }
    .product-title { font-size: 0.85rem; margin-top: 0.5rem; margin-bottom: 0.5rem; }
    .product-price { font-size: 1.1rem; }
    .add-btn, .qty-pill { top: 125px !important; font-size: 0.75rem; padding: 0.3rem 0.8rem; width: 90px; }

    .category-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    .category-img-bg { width: 100%; height: 80px; border-radius: 20px; }
    .category-img-bg img { height: 90px; transform: translateY(-10px); }

    /* Category Page */
    .category-layout { grid-template-columns: 1fr; gap: 1.5rem; }
    .sidebar { padding-right: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
    .filter-group { margin-bottom: 1rem; padding-bottom: 1rem; }
    .category-page-title { font-size: 1.6rem; margin-bottom: 1rem; }
    
    /* Product Detail */
    .product-detail-grid { 
        grid-template-columns: 1fr; 
        padding: 1.5rem; 
        gap: 2rem;
    }
    .gallery-thumbs img { width: 60px; height: 60px; }

    /* Cart & Items */
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        position: relative;
    }
    .cart-item img {
        width: 100% !important;
        height: 150px !important;
        object-fit: contain;
    }
    .cart-item-info { width: 100%; }
    .cart-item-price { text-align: left !important; width: 100% !important; margin-top: 0.5rem; }
    .cart-item-remove { position: absolute; top: 1rem; right: 1rem; }

    /* Tables */
    .responsive-table-wrapper { overflow-x: auto; }
    .admin-table { font-size: 0.85rem; }
    .admin-table th, .admin-table td { padding: 0.5rem; }
}

@media (max-width: 480px) {
    .brand { font-size: 1.2rem; }
    .nav-links { gap: 0.5rem; }
    
    .product-grid { gap: 0.5rem; }
    .product-card { padding: 0.8rem; }
    .product-img-wrapper { height: 120px; }
    .add-btn, .qty-pill { top: 105px !important; }
}

/* --- Added Helper Classes --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.admin-table th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-light);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}
.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.admin-table tr:hover { background: #fdfdfd; }

/* --- CSS Carousel for Homepage --- */
.carousel-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 3rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.carousel-track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.carousel-slide {
    min-width: 100%;
    scroll-snap-align: start;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    aspect-ratio: 12 / 5; /* 1200x500 aspect ratio */
    object-fit: cover;
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.carousel-btn:hover {
    background: white;
    color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.carousel-btn.prev { left: 1rem; }
.carousel-btn.next { right: 1rem; }

.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: 0.3s;
}

.carousel-dot.active {
    background: white;
    width: 20px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .carousel-btn {
        width: 30px; height: 30px; font-size: 1rem;
    }
    .carousel-wrapper {
        margin-bottom: 2rem;
        border-radius: 8px;
    }
}

