/* ============================================================
   HEADER STYLES — Share Market Pro (Trading Terminal)
   ============================================================ */

/* ── Market Ticker Bar ─────────────────────────────────── */
.market-ticker-bar {
    background: #ffffff;
    border-bottom: 1px solid #e2e5ea;
    height: 32px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.market-ticker-bar::before,
.market-ticker-bar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}
.market-ticker-bar::before {
    left: 0;
    background: linear-gradient(90deg, #ffffff, transparent);
}
/* Right fade removed — the live badge acts as the hard right edge */
.market-ticker-bar::after {
    display: none;
}

.ticker-track {
    display: flex;
    gap: 0;
    animation: ticker-scroll 40s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    border-right: 1px solid #e2e5ea;
    height: 32px;
}

.ticker-item__symbol {
    font-weight: 700;
    color: #0d0d0d;
    letter-spacing: 0.04em;
}

.ticker-item__price {
    color: #4a4a4a;
}

.ticker-item__change {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ticker-item__change--up   { color: #00a844; }
.ticker-item__change--down { color: #e53935; }

/* ── Ticker Flash Animation (fires on each data refresh) ── */
@keyframes ticker-flash {
    0%   { opacity: 1; }
    25%  { opacity: 0.35; }
    50%  { opacity: 1; }
}

.ticker-flash {
    animation: ticker-flash 0.5s ease;
}

/* ── Live Badge ────────────────────────────────────────── */
.ticker-live-badge {
    /* Pinned to the right edge of the ticker bar — no overlap with scrolling text */
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    /* Sharp rectangular — no border-radius */
    border-radius: 0;
    padding: 0 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    color: #00a844;
    /* Solid opaque bg so scrolling text never bleeds through */
    background: #ffffff;
    border-left: 2px solid rgba(0, 168, 68, 0.35);
    cursor: default;
    user-select: none;
    white-space: nowrap;
    transition: color 0.3s, border-color 0.3s, background 0.3s;
}

.ticker-live-badge--offline {
    color: #e53935;
    background: #ffffff;
    border-left-color: rgba(229, 57, 53, 0.35);
}

.ticker-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.5s infinite;
    flex-shrink: 0;
}

/* ── Main Header ───────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    /* Green background — same brand color as .btn--primary */
    background: var(--color-accent);
    border-bottom: 1px solid var(--color-accent-dark);
    height: 68px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 168, 68, 0.25);
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

/* ── Logo ──────────────────────────────────────────────── */
.header__logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.header__logo-icon {
    width: 34px;
    height: 34px;
    /* White bg so the chart icon pops on the green header */
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header__logo-text {
    font-size: 1.0625rem;
    font-weight: 700;
    /* White text on green bg */
    color: #ffffff;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.header__logo-text span {
    /* Keep accent span readable — slightly brighter white */
    color: rgba(255, 255, 255, 0.85);
}

/* ── Desktop Nav ───────────────────────────────────────── */
.header__nav {
    display: flex;
    align-items: center;
}

.header__nav-list {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__nav-link {
    padding: 0.4rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    /* White text on green bg */
    color: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
    position: relative;
}

.header__nav-link:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.12);
}

.header__nav-link.active {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.18);
    font-weight: 700;
}

.header__nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
}

/* ── Search ────────────────────────────────────────────── */
.header__search {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.header__search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

.header__search-input {
    width: 100%;
    padding: 0.475rem 1rem 0.475rem 2.25rem;
    font-size: 0.8125rem;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.15);
    color: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.header__search-input::placeholder { color: rgba(255, 255, 255, 0.55); }

.header__search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.header__search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e5ea;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}

/* ── Search Result Items ───────────────────────────────── */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f0f2f5;
    transition: background 0.12s;
    outline: none;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item--active,
.search-result-item:focus {
    background: #f5f7fa;
    color: #0d0d0d;
}

.search-result-type {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
}

.search-result-type--plan {
    background: rgba(0, 168, 68, 0.1);
    color: #007a30;
}

.search-result-type--article {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.search-result-type--video {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.search-result-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d2d2d;
    font-size: 0.8125rem;
}

/* ── Price badge (plans only) ──────────────────────────── */
.search-result-price {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #007a30;
    background: rgba(0, 168, 68, 0.08);
    border: 1px solid rgba(0, 168, 68, 0.2);
    border-radius: 100px;
    padding: 0.1rem 0.45rem;
    white-space: nowrap;
    font-family: var(--font-mono, monospace);
    letter-spacing: -0.01em;
}

/* ── Loading state ─────────────────────────────────────── */
.search-result-loading {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    color: #777;
}

.search-result-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e2e5ea;
    border-top-color: var(--color-accent, #00a844);
    border-radius: 50%;
    animation: search-spin 0.6s linear infinite;
    flex-shrink: 0;
}

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

/* ── No results state ──────────────────────────────────── */
.search-result-empty {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 0.875rem;
    font-size: 0.8125rem;
    color: #888;
}

.search-result-empty svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.search-result-empty strong {
    color: #555;
    font-weight: 600;
}

/* ── Actions ───────────────────────────────────────────── */
.header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Theme Toggle Button ───────────────────────────────── */
#themeToggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    /* White icon on green header */
    color: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

#themeToggle:hover {
    transform: rotate(15deg);
    background: rgba(0, 0, 0, 0.12) !important;
    color: #ffffff !important;
}

#themeToggle svg {
    width: 18px;
    height: 18px;
}

