/* ======================================================
   index_style.css - estilos principales
====================================================== */

/* ---------------------- RESET ---------------------- */
* {
    box-sizing: border-box;
}

/* ---------------------- TOPBAR ---------------------- */
#topbar.topbar {
    position: sticky;
    top: 0;
    z-index: 3000;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    min-height: 64px;
}

.topbar-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 42px;
    width: auto;
    display: block;
}

.topbar-center {
    flex: 1 1 auto;
    padding: 0 12px;
    display: flex;
    align-items: center;
}

.topbar-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* ---------------------- SEARCH ---------------------- */
#search {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    font-size: 15px;
}

#search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.07);
}

/* ---------------------- SEARCH LIVE ---------------------- */
#search-results {
    position: absolute !important;
    top: 64px;
    left: 0;
    width: 100% !important;
    background: #fff;
    padding: 14px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    z-index: 5000 !important;

    display: none;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

#search-results:not(.hidden) {
    display: grid !important;
}

#search-results .no-results {
    padding: 15px;
    text-align: center;
    color: #777;
    grid-column: 1 / -1;
}

.search-card {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: .2s;
}

.search-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.15);
}

.search-img-wrap {
    height: 130px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.search-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ---------------------- CONTAINER ---------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto !important;
    padding: 0 16px;
}

/* ---------------------- CARRUSELES ---------------------- */
.categoria-section {
    margin-bottom: 36px;
}

.carousel-wrap h2 {
    font-size: 1.25rem;
    color: #333;
    margin-bottom: 12px;
}

.ver-todo-link {
    font-size: 0.95rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.productos-scroll {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    overflow: hidden;
    align-items: flex-start;
    width: 100%;
}

.productos-track {
    display: flex;
    gap: 1rem;
}

/* ---------------------- PRODUCT CARDS ---------------------- */
.producto-card {
    background: #fff;
    border-radius: 10px;
    width: 240px;
    flex: 0 0 auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    padding: 12px;
    transition: transform .18s ease, box-shadow .18s ease;
}

.producto-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.producto-img-container {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f8f8;
}

.producto-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ---------------------- PRODUCT LINK ---------------------- */
.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ---------------------- PRODUCT NAME ---------------------- */
/* DESKTOP: 4 líneas */
.producto-nombre {
    font-size: 1rem;
    color: #222;
    margin: 0.6rem 0 0.3rem;
    line-height: 1.2rem;

    max-height: 4.8em;   /* 4 líneas */
    overflow: hidden;

    white-space: normal;
    word-break: break-word;
    text-align: left;
    width: 100%;
}

/* ---------------------- PRICE ---------------------- */
.producto-precio {
    font-weight: 700;
    color: #28a745;
    margin-top: auto;
    font-size: 1.05rem;
    text-align: left;
}

/* ---------------------- HERO / BANNERS ---------------------- */
.hero-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #f4f4f4;
    margin: 24px 0;
}

.hero-banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------------------- FOOTER ---------------------- */
footer {
    background: #222;
    color: #ccc;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.9rem;
}

/* ---------------------- RESPONSIVE ---------------------- */
@media (max-width: 992px) {
    .producto-card { width: 200px; }
    .search-img-wrap { height: 120px; }
}

@media (max-width: 640px) {
    #topbar.topbar {
        min-height: 58px;
    }

    #search {
        height: 36px;
    }

    #search-results {
        top: 58px;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: 10px;
    }

    .producto-card { width: 160px; }

    /* MÓVIL: 3 líneas reales */
    .producto-nombre {
        max-height: 3.6em;
    }
}

/* ---------------------- USER INFO ---------------------- */
.user-info {
    color: #333 !important;
    font-weight: 600;
    margin-right: 12px;
}

.logout-link {
    color: #007bff !important;
    font-weight: 600;
    text-decoration: none;
}

.logout-link:hover {
    text-decoration: underline;
}
