/* ═══════════════════════════════════════════════════════════════════════════
   Company Search Hero — csh-styles.css
   Paleta: #026580 (azul corporativo) · #060f1e (fondo marino) · #ffffff (texto)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --csh-primary:      #026580;
    --csh-primary-dim:  rgba(2, 101, 128, 0.40);
    --csh-primary-glow: rgba(2, 101, 128, 0.22);
    --csh-primary-10:   rgba(2, 101, 128, 0.10);
    --csh-bg:           #060f1e;
    --csh-white:        #ffffff;
    --csh-gray-400:     rgba(255, 255, 255, 0.55);
    --csh-radius-lg:    18px;
    --csh-radius-sm:    10px;
    --csh-transition:   0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Nota: los elementos del tema Newspaper se ocultan con un <style> inline
   emitido directamente por el shortcode en company_search_hero.php,
   para garantizar que se aplican incluso con page builders (tagDiv Composer).
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Hero section ───────────────────────────────────────────────────────── */

.csh-hero {
    position: relative;
    min-height: 0;
    /* Padding reducido arriba, mínimo abajo — el dropdown se extiende libremente */
    padding: 32px 24px 16px;
    background: radial-gradient(ellipse 110% 120% at 50% 60%, #0d1f3c 0%, #060f1e 65%);
    display: flex;
    align-items: flex-start;    /* contenido pegado arriba */
    justify-content: center;
    overflow: visible;          /* permite que el dropdown salga por abajo sin recortes */

    /* Romper el contenedor del tema para ocupar ancho completo */
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
}

/* ─── Fondo: candlesticks + números flotantes ────────────────────────────── */

.csh-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;   /* el fondo sí queda contenido — solo el dropdown puede salir */
}

/* Spotlight de cursor — grande e impactante */
.csh-cursor-glow {
    position: absolute;
    width: 640px;
    height: 640px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(2, 101, 128, 0.28) 0%,
        rgba(2, 101, 128, 0.10) 35%,
        rgba(255, 255, 255, 0.03) 55%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    /* left/top se actualizan por JS, sin transition para seguir al cursor en tiempo real */
    transition: opacity 0.35s ease;
    will-change: left, top, opacity;
}

/* Ripple en clic */
.csh-ripple {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(2, 101, 128, 0.55);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    z-index: 3;
    animation: csh-ripple-expand 0.8s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}

@keyframes csh-ripple-expand {
    0%   { transform: translate(-50%, -50%) scale(0);   opacity: 0.9; }
    100% { transform: translate(-50%, -50%) scale(80);  opacity: 0; }
}

/* SVG de candlesticks — pegado a la parte baja del hero */
.csh-chart-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 85%;
    will-change: transform;
}

/* El chart layer recibe la inclinación 3D y el parallax */
#csh-chart-layer {
    transform-style: preserve-3d;
    will-change: transform;
}

/* El contenido se desplaza en sentido contrario al chart (efecto profundidad) */
.csh-content {
    will-change: transform;
}

/* Cuerpo de cada vela: crece desde la base, simula movimiento de precio */
.csh-candle-body {
    transform-box: fill-box;
    transform-origin: 50% 100%; /* borde inferior del rect, relativo a su bounding box */
    transform: scaleY(0);
    opacity: 0;
    /* La duración base del CSS se sobreescribe por el inline style de cada vela */
    animation: csh-candle-grow 3.6s ease-in-out infinite;
}

@keyframes csh-candle-grow {
    0%   { transform: scaleY(0.02); opacity: 0; }
    10%  { transform: scaleY(1);    opacity: 0.55; }
    /* Retroceso de precio — la vela "respira" */
    42%  { transform: scaleY(0.72); opacity: 0.38; }
    /* Recuperación */
    65%  { transform: scaleY(1);    opacity: 0.42; }
    88%  { transform: scaleY(1);    opacity: 0; }
    100% { transform: scaleY(0.02); opacity: 0; }
}

/* Números financieros flotantes */
.csh-tick {
    position: absolute !important;
    bottom: 0; /* dentro del contenedor para que sea visible al iniciar */
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.04em;
    opacity: 0;
    pointer-events: none;
    animation: csh-tick-float linear infinite;
    white-space: nowrap;
}

