/* ============================================================
   Orbital Search - buscador con carrusel circular (index)
   Estilo inspirado en selector curvo: orbe a la izquierda,
   lista en arco a la derecha. Usa los tokens del tema global.
   ============================================================ */

/* El buscador del hero actua como disparador del modal */
#orbital-trigger {
    cursor: pointer;
}

#orbital-trigger .search-input {
    cursor: pointer;
    pointer-events: none;
}

.orbital-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 8, 10, 0.72);
    backdrop-filter: blur(18px) saturate(120%);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

.orbital-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ---- Panel ---- */
.orbital-panel {
    position: relative;
    width: min(1080px, 96vw);
    height: min(640px, 90vh);
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(28,28,32,0.96), rgba(15,15,18,0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    transform: scale(0.96) translateY(12px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.orbital-overlay.is-open .orbital-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* halo ambiental que tiñe el panel con el color de la categoria activa */
.orbital-panel::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 22%;
    width: 520px;
    height: 520px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--orb-accent, #ff7b3a) 0%, transparent 62%);
    opacity: 0.16;
    filter: blur(20px);
    pointer-events: none;
    transition: background 0.6s ease, opacity 0.6s ease;
}

/* ---- Barra superior: buscador ---- */
.orbital-topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.orbital-searchbox {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 50px;
    padding: 0 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.orbital-searchbox:focus-within {
    border-color: rgba(255, 123, 58, 0.45);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(255, 123, 58, 0.10);
}

.orbital-searchbox i {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.95rem;
}

.orbital-searchbox:focus-within i {
    color: var(--primary-color, #ff7b3a);
}

.orbital-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 500;
}

.orbital-input::placeholder {
    color: rgba(255, 255, 255, 0.32);
    font-weight: 400;
}

.orbital-mode-tag {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-color, #ff7b3a);
    background: rgba(255, 123, 58, 0.12);
    border: 1px solid rgba(255, 123, 58, 0.2);
}

.orbital-close {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.orbital-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

/* ---- Cuerpo: orbe + carrusel ---- */
.orbital-body {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100% - 87px);
}

/* ===== Lado izquierdo: orbe del componente enfocado ===== */
.orbital-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 30px 26px;
    gap: 16px;
    min-height: 0;
    overflow: hidden;
}

.orbital-orb {
    position: relative;
    width: clamp(180px, 24vw, 290px);
    aspect-ratio: 1;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 35% 30%, var(--orb-accent, #ff7b3a), #16161a 78%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06),
                0 30px 80px rgba(0, 0, 0, 0.5),
                0 0 90px -10px var(--orb-accent, #ff7b3a);
    transition: box-shadow 0.6s ease;
}

.orbital-orb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.9s ease;
    transform: scale(1.08);
}

.orbital-orb-img.is-shown {
    opacity: 0.92;
    transform: scale(1);
}

/* tinte y profundidad sobre la imagen/gradiente */
.orbital-orb::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 120%, rgba(0,0,0,0.55), transparent 60%),
                linear-gradient(140deg, transparent 40%, rgba(0,0,0,0.35));
    pointer-events: none;
}

/* icono de la categoria, visible cuando no hay foto */
.orbital-orb-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(3.4rem, 7vw, 5.6rem);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    z-index: 1;
    transition: opacity 0.4s ease;
}

.orbital-orb.has-img .orbital-orb-icon {
    opacity: 0;
}

.orbital-info {
    text-align: center;
    max-width: 340px;
    flex-shrink: 0;
}

.orbital-info-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--orb-accent, #ff7b3a);
    margin-bottom: 6px;
}

.orbital-info-name {
    font-size: clamp(1.15rem, 2.2vw, 1.6rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 6px;
}

.orbital-info-specs {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    min-height: 1.2em;
}

.orbital-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
    flex-shrink: 0;
}

