/* === Variables globales === */
:root {
    --color-principal: #111;
    --color-acento: #ff3b3b;
    --color-fondo: #f4f4f4;
    --color-texto: #222;
    --color-texto-footer: #aaa;
}

/* === Box-sizing global === */
*, *::before, *::after {
    box-sizing: border-box;
}

/* === Reset básico y layout general === */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: var(--color-fondo);
    color: var(--color-texto);
}

.container, .page-content {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
}

/* === Fuente personalizada para logo === */
@font-face { 
    font-family: 'BletroOblique'; 
    src: url('../Fonts/BletroOblique-5yzoa.otf') format('opentype'); 
    font-weight: normal;
    font-style: normal;
}

/* === Header === */
header {
    background-color: var(--color-principal);
    color: #fff;
    text-align: center;
    padding: 25px 0 35px;
}

header .logo a {
    color: #fff;
    font-family: 'BletroOblique', sans-serif;
    font-size: 2em;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

/* === Navegación === */
nav {
    margin-top: 10px;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 12px;
    font-size: 1em;
    transition: color 0.2s ease;
}

nav a:hover { 
    color: var(--color-acento); 
}

/* === Barra de búsqueda === */
.search-bar {
    text-align: center;
    padding: 50px 0;
}

.search-bar input {
    width: 60%;
    max-width: 600px;
    min-width: 200px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 30px;
    font-size: 1em;
    text-align: center;
    color: #555353;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-acento);
    box-shadow: 0 0 5px rgba(255,59,59,0.5);
}

.search-bar input::placeholder { 
    color: #c6c2c2; 
}

/* === Contenedor de productos (GRID) === */
#productContainer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 10px;
}

/* === Contenedor general de la tarjeta === */
.product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
    text-align: center;
}

.product-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* === Imagen del producto === */
.product-images {
    width: 100%;
    background: #f8f8f8;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.product-images img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    display: none;
}

.product-images img.active {
    display: block;
}

/* Carousel botones */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1.5em;
    border-radius: 6px;
    z-index: 2;
}

.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }

.carousel-btn:hover {
    background: var(--color-acento);
}

/* === Información del producto === */
.product-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
    text-align: center;
}

.product-info div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-info strong { font-weight: bold; }

/* Precio destacado */
.product-price {
    font-weight: bold;
    color: var(--color-acento);
}

.product-price::before { content: "₡"; margin-right: 2px; }

/* Información extra: color, talla, disquera, año */
.product-details { 
    width: 100%; 
    padding: 10px; 
    background: #f9f9f9; 
    border-radius: 0 0 8px 8px; 
    text-align: center;
}

.product-details span { 
    display: inline-block; 
    margin-right: 8px; 
    font-size: 0.9em; 
    color: #555;
}

/*=== Productos ===*/
/* Contenedor principal del producto */
.product-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; /* centra horizontalmente */
    text-align: center;  /* centra textos dentro */
}

@media(min-width:900px){
    .product-row {
        flex-direction: row;
        align-items: flex-start; /* mantiene aside a la derecha */
        justify-content: center; /* centra la fila horizontalmente */
        gap: 24px;
    }
}

.product-main {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;  /* centra contenido */
    text-align: center;   /* centra textos */
}

.product-meta,
.product-title,
.product-subtitle,
.product-price {
    width: 100%;
}

/* === Paginación === */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 30px 0;
    list-style: none;
    padding: 0;
}

.pagination a, .page-btn {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 6px;
    background: #ddd;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: all 0.3s ease;
}

.pagination a.active, .page-btn.active { 
    background: var(--color-principal); 
    color: #fff; 
}

.pagination a:hover, .page-btn:hover:not(.active) { 
    background: var(--color-acento);
    color: #fff;
}

/* === Scroll Top === */
#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 22px;
    cursor: pointer;
    z-index: 9999;
    opacity: 0.8;
    display: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#backToTop:hover { 
    opacity: 1; 
    transform: scale(1.1); 
}

/* === Footer === */
footer { 
    background: var(--color-principal); 
    color: #fff; 
    text-align: center; 
    padding: 20px 0; 
    margin-top: 40px; 
}

footer nav { margin-bottom: 10px; }
footer p { font-size: 0.9em; color: var(--color-texto-footer); }

/* === Responsive === */

/* Smartphones */
@media screen and (max-width: 768px) {
    #productContainer { grid-template-columns: 1fr; }
}

/* Tablets */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    #productContainer { grid-template-columns: repeat(2, 1fr); }
}

/* PCs grandes */
@media screen and (min-width: 1025px) {
    #productContainer { grid-template-columns: repeat(4, 1fr); }
}