/* ============================================================
   MEGASEARCH — Buscador con megamenu de 3 columnas
   ============================================================ */

/* ── Contenedor del input ─────────────────────────────────── */
.mega-search-wrap {
    position: relative;
    width: 100%;
    max-width: 680px;
}

.mega-search-form {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .2s;
}

.mega-search-form:focus-within {
    border-color: #3bb77e;
    box-shadow: 0 0 0 3px rgba(59,183,126,.12);
}

.mega-search-icon {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #aaa;
    flex-shrink: 0;
}

.mega-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 11px 8px;
    background: transparent;
    color: #333;
}

.mega-search-input::placeholder {
    color: #bbb;
}

.mega-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 8px;
    color: #999;
    transition: color .15s;
}

.mega-search-clear:hover { color: #333; }

.mega-search-btn {
    background: #3bb77e;
    border: none;
    color: #fff;
    padding: 0 18px;
    height: 100%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .2s;
}

.mega-search-btn:hover { background: #2ea06b; }

/* ── Megamenu dropdown ────────────────────────────────────── */
.mega-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 680px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.13);
    z-index: 9999;
    overflow: hidden;
    animation: msDropIn .15s ease;
}

@keyframes msDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading ──────────────────────────────────────────────── */
.mega-search-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: #888;
    font-size: 13px;
}

.ms-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #3bb77e;
    border-radius: 50%;
    animation: msSpin .7s linear infinite;
}

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

/* ── Grid 3 columnas ──────────────────────────────────────── */
.mega-search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 0;
}

.mega-col {
    padding: 16px 18px;
    border-right: 1px solid #f0f0f0;
}

.mega-col:last-child { border-right: none; }

.mega-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #aaa;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Sugerencias (col 1) ──────────────────────────────────── */
.ms-suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background .15s;
}

.ms-suggestion-item:hover {
    background: #f5faf8;
    color: #3bb77e;
}

.ms-suggestion-item svg { color: #bbb; flex-shrink: 0; }
.ms-suggestion-item:hover svg { color: #3bb77e; }

/* ── Marcas (col 2) ───────────────────────────────────────── */
.ms-brand-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: background .15s;
}

.ms-brand-item:hover {
    background: #f5faf8;
    color: #3bb77e;
    text-decoration: none;
}

.ms-brand-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3bb77e;
    flex-shrink: 0;
}

/* ── Productos (col 3) ────────────────────────────────────── */
.ms-product-item {
    display: flex;
    flex-direction: column;
    padding: 8px 8px;
    border-radius: 6px;
    text-decoration: none;
    transition: background .15s;
    border-bottom: 1px solid #f5f5f5;
}

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

.ms-product-item:hover {
    background: #f5faf8;
    text-decoration: none;
}

.ms-product-name {
    font-size: 13px;
    color: #222;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-product-item:hover .ms-product-name { color: #3bb77e; }

.ms-product-meta {
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
}

/* ── Sin resultados ───────────────────────────────────────── */
.mega-search-empty {
    padding: 28px 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.mega-search-empty svg { color: #ddd; margin-bottom: 8px; }

/* ── Footer "Ver todos" ───────────────────────────────────── */
.mega-search-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 18px;
    background: #f9faf9;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    font-weight: 600;
    color: #3bb77e;
    text-decoration: none;
    transition: background .15s;
}

.mega-search-footer:hover {
    background: #eef9f4;
    color: #2ea06b;
    text-decoration: none;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .mega-search-dropdown { min-width: 0; }
    .mega-search-grid { grid-template-columns: 1fr 1fr; }
    .mega-col:nth-child(3) { grid-column: 1 / -1; border-right: none; border-top: 1px solid #f0f0f0; }
}

@media (max-width: 600px) {
    .mega-search-grid { grid-template-columns: 1fr; }
    .mega-col { border-right: none; border-bottom: 1px solid #f0f0f0; }
    .mega-col:last-child { border-bottom: none; }
}