.orbital-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 11px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.orbital-action-primary {
    background: linear-gradient(135deg, var(--primary-color, #ff7b3a), #ff9a5a);
    color: #1a1a1a;
}

.orbital-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -8px var(--primary-color, #ff7b3a);
}

.orbital-action-ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}

.orbital-action-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ===== Lado derecho: carrusel circular ===== */
.orbital-wheel {
    position: relative;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 16%, #000 84%, transparent 100%);
}

.orbital-track {
    position: absolute;
    inset: 0;
}

.orbital-item {
    position: absolute;
    top: 50%;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 16px;
    width: max-content;
    max-width: 320px;
    transform-origin: left center;
    cursor: pointer;
    will-change: transform, opacity;
    user-select: none;
}

.orbital-item-thumb {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: radial-gradient(circle at 35% 30%, var(--item-accent, #ff7b3a), #18181c 80%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.4);
}

.orbital-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.orbital-item-thumb i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.92);
}

.orbital-item-label {
    text-align: left;
    line-height: 1.15;
    transition: color 0.25s ease;
}

.orbital-item-title {
    font-size: 0.98rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.22;
    max-width: 240px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.25s ease, font-weight 0.25s ease;
}

.orbital-item-sub {
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    margin-top: 2px;
}

.orbital-item.is-center .orbital-item-title {
    color: #fff;
    font-weight: 700;
}

.orbital-item.is-center .orbital-item-thumb {
    box-shadow: 0 0 0 2px var(--item-accent, #ff7b3a), 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* flechas de navegacion */
.orbital-nav {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 6;
}

.orbital-nav button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.orbital-nav button:hover {
    background: var(--primary-color, #ff7b3a);
    color: #1a1a1a;
    border-color: transparent;
}

.orbital-nav button:disabled {
    opacity: 0.3;
    cursor: default;
}

.orbital-nav button:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

/* estado vacio / sin resultados */
.orbital-empty {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 30px;
}

.orbital-empty i {
    font-size: 2.2rem;
    opacity: 0.5;
}

.orbital-wheel.is-empty .orbital-empty {
    display: flex;
}

.orbital-hint {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.28);
    z-index: 5;
    pointer-events: none;
}

/* ===== Tema claro ===== */
.light-theme .orbital-overlay {
    background: rgba(230, 230, 235, 0.7);
}

.light-theme .orbital-panel {
    background: linear-gradient(160deg, rgba(255,255,255,0.98), rgba(244,244,247,0.99));
    border-color: rgba(0, 0, 0, 0.08);
}

.light-theme .orbital-topbar {
    border-bottom-color: rgba(0, 0, 0, 0.07);
}

.light-theme .orbital-searchbox {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

.light-theme .orbital-input {
    color: #1a1a1a;
}

.light-theme .orbital-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.light-theme .orbital-close {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .orbital-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.light-theme .orbital-info-name {
    color: #1a1a1a;
}

.light-theme .orbital-info-specs {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .orbital-item-title {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .orbital-item.is-center .orbital-item-title {
    color: #1a1a1a;
}

.light-theme .orbital-item-sub {
    color: rgba(0, 0, 0, 0.35);
}

.light-theme .orbital-nav button {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .orbital-action-ghost {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.7);
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .orbital-panel {
        height: min(92vh, 720px);
    }
    .orbital-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: calc(100% - 87px);
    }
    .orbital-stage {
        padding: 16px;
        gap: 12px;
    }
    .orbital-orb {
        width: clamp(140px, 38vw, 200px);
    }
    .orbital-info-specs,
    .orbital-actions {
        display: none;
    }
    .orbital-item {
        left: 28px;
    }
    .orbital-item-title {
        font-size: 0.92rem;
        max-width: 180px;
    }
    .orbital-item-thumb {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 520px) {
    .orbital-overlay {
        padding: 0;
    }
    .orbital-panel {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}

/* respeta reduce-motion */
@media (prefers-reduced-motion: reduce) {
    .orbital-overlay,
    .orbital-panel,
    .orbital-orb-img,
    .orbital-item {
        transition: opacity 0.15s ease !important;
    }
}