.csh-tick--pos    { color: #27AE60; }
.csh-tick--neg    { color: #E74C3C; }
.csh-tick--neu    { color: rgba(255,255,255,0.30); }
.csh-tick--sym    { color: rgba(2,101,128,0.65); }

/* Métricas de análisis financiero / informes IA */
.csh-tick--report {
    font-size: 0.75rem;
    color: rgba(2, 101, 128, 0.72);
    letter-spacing: 0.03em;
}

/* Sparklines SVG inline que flotan como los tickers */
.csh-tick--spark {
    display: inline-flex;
    align-items: center;
    opacity: 0;
    filter: drop-shadow(0 0 4px rgba(2, 101, 128, 0.4));
}

@keyframes csh-tick-float {
    0%   { transform: translateY(0);      opacity: 0; }
    8%   { opacity: 0.75; }
    75%  { opacity: 0.45; }
    100% { transform: translateY(-80vh);  opacity: 0; }
}

/* Línea de precio: se dibuja de izquierda a derecha usando stroke-dashoffset */
.csh-price-line {
    stroke-dasharray: 2200;
    stroke-dashoffset: 2200;
    animation: csh-price-line-draw 3.6s ease-out forwards;
    animation-delay: 0.4s;
}

@keyframes csh-price-line-draw {
    0%   { stroke-dashoffset: 2200; opacity: 0; }
    8%   { opacity: 1; }
    100% { stroke-dashoffset: 0;    opacity: 1; }
}

/* Orbes de luz de ambiente */
.csh-glow-orb {
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    z-index: 0;
    animation: csh-orb-pulse 9s ease-in-out infinite alternate;
}

.csh-glow-orb--left  { background: rgba(2, 101, 128, 0.20); left: -160px; bottom: -80px; }
.csh-glow-orb--right { background: rgba(13, 31, 60, 0.50);  right: -160px; top: -60px; animation-delay: 4.5s; }

@keyframes csh-orb-pulse {
    from { transform: scale(1);    opacity: 0.7; }
    to   { transform: scale(1.12); opacity: 1;   }
}

/* ─── Contenido central ──────────────────────────────────────────────────── */

.csh-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 700px;
    text-align: center;
}

/* ─── Logo ───────────────────────────────────────────────────────────────── */

.csh-logo-wrap {
    margin-bottom: 36px;
    display: inline-block;
    position: relative;
    animation: csh-fadein-up 0.7s ease 0.1s both;
}

/* Luz ambiente detrás del logo: suave, uniforme, sin bordes visibles */
.csh-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -56px -80px;
    background: radial-gradient(ellipse at center,
        rgba(255, 255, 255, 0.38) 0%,
        rgba(255, 255, 255, 0.18) 40%,
        transparent 70%
    );
    filter: blur(14px);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    animation: csh-logo-ambient 5s ease-in-out 1s infinite alternate;
}

@keyframes csh-logo-ambient {
    from { opacity: 0.80; }
    to   { opacity: 1; }
}

.csh-logo {
    max-width: 200px;
    max-height: 72px;
    width: auto;
    height: auto;
    display: block;
    position: relative;
    z-index: 1;
}

/* Fallback de texto cuando el logo no carga */
.csh-logo-text {
    display: inline-block;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
    position: relative;
    z-index: 1;
}

/* ─── Headline ───────────────────────────────────────────────────────────── */

.csh-headline-wrap {
    margin-bottom: 36px;
    animation: csh-fadein-up 0.7s ease both;
    animation-delay: 0.3s;
}

.csh-headline {
    font-size: clamp(2rem, 5vw, 3.2rem) !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: var(--csh-white) !important;
    margin: 0 0 14px !important;
    letter-spacing: -0.02em !important;
    text-shadow: 0 2px 30px rgba(0,0,0,0.6) !important;

    background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.82) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Subrayado animado */
.csh-headline-underline {
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--csh-primary), var(--csh-primary), transparent);
    width: 0;
    margin: 0 auto;
    animation: csh-underline-expand 1s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0.9s;
}

@keyframes csh-underline-expand {
    from { width: 0; }
    to   { width: 55%; }
}

/* ─── Área de búsqueda ───────────────────────────────────────────────────── */

.csh-search-area {
    width: 100%;
    max-width: 560px;
    margin-bottom: 28px;
    animation: csh-fadein-up 0.7s ease both;
    animation-delay: 0.55s;
    /* El dropdown usa position:fixed — este elemento solo necesita ser referencia de ancho */
    position: relative;
}

.csh-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.csh-input {
    width: 100%;
    padding: 18px 52px 18px 54px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: var(--csh-radius-lg) !important;
    color: var(--csh-white) !important;
    font-size: 1.05rem !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    outline: none !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08) !important;
    transition: border-color var(--csh-transition), box-shadow var(--csh-transition), background var(--csh-transition) !important;
    box-sizing: border-box !important;
}

