/* ========================================
   Template Default - Supermercado Online
   ======================================== */

:root {
    --primary-color: #28a745;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ========================================
   BARRA DE PROMOCIÓN
   ======================================== */

.promo-bar {
    background: linear-gradient(135deg, var(--primary-color), #20c997);
    color: white;
    padding: 10px 0;
    text-align: center;
    position: relative;
    animation: slideDown 0.5s ease;
}

.promo-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.promo-close {
    position: absolute;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition);
}

.promo-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

/* ========================================
   HEADER
   ======================================== */

.main-header {
    background: white;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo img {
    max-height: 50px;
}

.header-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.header-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ========================================
   BUSCADOR
   ======================================== */

.search-section {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-box .input-group-text {
    border-right: none;
}

.search-box .form-control {
    border-left: none;
    border-right: none;
}

.search-box .form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}

/* ========================================
   BANNER
   ======================================== */

.banner-section {
    margin: 20px 0;
}

.banner-placeholder {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

/* ========================================
   SIDEBAR CATEGORÍAS
   ======================================== */

.categories-sidebar {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.sidebar-title {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    margin: 0;
    font-size: 1.1rem;
}

.categories-list {
    padding: 0;
}

.category-item {
    border-bottom: 1px solid #e9ecef;
    transition: var(--transition);
}

.category-item:last-child {
    border-bottom: none;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.category-link:hover {
    background: var(--light-color);
    color: var(--primary-color);
    padding-left: 20px;
}

.category-link.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.category-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.category-toggle {
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: var(--transition);
}

.category-toggle:hover {
    color: var(--primary-color);
}

.category-toggle i {
    transition: transform 0.3s ease;
}

.category-toggle.collapsed i {
    transform: rotate(-90deg);
}

.subcategories {
    background: #f8f9fa;
    padding-left: 20px;
}

.subcategory-link {
    display: block;
    padding: 10px 15px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.subcategory-link:hover {
    color: var(--primary-color);
    padding-left: 20px;
}

.subcategory-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* ========================================
   PRODUCTOS
   ======================================== */

.productos-header {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.producto-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.producto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.producto-imagen {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f8f9fa;
}

.producto-body {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.producto-titulo {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 48px;
}

.producto-precios {
    margin-top: auto;
}

.precio-principal {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.precio-neto {
    font-size: 0.85rem;
    color: #6c757d;
}

.producto-footer {
    padding: 15px;
    border-top: 1px solid #e9ecef;
}

.btn-agregar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ========================================
   CARRITO LATERAL
   ======================================== */

.carrito-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 420px;
    height: 100vh;
    z-index: 1050;
    transition: right 0.3s ease;
}

.carrito-sidebar.active {
    right: 0;
}

.carrito-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.carrito-sidebar.active .carrito-overlay {
    opacity: 1;
    visibility: visible;
}

.carrito-content {
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
}

.carrito-header {
    padding: 20px;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.carrito-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.carrito-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    transition: var(--transition);
}

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

.carrito-item-imagen {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

.carrito-item-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.carrito-item-titulo {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.carrito-item-precio {
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 10px;
}

.carrito-item-cantidad {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-cantidad {
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cantidad-valor {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}

.btn-eliminar {
    color: var(--danger-color);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: var(--transition);
}

.btn-eliminar:hover {
    transform: scale(1.2);
}

.carrito-footer {
    padding: 20px;
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
}

.carrito-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
}

.carrito-total strong {
    color: var(--primary-color);
}

/* ========================================
   MODALES
   ======================================== */

.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    border-bottom: 2px solid var(--primary-color);
}

.precios-detalle .precio-principal {
    font-size: 2.5rem;
}

.precios-detalle .precio-neto {
    font-size: 1rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablets */
@media (max-width: 991px) {
    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .categories-sidebar {
        margin-bottom: 20px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .header-actions {
        gap: 5px;
    }
    
    .header-btn span {
        display: none !important;
    }
    
    .header-btn {
        padding: 8px 12px;
    }
    
    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .producto-card {
        font-size: 0.9rem;
    }
    
    .producto-imagen {
        height: 150px;
    }
    
    .producto-body {
        padding: 10px;
    }
    
    .producto-titulo {
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .precio-principal {
        font-size: 1.2rem;
    }
    
    .producto-footer {
        padding: 10px;
    }
    
    .carrito-sidebar {
        max-width: 100%;
    }
    
    .banner-section {
        margin: 10px 0;
    }
}

/* Small Mobile */
@media (max-width: 575px) {
    .logo img {
        max-height: 40px;
    }
    
    .search-box .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .productos-header {
        padding: 10px;
    }
    
    .productos-header h5 {
        font-size: 1rem;
    }
}

/* ========================================
   FOOTER
   ======================================== */

.main-footer {
    margin-top: auto;
}

.footer-content {
    background: var(--primary-color);
    color: white;
}

.footer-title {
    color: white;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-list li {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 10px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-3px);
}

.footer-signature {
    border-top: 1px solid #dee2e6;
}

/* ========================================
   SELECTOR DE CANTIDAD EN PRODUCTO
   ======================================== */

.cantidad-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 5px;
}

.cantidad-selector .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
}

.cantidad-actual {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* ========================================
   CARRITO - TOTALES
   ======================================== */

.carrito-totales {
    font-size: 0.95rem;
}

.carrito-totales hr {
    margin: 10px 0;
    border-color: rgba(0,0,0,0.1);
}

/* ========================================
   UTILIDADES
   ======================================== */

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hover-zoom {
    transition: var(--transition);
}

.hover-zoom:hover {
    transform: scale(1.05);
}

/* Loading Spinner personalizado */
.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

/* Toast personalizado */
.toast {
    min-width: 300px;
}

.toast-header {
    background: var(--light-color);
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Sin stock badge */
.sin-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Scrollbar personalizada */
.carrito-body::-webkit-scrollbar {
    width: 8px;
}

.carrito-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.carrito-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.carrito-body::-webkit-scrollbar-thumb:hover {
    background: #1e7e34;
}

/* Estados de carga */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Breadcrumbs custom */
.breadcrumb-custom {
    background: transparent;
    padding: 10px 0;
    margin-bottom: 15px;
}

.breadcrumb-custom .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
}
