/* === RESET BÁSICO === */
* {
    box-sizing: border-box;
}
body { 
    font-family: Arial, sans-serif; 
    margin: 0;
    background: #f9f9f9;
}
p {
    margin: 0;
    padding: 0;
}

/* === TOPBAR (Home + Buscador) === */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #000;   /* barra negra */
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* icono home */
.topbar a {
    color: #fff;
    font-size: 20px;
    margin-right: 12px;
    text-decoration: none;
}

/* buscador */
.search-bar {
    display: flex;
    gap: 8px;
    margin: 0;
    flex: 1;
    justify-content: flex-end;
}
.search-bar input {
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #ccc;
}
.search-bar button {
    padding: 6px 12px; 
    font-size: 14px; 
    border-radius: 4px;
    border: none;
    font-weight: bold;
    background: #4b47e8;
    color: #fff;
    cursor: pointer;
}
.search-bar button:hover {
    background: #666;
}

/* === HEADER con título === */
header {
    background:#444; 
    color:#fff; 
    padding:10px; 
    text-align:center; 
}

/* === CONTENEDOR PRINCIPAL === */
.container { 
    max-width:1200px; 
    margin:20px auto; 
    padding:0 10px; 
}

/* === GRID DE PRODUCTOS (desktop) === */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
}

/* === CARD === */
.card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.card-img {
    width: 100%;
    height: 160px; /* altura fija */
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
}
.card-body {
    padding: 15px;
}
.card-body h3 {
    margin: 0 0 4px 0;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
}
.card-body p {
    font-size: 12px;
    line-height: 1.2;
    color:#444;
}

/* === LOADER === */
#loading {
    text-align:center; 
    margin:20px 0;
    font-style: italic; 
    color:#666; 
}

/* === VISTA MOBILE (lista en lugar de grilla) === */
@media (max-width: 768px) {
    header h1 {
        font-size: 16px;
    }

    .grid {
        display: block; /* lista */
        padding: 8px;
    }
    .card {
        flex-direction: row;
        align-items: flex-start;
        height: auto;
        margin-bottom: 6px;
    }

    .card:hover {
    transform: none;
    box-shadow: none;
    }

    .card-img {
        width: 90px;
        height: 90px;
        flex-shrink: 0;
    }
    .card-body {
        padding: 8px;
    }
    .card-body h3 {
        font-size: 13px;
    }
    .card-body p {
        font-size: 11px;
        line-height: 1.2;
    }
}