/* ── SEBI Badge ────────────────────────────────────────── */
.header__sebi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    /* White-tinted badge on green header */
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.header__sebi-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Mobile Toggle ─────────────────────────────────────── */
.header__mobile-toggle {
    display: none;
    padding: 0.4rem;
    color: rgba(255, 255, 255, 0.85);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    margin-left: auto;
}

.header__mobile-toggle:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.12);
}
.header__mobile-toggle:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); }

/* ── Mobile Menu ───────────────────────────────────────── */
.header__mobile-menu {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 0;
    /* White dropdown below the green header */
    background: #ffffff;
}

.header__mobile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__mobile-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #4a4a4a;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.header__mobile-link:hover {
    background: rgba(0, 168, 68, 0.06);
    color: var(--color-accent);
}

.header__mobile-auth {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e5ea;
    margin-top: 0.5rem;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .header__nav { display: none; }
    .header__search { max-width: 200px; }
    .header__sebi-badge { display: none; }
}

@media (max-width: 768px) {
    .header__search { display: none; }
    .header__mobile-toggle { display: flex; }
    .header__actions .btn--ghost { display: none; }
}

/* ── Header-scoped button overrides (green bg context) ─── */
/* Login ghost button — white outlined on green header */
.site-header .btn--ghost {
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.45);
    background: transparent;
}
.site-header .btn--ghost:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
}

/* Get Started / Dashboard / Admin primary button — dark on green */
.site-header .btn--primary {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}
.site-header .btn--primary:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Logo icon SVG stroke — white on green bg */
.site-header .header__logo-icon svg path {
    stroke: #ffffff;
}

/* ============================================================
   DARK THEME OVERRIDES
   ============================================================ */
[data-theme="dark"] .market-ticker-bar {
    background: #050505;
    border-bottom-color: #1a1a1a;
}

[data-theme="dark"] .market-ticker-bar::before {
    background: linear-gradient(90deg, #050505, transparent);
}

/* Right gradient stays hidden in dark mode too — badge is the hard edge */

[data-theme="dark"] .ticker-item__label {
    color: #9e9e9e;
}

[data-theme="dark"] .ticker-item__value {
    color: #f5f5f5;
}

[data-theme="dark"] .ticker-item__symbol {
    color: #e0e0e0;
}

[data-theme="dark"] .ticker-item__price {
    color: #aaaaaa;
}

[data-theme="dark"] .ticker-live-badge {
    /* Solid dark bg so scrolling text doesn't bleed through */
    background: #050505;
    border-left-color: rgba(0, 168, 68, 0.45);
    color: #00c853;
}

[data-theme="dark"] .ticker-live-badge--offline {
    background: #050505;
    border-left-color: rgba(229, 57, 53, 0.45);
    color: #ef5350;
}

[data-theme="dark"] .site-header {
    /* Deeper green in dark mode — distinct from the dark page bg */
    background: #007a30;
    border-bottom-color: #005e24;
    box-shadow: 0 2px 12px rgba(0, 100, 40, 0.4);
}

[data-theme="dark"] .header__logo-text {
    color: #ffffff;
}

[data-theme="dark"] .header__logo-text span {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .header__logo-icon {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .header__nav-link {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .header__nav-link:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .header__nav-link.active {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .header__nav-link.active::after {
    background: #ffffff;
}

[data-theme="dark"] .header__search-icon {
    color: rgba(255, 255, 255, 0.55);
}

[data-theme="dark"] .header__search-input {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
}

[data-theme="dark"] .header__search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

[data-theme="dark"] .header__search-input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .header__search-results {
    background: #0d0d0d;
    border-color: #1a1a1a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .search-result-item {
    color: #e0e0e0;
    border-bottom-color: #1a1a1a;
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item--active,
[data-theme="dark"] .search-result-item:focus {
    background: #161616;
    color: #ffffff;
}

[data-theme="dark"] .search-result-label {
    color: #cccccc;
}

[data-theme="dark"] .search-result-price {
    color: #00c853;
    background: rgba(0, 200, 83, 0.1);
    border-color: rgba(0, 200, 83, 0.25);
}

[data-theme="dark"] .search-result-type--plan {
    background: rgba(0, 200, 83, 0.12);
    color: #00c853;
}

[data-theme="dark"] .search-result-type--article {
    background: rgba(96, 165, 250, 0.12);
    color: #60a5fa;
}

[data-theme="dark"] .search-result-type--video {
    background: rgba(252, 165, 165, 0.12);
    color: #f87171;
}

[data-theme="dark"] .search-result-loading {
    color: #666;
}

[data-theme="dark"] .search-result-spinner {
    border-color: #2a2a2a;
    border-top-color: #00c853;
}

[data-theme="dark"] .search-result-empty {
    color: #666;
}

[data-theme="dark"] .search-result-empty strong {
    color: #999;
}

[data-theme="dark"] .header__sebi-badge {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-theme="dark"] .header__sebi-badge-dot {
    background: #ffffff;
}

[data-theme="dark"] .header__mobile-toggle {
    color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .header__mobile-toggle:hover {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .header__mobile-menu {
    border-top-color: rgba(255, 255, 255, 0.15);
    background: #050505;
}

[data-theme="dark"] .header__mobile-link {
    color: #9e9e9e;
}

[data-theme="dark"] .header__mobile-link:hover {
    background: rgba(0, 200, 83, 0.06);
    color: #00c853;
}

[data-theme="dark"] .header__mobile-auth {
    border-top-color: #1a1a1a;
}
