/* ============================================================
   Stocks Maker — Design System
   Dark-mode TradingView-inspired dashboard
   ============================================================ */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* === CSS Variables (Design Tokens) === */
:root {
    /* Colors — Base */
    --bg-primary: #0a0e17;
    --bg-secondary: #0f1420;
    --bg-card: #151b28;
    --bg-card-hover: #1a2233;
    --bg-input: #0d1219;
    --bg-overlay: rgba(10, 14, 23, 0.85);

    /* Colors — Borders */
    --border-primary: #1e2a3a;
    --border-secondary: #2a3545;
    --border-accent: #3a4a5e;

    /* Colors — Text */
    --text-primary: #e8ecf1;
    --text-secondary: #8892a4;
    --text-muted: #556070;
    --text-accent: #7eb8ff;

    /* Colors — Score Categories */
    --score-strong-buy: #00c853;
    --score-strong-buy-bg: rgba(0, 200, 83, 0.12);
    --score-strong-buy-border: rgba(0, 200, 83, 0.25);

    --score-buy: #4caf50;
    --score-buy-bg: rgba(76, 175, 80, 0.10);
    --score-buy-border: rgba(76, 175, 80, 0.22);

    --score-watch: #42a5f5;
    --score-watch-bg: rgba(66, 165, 245, 0.10);
    --score-watch-border: rgba(66, 165, 245, 0.20);

    --score-ignore: #546e7a;
    --score-ignore-bg: rgba(84, 110, 122, 0.08);
    --score-ignore-border: rgba(84, 110, 122, 0.15);

    /* Colors — Accents */
    --accent-green: #00e676;
    --accent-red: #ff5252;
    --accent-gold: #ffd740;
    --accent-blue: #448aff;
    --accent-purple: #b388ff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1a237e 0%, #0d47a1 50%, #01579b 100%);
    --gradient-gold: linear-gradient(135deg, #ffab00 0%, #ffd740 50%, #ffe57f 100%);
    --gradient-green: linear-gradient(135deg, #1b5e20 0%, #2e7d32 50%, #43a047 100%);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(0, 200, 83, 0.15);
    --shadow-glow-gold: 0 0 15px rgba(255, 215, 64, 0.2);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* === Reset & Base === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(26, 35, 126, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(13, 71, 161, 0.1) 0%, transparent 50%);
    padding: var(--space-md);
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: var(--space-xs);
}

.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(68, 138, 255, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    margin-top: var(--space-sm);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.3);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
    display: none;
    animation: fadeIn 0.3s ease;
}

.login-error.visible {
    display: block;
}

/* ============================================================
   SCROLLING TICKER TAPE
   ============================================================ */

.ticker-tape {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #0d1117 0%, #111827 50%, #0d1117 100%);
    border-bottom: 1px solid var(--border-primary);
    height: 38px;
    overflow: hidden;
    position: relative;
}

.ticker-tape-label {
    position: relative;
    z-index: 2;
    background: linear-gradient(90deg, rgba(255, 167, 38, 0.15), rgba(255, 167, 38, 0.05));
    border-right: 1px solid rgba(255, 167, 38, 0.2);
    padding: 0 14px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffa726;
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.ticker-tape-track {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-tape-content {
    display: flex;
    align-items: center;
    gap: 0;
    animation: scroll-tape 60s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-tape-content:hover {
    animation-play-state: paused;
}

.tape-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    height: 38px;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.tape-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.tape-market-flag {
    font-size: 0.7rem;
    opacity: 0.6;
}

.tape-symbol {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.tape-score {
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.tape-score.strong-buy {
    background: rgba(0, 200, 83, 0.2);
    color: var(--score-strong-buy);
}

.tape-score.buy {
    background: rgba(76, 175, 80, 0.15);
    color: var(--score-buy);
}

.tape-change {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
}

.tape-change.positive {
    color: var(--accent-green);
}

.tape-change.negative {
    color: var(--accent-red);
}

.tape-market-name {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}

.tape-placeholder {
    padding: 0 20px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

@keyframes scroll-tape {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand h1 {
    font-size: 1.15rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* === Market Tabs === */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow-x: auto;
}

.market-tabs {
    display: flex;
    gap: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 3px;
}

.market-tab {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.market-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.market-tab.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(68, 138, 255, 0.3);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 140px;
    padding: 7px 12px 7px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.8rem;
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    width: 200px;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(68, 138, 255, 0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse-dot 2s infinite;
}

.status-dot.fetching {
    background: var(--accent-gold);
    animation: pulse-dot 0.8s infinite;
}

.status-dot.error {
    background: var(--accent-red);
    animation: none;
}

.logout-btn {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* === Stats Bar === */
.stats-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: var(--space-sm) var(--space-lg);
}

.stats-bar-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    overflow-x: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
    font-size: 0.78rem;
}

.stat-item .stat-label {
    color: var(--text-muted);
}

.stat-item .stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.stat-item .stat-value.positive {
    color: var(--accent-green);
}

.stat-item .stat-value.negative {
    color: var(--accent-red);
}

/* === Main Content === */
.main-content {
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-lg);
}

/* === Controls Bar === */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.timeframe-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 3px;
}

.tf-tab {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tf-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tf-tab.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(68, 138, 255, 0.3);
}

.controls-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.filter-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.filter-select {
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: var(--accent-blue);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.refresh-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.refresh-btn.spinning .refresh-icon {
    animation: spin 1s linear infinite;
}

/* === Scores Table === */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Column widths: Ticker(14%) Score(10%) Price(7%) Change(7%) Volume(7%) Breakdown(12%) SignalPrice(8%) SinceSignal(10%) Target/Stop(12%) MA Levels(13%) */
.scores-table th:nth-child(1),
.scores-table td:nth-child(1) {
    width: 14%;
}

.scores-table th:nth-child(2),
.scores-table td:nth-child(2) {
    width: 10%;
}

.scores-table th:nth-child(3),
.scores-table td:nth-child(3) {
    width: 7%;
}

.scores-table th:nth-child(4),
.scores-table td:nth-child(4) {
    width: 7%;
}

.scores-table th:nth-child(5),
.scores-table td:nth-child(5) {
    width: 7%;
}

.scores-table th:nth-child(6),
.scores-table td:nth-child(6) {
    width: 12%;
}

.scores-table th:nth-child(7),
.scores-table td:nth-child(7) {
    width: 8%;
}

.scores-table th:nth-child(8),
.scores-table td:nth-child(8) {
    width: 10%;
}

.scores-table th:nth-child(9),
.scores-table td:nth-child(9) {
    width: 12%;
}

.scores-table th:nth-child(10),
.scores-table td:nth-child(10) {
    width: 13%;
}

.scores-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.scores-table th {
    padding: 10px 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
}

.scores-table th:hover {
    color: var(--text-primary);
}

.scores-table th.sorted {
    color: var(--accent-blue);
}

.scores-table th .sort-arrow {
    display: inline-block;
    margin-left: 2px;
    font-size: 0.6rem;
    opacity: 0.5;
}

.scores-table th.sorted .sort-arrow {
    opacity: 1;
}

.scores-table td {
    padding: 8px 8px;
    border-bottom: 1px solid var(--border-primary);
    font-size: 0.8rem;
    vertical-align: middle;
    transition: background var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
}

.scores-table tbody tr {
    transition: background var(--transition-fast);
}

.scores-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.scores-table tbody tr:last-child td {
    border-bottom: none;
}

/* Score category row backgrounds */
.scores-table tbody tr.strong-buy {
    background: var(--score-strong-buy-bg);
    border-left: 3px solid var(--score-strong-buy);
}

.scores-table tbody tr.strong-buy:hover {
    background: rgba(0, 200, 83, 0.18);
}

.scores-table tbody tr.buy {
    background: var(--score-buy-bg);
    border-left: 3px solid var(--score-buy);
}

.scores-table tbody tr.buy:hover {
    background: rgba(76, 175, 80, 0.16);
}

.scores-table tbody tr.watch {
    background: var(--score-watch-bg);
    border-left: 3px solid var(--score-watch);
}

.scores-table tbody tr.watch:hover {
    background: rgba(66, 165, 245, 0.16);
}

.scores-table tbody tr.ignore {
    background: var(--score-ignore-bg);
    border-left: 3px solid transparent;
}

/* === Table Cell Components === */

/* Ticker cell */
.ticker-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.ticker-symbol {
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.2px;
}

.company-name {
    font-size: 0.68rem;
    color: var(--text-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Star badges */
.star-badges {
    display: flex;
    gap: 3px;
    margin-left: auto;
}

.star-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    animation: star-glow 2s ease-in-out infinite;
    cursor: help;
    position: relative;
}

.star-badge.ma-cross {
    background: rgba(255, 215, 64, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 215, 64, 0.3);
}

.star-badge.macd-div {
    background: rgba(179, 136, 255, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(179, 136, 255, 0.3);
}

.star-badge.rsi-break {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* Plus Signal Badge (+) */
.plus-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 900;
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.2), rgba(0, 179, 255, 0.2));
    color: #00e676;
    border: 1.5px solid rgba(0, 230, 118, 0.5);
    margin-left: 4px;
    cursor: help;
    position: relative;
    animation: plus-pulse 1.8s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.3);
}

@keyframes plus-pulse {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(0, 230, 118, 0.3);
    }

    50% {
        box-shadow: 0 0 14px rgba(0, 230, 118, 0.6);
    }
}

.plus-badge:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid rgba(0, 230, 118, 0.4);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 400;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

/* Signal Tracking — T1/T2 Badges & MA Levels */
.target-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.4;
}

.t1-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.t1-hit {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.6);
    animation: hit-glow 1.5s ease-in-out infinite;
}

.t2-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.t2-hit {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.6);
    animation: hit-glow 1.5s ease-in-out infinite;
}

.stop-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-red);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.stop-hit-badge {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
    border: 1px solid rgba(255, 82, 82, 0.6);
    animation: hit-glow 1.5s ease-in-out infinite;
}

@keyframes hit-glow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* MA Level Items */
.ma-level-item {
    display: inline-block;
    font-size: 0.7rem;
    white-space: nowrap;
    padding: 1px 0;
}

.ma-level-item small {
    opacity: 0.7;
    font-size: 0.65rem;
}

.ma-resistance {
    color: var(--accent-red);
}

.ma-support {
    color: var(--accent-green);
}

.star-badge:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

/* Score badge */
.score-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.score-badge.strong-buy {
    background: rgba(0, 200, 83, 0.2);
    color: var(--score-strong-buy);
    border: 1px solid var(--score-strong-buy-border);
    text-shadow: 0 0 8px rgba(0, 200, 83, 0.3);
}

.score-badge.buy {
    background: rgba(76, 175, 80, 0.18);
    color: var(--score-buy);
    border: 1px solid var(--score-buy-border);
}

.score-badge.watch {
    background: rgba(66, 165, 245, 0.18);
    color: var(--score-watch);
    border: 1px solid var(--score-watch-border);
}

.score-badge.ignore {
    background: rgba(84, 110, 122, 0.15);
    color: var(--score-ignore);
    border: 1px solid var(--score-ignore-border);
}

.score-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-label.strong-buy {
    color: var(--score-strong-buy);
}

.score-label.buy {
    color: var(--score-buy);
}

.score-label.watch {
    color: var(--score-watch);
}

.score-label.ignore {
    color: var(--score-ignore);
}

/* Price cell */
.price-cell {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.78rem;
    white-space: nowrap;
}

.price-change {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.price-change.positive {
    color: var(--accent-green);
}

.price-change.negative {
    color: var(--accent-red);
}

.price-change.neutral {
    color: var(--text-muted);
}

/* Volume cell */
.volume-cell {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Indicator mini-bars */
.indicator-bar {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.indicator-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
}

.indicator-mini .ind-label {
    color: var(--text-muted);
    min-width: 40px;
}

.indicator-mini .ind-bar {
    flex: 1;
    height: 4px;
    background: var(--border-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
    max-width: 60px;
}

.indicator-mini .ind-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.indicator-mini .ind-fill.green {
    background: var(--accent-green);
}

.indicator-mini .ind-fill.blue {
    background: var(--accent-blue);
}

.indicator-mini .ind-fill.gold {
    background: var(--accent-gold);
}

.indicator-mini .ind-value {
    font-family: var(--font-mono);
    font-weight: 500;
    min-width: 24px;
    text-align: right;
}

/* === Score Detail Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.visible {
    display: flex;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.modal-body {
    padding: var(--space-lg);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.detail-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.detail-item .detail-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.detail-item .detail-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.detail-item.full {
    grid-column: 1 / -1;
}

/* Score breakdown */
.score-breakdown {
    margin-top: var(--space-md);
}

.breakdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-primary);
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.breakdown-points {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.9rem;
}

.breakdown-points.positive {
    color: var(--accent-green);
}

/* === Loading State === */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    gap: var(--space-md);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* === Empty State === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-lg);
    gap: var(--space-md);
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-weight: 500;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 400px;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid var(--border-primary);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes star-glow {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(255, 215, 64, 0.1);
    }

    50% {
        box-shadow: 0 0 12px rgba(255, 215, 64, 0.3);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .header-center {
        order: 3;
        max-width: 100%;
        flex: 1 1 100%;
        margin-top: var(--space-sm);
    }

    .stats-bar-inner {
        gap: var(--space-md);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }

    .main-content {
        padding: var(--space-md);
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .timeframe-tabs {
        overflow-x: auto;
    }

    .controls-right {
        flex-wrap: wrap;
    }

    /* Make table scrollable */
    .table-container {
        overflow-x: auto;
    }

    .scores-table {
        min-width: 800px;
    }

    /* Card layout for mobile */
    .mobile-cards {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
    }

    .mobile-card {
        background: var(--bg-card);
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-md);
        padding: var(--space-md);
        display: grid;
        grid-template-columns: 1fr auto;
        gap: var(--space-sm);
        transition: background var(--transition-fast);
    }

    .mobile-card:hover {
        background: var(--bg-card-hover);
    }

    .mobile-card.strong-buy {
        border-left: 3px solid var(--score-strong-buy);
        background: var(--score-strong-buy-bg);
    }

    .mobile-card.buy {
        border-left: 3px solid var(--score-buy);
        background: var(--score-buy-bg);
    }

    .mobile-card.watch {
        border-left: 3px solid var(--score-watch);
        background: var(--score-watch-bg);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }

    .header-inner {
        padding: var(--space-sm) var(--space-md);
    }

    .login-card {
        padding: var(--space-lg) var(--space-md);
    }
}


/* ============================================================
   User Info & Trial Badges (Header)
   ============================================================ */

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.user-name {
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Branding Logos */
.brand-logo {
    height: 80px;
    width: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    transform: scale(1.8);
    transform-origin: left center;
    margin-right: -40px;
}

.logo-img {
    max-width: 500px;
    width: 100%;
    height: auto;
    margin-bottom: 16px;
    image-rendering: -webkit-optimize-contrast;
}

@media (max-width: 480px) {
    .brand-logo {
        height: 60px;
        transform: scale(1.5);
        margin-right: -30px;
    }

    .logo-img {
        max-width: 360px;
    }
}

.badge-trial {
    background: linear-gradient(135deg, rgba(66, 165, 245, 0.2), rgba(66, 165, 245, 0.1));
    border: 1px solid rgba(66, 165, 245, 0.3);
    color: #42a5f5;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-premium {
    background: linear-gradient(135deg, rgba(255, 215, 64, 0.2), rgba(255, 152, 0, 0.1));
    border: 1px solid rgba(255, 215, 64, 0.3);
    color: #ffd740;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-expired {
    background: linear-gradient(135deg, rgba(255, 82, 82, 0.2), rgba(255, 82, 82, 0.1));
    border: 1px solid rgba(255, 82, 82, 0.3);
    color: #ff5252;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}


/* ============================================================
   Registration Form Extensions
   ============================================================ */

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-success {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.25);
    color: var(--accent-green);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    line-height: 1.6;
}


/* ============================================================
   Subscription Expired Overlay
   ============================================================ */

.subscription-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.4s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.subscription-modal {
    text-align: center;
    max-width: 420px;
    padding: 48px 40px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-secondary);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.subscription-modal h2 {
    color: var(--text-primary);
    margin: 0 0 12px;
    font-size: 1.5rem;
}

.subscription-modal p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0 0 28px;
}

.premium-btn {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, #ffd740, #ff9800);
    color: #1a1a1a;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(255, 215, 64, 0.3);
}

.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 215, 64, 0.45);
}

.logout-link {
    display: block;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
}

.logout-link:hover {
    color: var(--text-secondary);
}


/* ============================================================
   Responsive: Registration & Auth
   ============================================================ */

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row .form-group {
        flex: 1 !important;
    }

    .user-info {
        display: none;
    }
}