.csh-input::placeholder { color: rgba(255,255,255,0.38) !important; }

.csh-input:focus {
    border-color: var(--csh-primary) !important;
    background: rgba(255, 255, 255, 0.09) !important;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.5),
        0 0 0 4px var(--csh-primary-glow),
        inset 0 1px 0 rgba(255,255,255,0.10) !important;
}

.csh-search-icon {
    position: absolute;
    left: 18px;
    color: rgba(255,255,255,0.45);
    pointer-events: none;
    transition: color var(--csh-transition);
    flex-shrink: 0;
}

.csh-input-wrap:focus-within .csh-search-icon { color: var(--csh-primary); }

/* Loader spinner */
.csh-loader {
    position: absolute;
    right: 16px;
    color: var(--csh-primary);
    display: none;
    pointer-events: none;
}

.csh-loader.is-visible { display: flex; }

.csh-loader svg { animation: csh-spin 0.8s linear infinite; }

@keyframes csh-spin {
    to { transform: rotate(360deg); }
}

/* ─── Dropdown resultados ────────────────────────────────────────────────── */

.csh-dropdown {
    /* Portal: pegado al <body>, escapa de cualquier overflow/z-index del tema */
    position: fixed;
    /* top/left/width se calculan en JS con getBoundingClientRect() */
    background: #07111f;
    border: 1.5px solid rgba(2, 130, 160, 0.55);
    border-radius: 12px;
    box-shadow:
        0 8px 16px rgba(0,0,0,0.5),
        0 24px 64px rgba(0,0,0,0.75),
        0 0 0 1px rgba(255,255,255,0.06);
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 999999;
    /* Hasta el 70% de la pantalla o 560px — muestra 8-10 resultados cómodamente */
    max-height: min(70vh, 560px);
    overflow-y: auto;

    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    display: block;
}

.csh-dropdown.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.csh-dropdown::-webkit-scrollbar { width: 4px; }
.csh-dropdown::-webkit-scrollbar-track { background: transparent; }
.csh-dropdown::-webkit-scrollbar-thumb { background: var(--csh-primary-dim); border-radius: 2px; }

/* Item del dropdown */
.csh-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--csh-radius-sm);
    cursor: pointer;
    text-decoration: none !important;
    color: var(--csh-white) !important;
    transition: background var(--csh-transition);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.csh-dropdown-item:last-child { border-bottom: none; }

.csh-dropdown-item:hover,
.csh-dropdown-item:focus,
.csh-dropdown-item.is-active {
    background: rgba(2, 101, 128, 0.18);
    outline: none;
}

.csh-item-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    padding: 3px;
}

.csh-item-logo-ph {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--csh-primary);
    color: var(--csh-white);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.csh-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.csh-item-name {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--csh-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csh-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.csh-item-symbol {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--csh-primary);
    background: var(--csh-primary-10);
    border: 1px solid var(--csh-primary-dim);
    border-radius: 5px;
    padding: 1px 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.csh-item-exchange {
    font-size: 0.73rem;
    color: var(--csh-gray-400);
}

.csh-item-arrow {
    color: rgba(255,255,255,0.25);
    flex-shrink: 0;
    transition: color var(--csh-transition), transform var(--csh-transition);
}

.csh-dropdown-item:hover .csh-item-arrow,
.csh-dropdown-item.is-active .csh-item-arrow {
    color: var(--csh-primary);
    transform: translateX(3px);
}

.csh-dropdown-empty {
    padding: 18px 14px;
    color: var(--csh-gray-400);
    font-size: 0.9rem;
    text-align: center;
}

/* ─── Subtexto ───────────────────────────────────────────────────────────── */

.csh-subtext {
    font-size: 0.88rem !important;
    color: rgba(255,255,255,0.38) !important;
    margin: 0 0 22px !important;
    line-height: 1.7 !important;
    letter-spacing: 0.02em !important;
    animation: csh-fadein-up 0.7s ease both !important;
    animation-delay: 0.65s !important;
}

/* ─── Animaciones compartidas ────────────────────────────────────────────── */

@keyframes csh-fadein-up {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .csh-hero { padding: 52px 16px 68px; }
    .csh-logo { max-width: 160px; }
    .csh-logo-wrap { margin-bottom: 28px; }
    .csh-headline-wrap { margin-bottom: 28px; }
    .csh-input { padding: 15px 46px 15px 46px !important; font-size: 0.98rem !important; }
    .csh-glow-orb { width: 280px; height: 280px; }
}
