/* Estilos personalizados para la tienda online */

/* Variables CSS */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    padding: 80px 0;
    margin-bottom: 0;
}

/* Cards de productos */
.product-card {
    border: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-img-container {
    width: 100%;
    aspect-ratio: 1 / 1; /* Relación de aspecto 1:1 para imágenes */
    overflow: hidden;
}

.product-img-container .card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Asegurar que la imagen cubra el contenedor */
    transition: transform 0.3s ease;
}

.product-card:hover .product-img-container .card-img-top {
    transform: scale(1.05);
}

.product-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* Precios */
.price-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

.price-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
}

.price-display {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

/* Carrito flotante */
.carrito-flotante {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.carrito-flotante .btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.carrito-flotante .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.7rem;
}

/* Selector de tallas */
.talla-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.talla-selector .btn {
    min-width: 50px;
    border-radius: 25px;
}

/* Imagen de producto */
.product-image img {
    max-height: 500px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* Botones personalizados */
.btn {
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    border: none;
}

.btn-success {
    background: linear-gradient(45deg, var(--success-color), #1e7e34);
    border: none;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .product-card {
        min-height: 300px; /* Aumentar la altura mínima de la tarjeta */
        max-height: 350px; /* Aumentar la altura máxima de la tarjeta */
        overflow: hidden;
    }

    .product-img-container {
        height: auto; /* Permitir que aspect-ratio controle la altura */
        width: 100%;
        aspect-ratio: 4 / 3; /* Relación de aspecto para una buena visualización de la imagen */
    }

    .product-card .card-body {
        padding: 0.7rem; /* Padding más generoso */
        justify-content: flex-start;
        flex-grow: 0;
    }

    .product-card .card-title {
        font-size: 1rem; /* Tamaño de fuente del título mejorado */
        margin: 0 0 0.2rem 0; /* Margen inferior adecuado */
        line-height: 1.3;
    }

    .card-text {
        font-size: 0.7rem; /* Tamaño de fuente de la descripción mejorado */
        margin: 0 0 0.2rem 0; /* Margen inferior adecuado */
        line-height: 1.3;
    }

    .price {
        font-size: 0.9rem; /* Tamaño de fuente del precio mejorado */
        margin: 0;
    }

    .price-section {
        margin: 0 0 0.25rem 0; /* Margen inferior para separar del botón */
    }

    .product-card .btn {
        padding: 0.35rem 0.7rem; /* Padding del botón mejorado */
        font-size: 0.85rem; /* Tamaño de fuente del botón mejorado */
        margin-top: 0.25rem; /* Margen superior para separación */
    }

    .carrito-flotante {
        bottom: 20px;
        right: 20px;
    }

    .carrito-flotante .btn {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    .talla-selector {
        justify-content: center;
    }
}

/* Mobile-first enhancements */
@media (max-width: 576px) {
    /* Typography & spacing */
    body { font-size: 14px; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }

    /* Buttons full-width in critical actions */
    .btn-lg, .btn-group .btn { border-radius: 999px; }
    .btn-block, .w-100-on-mobile { width: 100% !important; }

    /* Navbar spacing */
    .navbar .navbar-brand { font-size: 1.25rem; }

    /* Product images and carousel */
    .product-carousel-img { max-height: 380px; }

    /* Floating cart placement */
    .carrito-flotante { bottom: 15px; right: 15px; }
    .carrito-flotante .btn { width: 48px; height: 48px; font-size: .9rem; }

    /* Tables usability */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table td, .table th { white-space: nowrap; padding: .5rem .6rem; }
    .table .btn-group .btn { padding: .35rem .55rem; }
    .badge { font-size: .75rem; }

    /* Forms */
    .form-control, .form-select { font-size: .95rem; padding: .5rem .75rem; }
    label, .form-label { font-size: .9rem; }

    /* Modals: wider on mobile */
    .modal-dialog { margin: .75rem; }
    .modal-dialog.modal-lg { max-width: 95%; }
    .modal-body .btn.btn-lg { width: 100%; }

    /* Admin sidebar tweaks */
    .sidebar { position: static; width: 100%; }
    .sidebar .nav-link { padding: .6rem .9rem; }

    /* Cards paddings */
    .card-body { padding: .9rem; }
}

/* Helper: group of action buttons resembling pill */
.btn-group > .btn:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.btn-group > .btn:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }

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

.product-card {
    animation: fadeIn 0.6s ease-out;
}

/* Estilos para el admin */
.admin-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #495057 100%);
    color: white;
    padding: 2rem 0;
}

.admin-card {
    border: none;
    box-shadow: var(--shadow);
    border-radius: 10px;
}

.admin-card .card-header {
    background: var(--light-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

/* Tabla responsive */
.table-responsive {
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow);
}

.table th {
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
    border-color: #dee2e6;
}

.table tbody tr:hover {
    background-color: var(--light-color);
}

/* Formularios */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Alertas personalizadas */
.alert {
    border: none;
    border-radius: 10px;
    font-weight: 500;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Breadcrumb personalizado */
.breadcrumb {
    background: none;
    padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-weight: 600;
    color: var(--primary-color);
}

/* Modal personalizado */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 2px solid var(--light-color);
    border-radius: 15px 15px 0 0;
}

.modal-footer {
    border-top: 2px solid var(--light-color);
    border-radius: 0 0 15px 15px;
}

/* Estilos para imágenes del carrusel de productos */
.product-carousel-img {
    max-height: 600px; /* Altura máxima para las imágenes del carrusel (más grande) */
    width: auto; /* Permitir que el ancho se ajuste automáticamente */
    object-fit: contain; /* Ajustar la imagen dentro del contenedor sin recortar */
    background-color: white; /* Fondo blanco para imágenes con transparencia */
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Quitar estilos de altura y flexbox del carousel-item para evitar conflictos */
/* Bootstrap maneja la altura del carousel-item por defecto. */

/* Ajustar el contenedor principal del carrusel para el espaciado */
.carousel {
    margin-bottom: 30px; /* Espaciado con los elementos de abajo */
}

/* Controles del carrusel (flechas) */
.carousel-control-prev,
.carousel-control-next {
    width: 5%; /* Reducir el ancho de la zona de clic */
    opacity: 0; /* Ocultar por defecto */
    transition: opacity 0.3s ease; /* Transición suave */
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 0.7; /* Mostrar al pasar el ratón */
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.5); /* Fondo semitransparente para los iconos */
    border-radius: 50%; /* Iconos circulares */
    padding: 15px; /* Aumentar el tamaño de los iconos */
}

/* Indicadores del carrusel (puntos) */
.carousel-indicators [data-bs-target] {
    background-color: var(--primary-color); /* Color de los puntos */
    opacity: 0.5; /* Más sutil por defecto */
    transition: opacity 0.3s ease; /* Transición suave */
}

.carousel-indicators .active {
    opacity: 1; /* Punto activo más visible */
}

@media (max-width: 768px) {
    .product-carousel-img {
        max-height: 450px; /* Altura máxima más pequeña en móviles */
    }

    .carousel-control-prev,
    .carousel-control-next {
        opacity: 0.8; /* Mostrar flechas siempre en móviles para facilitar la navegación */
    }
}