/* ═══════════════════════════════════════════════════════════════════
   TradeMate VN — Base Reset + Typography
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-hover);
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--color-text);
    background-color: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    outline: none;
    transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-border-focus);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

img { max-width: 100%; display: block; }

/* ── Utility ──────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-positive { color: var(--color-positive); }
.text-negative { color: var(--color-negative); }
.text-right { text-align: right; }

/* ═══════════════════════════════════════════════════════════════════
   Shared Tab System (folder-tab pattern)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tab Nav Bar ─────────────────────────────────────── */
.tm-tabs-nav {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-bottom: 2px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tm-tabs-nav::-webkit-scrollbar { display: none; }

/* ── Tab Button ──────────────────────────────────────── */
.tm-tab {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    top: 2px;
}
.tm-tab:hover {
    color: var(--color-text);
    background: var(--color-bg-hover);
    border-color: var(--color-text-muted);
}
.tm-tab.active {
    background: var(--color-bg-card);
    color: var(--color-primary);
    font-weight: 700;
    border-color: var(--color-primary);
    border-bottom: 2px solid var(--color-bg-card);
    box-shadow: 0 -2px 6px rgba(99, 102, 241, 0.12);
}
.tm-tab .tm-tab-icon { margin-right: 4px; }
.tm-tab .tm-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    margin-left: 4px;
    border-radius: var(--radius-full);
    background: var(--color-bg-hover);
    color: var(--color-text-muted);
    font-size: 0.65rem;
    font-weight: 600;
}
/* Touch-friendly tabs on mobile */
@media (max-width: 768px) {
    .tm-tab {
        min-height: 40px;
        -webkit-tap-highlight-color: transparent;
    }
}
.tm-tab.active .tm-tab-badge {
    background: var(--color-primary-muted);
    color: var(--color-primary);
}

/* ── Tab Panel ───────────────────────────────────────── */
.tm-tab-panel {
    display: none;
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-lg);
    background: var(--color-bg-card);
}
.tm-tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   Stat Chips (compact metric display)
   ═══════════════════════════════════════════════════════════════════ */
.tm-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    min-width: 80px;
}
.tm-stat-chip-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin-bottom: 2px;
    white-space: nowrap;
}
.tm-stat-chip-value {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

/* ── Hero Row (flex-wrap stat chips) ─────────────────── */
.tm-hero-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.tm-hero-row .tm-stat-chip { flex: 1; min-width: 100px; }

/* ═══════════════════════════════════════════════════════════════════
   Accent Cards (border-left colored cards)
   ═══════════════════════════════════════════════════════════════════ */
.tm-accent-card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
    border-left: 4px solid var(--color-border);
    background: var(--color-bg-secondary);
}
.tm-accent-card:last-child { margin-bottom: 0; }
.tm-accent-card-title {
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
}
.tm-accent-card--positive {
    border-left-color: var(--color-positive);
    background: rgba(34,197,94,0.06);
}
.tm-accent-card--positive .tm-accent-card-title { color: var(--color-positive); }
.tm-accent-card--negative {
    border-left-color: var(--color-negative);
    background: rgba(239,68,68,0.06);
}
.tm-accent-card--negative .tm-accent-card-title { color: var(--color-negative); }
.tm-accent-card--neutral {
    border-left-color: var(--color-neutral);
    background: rgba(245,158,11,0.06);
}
.tm-accent-card--neutral .tm-accent-card-title { color: var(--color-neutral); }
.tm-accent-card--info {
    border-left-color: var(--color-primary);
    background: var(--color-primary-muted);
}
.tm-accent-card--info .tm-accent-card-title { color: var(--color-primary); }
/* ── Merged Recommendation Card ─────────────────────── */
.sd-rec-card .tm-accent-card-title {
    margin-bottom: var(--space-sm);
}
.sd-rec-section {
    padding: var(--space-xs) 0;
}
.sd-rec-section + .sd-rec-section {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: var(--space-xs);
    padding-top: var(--space-sm);
}
.sd-rec-label {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-xs);
}
.sd-rec-label--buy {
    background: rgba(16,185,129,0.15);
    color: var(--color-positive);
}
.sd-rec-label--hold {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}
.sd-rec-section p {
    margin: 0;
    line-height: 1.5;
}

/* ── Holding hint in chart header ───────────────────── */
.sd-holding-hint {
    font-size: var(--font-size-xs);
    color: #f59e0b;
    margin-top: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(245,158,11,0.08);
    border-radius: var(--radius-sm);
    border-left: 2px solid #f59e0b;
    line-height: 1.4;
}

/* ── Key Level Pills (support/resistance) ────────────── */
.tm-level-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tm-level-pill {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}
.tm-level-pill--support {
    background: rgba(34,197,94,0.12);
    color: var(--color-positive);
}
.tm-level-pill--resistance {
    background: rgba(239,68,68,0.12);
    color: var(--color-negative);
}
