/* static/css/premium.css */

/**
 * ═══════════════════════════════════════════════════════════
 * EyesOnAssets — Premium Design System v3.3
 * 
 * ✅ v3.3 УДАЛЕНО: Стили TF селекта перенесены в header.js v5.6 (inline)
 * ✅ v3.2 ДОБАВЛЕНО: Компактные стили для TF селекта
 * ✅ v3.1 ДОБАВЛЕНО: Интеграция CacheManager v1.1 стили
 * ✅ v3.1 ДОБАВЛЕНО: Золотистые индикаторы кэша
 * ✅ v3.1 ДОБАВЛЕНО: Cache анимации и пульсации
 * 
 * Aesthetic: Dark Gold MULTISCREENER
 * Font: Syne (display) + DM Mono (data/numbers)
 * Theme: Dual (Dark/Light with golden accents)
 * 
 * Color Palette:
 * - Primary: #d4af37 (gold)
 * - Dark: #080b10 to #141c26
 * - Light: #f5f4f0 to #faf9f7
 * 
 * Spacing: 4px base unit
 * Radius: 4px (sm), 8px (md), 12px (lg)
 * ═══════════════════════════════════════════════════════════
 */

/* ==================== ROOT VARIABLES ==================== */

:root,
[data-theme="dark"] {
    /* ── Backgrounds ── */
    --bg-primary: #080b10;
    --bg-secondary: #0c1017;
    --bg-tertiary: #111720;
    --bg-elevated: #141c26;
    --bg-hover: #1a2333;
    --bg-glass: rgba(20, 28, 38, 0.85);

    /* ── Text ── */
    --text-primary: #e8e6e0;
    --text-secondary: #8a8f9e;
    --text-tertiary: #4a505f;
    --text-data: #d4cfc5;

    /* ── Borders ── */
    --border-primary: #1e2738;
    --border-secondary: #252f42;
    --border-accent: rgba(212, 175, 55, 0.25);

    /* ── Accents (Gold) ── */
    --accent-primary: #d4af37;
    --accent-secondary: #b8962e;
    --accent-light: #f0d060;
    --accent-dim: rgba(212, 175, 55, 0.08);
    --accent-glow: rgba(212, 175, 55, 0.12);
    --accent-text: #080b10;

    /* ── Status Colors ── */
    --success: #2ed16d;
    --success-dark: #1fa855;
    --danger: #f04f5a;
    --danger-dark: #d63d48;
    --warning: #f0a030;
    --info: #4080f0;

    /* ── Chart ── */
    --chart-up: #2ed16d;
    --chart-down: #f04f5a;

    /* ── Groups ── */
    --group-red: #ef4444;
    --group-blue: #3b82f6;
    --group-green: #22c55e;
    --group-yellow: #eab308;
    --group-purple: #a855f7;
    --group-orange: #f97316;
    --group-pink: #ec4899;
    --group-cyan: #06b6d4;

    /* ── Shadows ── */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.65);
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.15);

    /* ── Radius ── */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* ── Typography ── */
    --font-display: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'DM Mono', 'JetBrains Mono', 'Courier New', monospace;
    --font-body: 'Syne', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==================== LIGHT THEME ==================== */

[data-theme="light"] {
    /* ── Backgrounds ── */
    --bg-primary: #f5f4f0;
    --bg-secondary: #eeece8;
    --bg-tertiary: #e5e2dc;
    --bg-elevated: #faf9f7;
    --bg-hover: #e0ddd8;
    --bg-glass: rgba(250, 249, 247, 0.9);

    /* ── Text ── */
    --text-primary: #1a1208;
    --text-secondary: #6b5e42;
    --text-tertiary: #9a8f78;
    --text-data: #2a2010;

    /* ── Borders ── */
    --border-primary: #d8d4cc;
    --border-secondary: #ccc8be;
    --border-accent: rgba(180, 130, 20, 0.3);

    /* ── Accents (Gold, но темнее для light режима) ── */
    --accent-primary: #b8860b;
    --accent-secondary: #9a7009;
    --accent-light: #8b6300;
    --accent-dim: rgba(184, 134, 11, 0.08);
    --accent-glow: rgba(184, 134, 11, 0.15);
    --accent-text: #faf9f7;

    /* ── Status Colors (те же) ── */
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;

    /* ── Chart ── */
    --chart-up: #16a34a;
    --chart-down: #dc2626;
}

/* ==================== RESET & BASE ==================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ✅ Numbers всегда в DM Mono */
.ctr-price,
.ctr-change,
.chb-price,
.chb-change,
.ticker-price,
.ticker-change,
.chart-price,
.chart-change,
.alert-condition,
.drawing-price,
input[type="number"],
.sp-stat-val,
.sp-row-price,
.sp-row-vol {
    font-family: var(--font-mono) !important;
}

/* ==================== APP LAYOUT ==================== */

.app-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==================== HEADER ==================== */

.header {
    position: relative;
    z-index: 200;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 12px;
    gap: 0;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    box-shadow: 0 1px 0 rgba(212, 175, 55, 0.07);
    flex-shrink: 0;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 16px;
    text-decoration: none;
    user-select: none;
}

.logo-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.3));
}

.logo-icon-wrap svg {
    width: 30px;
    height: 30px;
}

.logo-wordmark {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #d4af37 0%, #f0d060 50%, #d4af37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: -30px;
}

.header-controls::-webkit-scrollbar {
    display: none;
}

.hc-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 0 10px;
}

.hc-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    line-height: 1;
}

.hc-sep {
    width: 1px;
    height: 28px;
    background: var(--border-primary);
    flex-shrink: 0;
}

.header-select {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-secondary) !important;
    border-radius: 6px !important;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23d4af37' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 22px;
    transition: border-color 0.2s, color 0.2s;
    min-width: 80px;
}

.header-select:hover {
    border-color: var(--accent-primary) !important;
    color: var(--accent-light);
}

.header-select:focus {
    border-color: var(--accent-primary) !important;
}

.header-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ✅ v3.3 УДАЛЕНО: Блок TF SELECT перенесён в header.js v5.6 (inline styles) */

/* Timeframe Buttons (если используются вместо select) */
.tf-btns {
    display: flex;
    gap: 2px;
}

.tf-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 7px;
    transition: all 0.2s;
    line-height: 1;
}

.tf-btn:hover {
    border-color: var(--border-secondary);
    color: var(--text-primary);
}

.tf-btn.tf-active,
.tf-btn:focus {
    background: var(--accent-dim);
    border-color: var(--accent-primary);
    color: var(--accent-light);
    font-weight: 700;
    outline: none;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.hright-sep {
    width: 1px;
    height: 20px;
    background: var(--border-primary);
    margin: 0 4px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.18s;
    white-space: nowrap;
    line-height: 1;
}

.header-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.header-btn:hover {
    border-color: var(--border-secondary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.header-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent-primary);
    color: var(--accent-light);
}

.header-btn--icon {
    padding: 5px 8px;
}

.header-btn--icon span {
    display: none;
}

.header-btn--accent {
    border-color: rgba(212, 175, 55, 0.2);
    color: var(--accent-light);
}

.header-btn--accent:hover {
    background: var(--accent-dim);
    border-color: var(--accent-primary);
}

.listings-badge {
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    font-family: var(--font-mono);
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    animation: badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ==================== TICKER ==================== */

.ticker-container {
    height: 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.ticker-container::before,
.ticker-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    z-index: 2;
    pointer-events: none;
}

.ticker-container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.ticker-container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

.ticker {
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.ticker-content {
    display: flex;
    gap: 0;
    align-items: center;
    height: 100%;
    padding: 0;
    animation: ticker-scroll 55s linear infinite;
    will-change: transform;
    white-space: nowrap;
    flex-shrink: 0;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-container:hover .ticker-content {
    animation-play-state: paused;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    cursor: pointer;
    border-right: 1px solid var(--border-primary);
    height: 40px;
    transition: background 0.15s;
}

.ticker-item:hover {
    background: var(--bg-hover);
}

.ticker-symbol {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.ticker-price {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-data);
}

.ticker-change {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
}

.ticker-change.positive {
    color: var(--success);
    background: rgba(46, 209, 109, 0.1);
}

.ticker-change.negative {
    color: var(--danger);
    background: rgba(240, 79, 90, 0.1);
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    width: 280px;
    min-width: 180px;
    max-width: 500px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    margin-top: 4px;
}

/* ==================== CHART ==================== */

.chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chart-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
    gap: 12px;
}

.chb-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.chb-symbol-btn {
    background: none;
    border: 1px solid transparent;
    padding: 4px 8px;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 14px;
    color: var(--accent-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    letter-spacing: 0.3px;
    line-height: 1;
}

.chb-symbol-btn:hover {
    border-color: var(--accent-primary);
    background: var(--accent-dim);
}

.chb-price {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-data);
}

.chb-change {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
}

.chb-change.positive {
    color: var(--success);
    background: rgba(46, 209, 109, 0.1);
}

.chb-change.negative {
    color: var(--danger);
    background: rgba(240, 79, 90, 0.1);
}

.chb-right {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.chb-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: all 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chb-btn:hover {
    border-color: var(--border-secondary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.chb-btn svg {
    width: 16px;
    height: 16px;
}

/* Canvas zone */
.chart-canvas-zone {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-top: 1px solid var(--border-secondary);
}

/* Candle tooltip */
.candle-tooltip {
    position: fixed;
    background: var(--bg-glass);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    pointer-events: none;
    z-index: 50;
    min-width: 180px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ct-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.ct-row:last-child {
    margin-bottom: 0;
}

.ct-label {
    color: var(--text-tertiary);
    min-width: 30px;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 11, 16, 0.6);
    z-index: 30;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-secondary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== RIGHT PANEL ==================== */

.right-panel {
    position: fixed;
    right: -400px;
    top: 56px;
    width: 380px;
    height: calc(100vh - 56px);
    background: var(--bg-primary);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    overflow: hidden;
}

.right-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 48px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-primary);
}

.panel-close {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.panel-close:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(240, 79, 90, 0.08);
}

.panel-close svg {
    width: 14px;
    height: 14px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.panel-section {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-primary);
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.panel-section h4 {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.panel-section h5 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 8px 0 6px 0;
}

/* ==================== FORMS ==================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    margin: 0;
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus,
.form-select:focus {
    border-color: var(--accent-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: all 0.18s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1;
    outline: none;
    min-height: 32px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-primary);
    background: var(--accent-dim);
}

.btn-danger {
    background: rgba(240, 79, 90, 0.1);
    color: var(--danger);
    border: none;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    min-height: 28px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ==================== MODALS ==================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modal-fade 0.2s ease;
}

.modal[style*="display: flex"] {
    display: flex !important;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-lg), var(--shadow-gold);
    animation: modal-up 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    overflow: hidden;
}

@keyframes modal-up {
    from {
        transform: translateY(24px) scale(0.97);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.modal-close:hover {
    color: var(--danger);
    background: rgba(240, 79, 90, 0.1);
}

.modal-close svg {
    width: 16px;
    height: 16px;
}

/* Auth Modal */
.modal-auth {
    width: 380px;
    padding: 32px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    gap: 8px;
}

.auth-brand svg {
    width: 48px;
    height: 48px;
}

.auth-brand h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.auth-brand p {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin: 0;
}

/* ==================== TOAST ==================== */

.toast-container {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 500;
    min-width: 260px;
    max-width: 340px;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    transition: opacity 0.25s;
    pointer-events: auto;
}

@keyframes toast-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-info {
    border-left: 3px solid var(--info);
}

/* ==================== SCROLLBAR ==================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

/* ==================== ACCESSIBILITY ==================== */

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1200px) {
    .header-btn span {
        display: none;
    }

    .logo-wordmark {
        font-size: 13px;
    }

    .sidebar {
        width: 240px;
    }

    .right-panel {
        width: 320px;
    }

    .header-controls {
        margin-left: -30px;
    }
}

@media (max-width: 900px) {
    .header-controls {
        gap: 2px;
        margin-left: -30px;
    }

    .header-select {
        min-width: 70px;
    }

    .sidebar {
        width: 200px;
    }

    .right-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 768px) {
    .header {
        height: 48px;
        padding: 0 12px;
    }

    .header-right {
        gap: 0;
    }

    .hright-sep {
        display: none;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 48px;
        bottom: 0;
        z-index: 100;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .chart-header-bar {
        height: 40px;
        padding: 0 10px;
    }

    .chb-price {
        font-size: 14px;
    }

    .chb-btn {
        width: 28px;
        height: 28px;
        padding: 0;
    }

    .header-controls {
        margin-left: -30px;
    }
}

@media (max-width: 480px) {
    .logo-wordmark {
        display: none;
    }

    .header-controls {
        display: none;
    }

    .header-select {
        display: none;
    }

    .tf-btn {
        font-size: 10px;
        padding: 2px 5px;
    }

    .chart-header-bar {
        gap: 6px;
    }

    .chb-symbol-btn {
        font-size: 12px;
    }

    .chb-price {
        font-size: 12px;
    }

    .right-panel {
        top: 48px;
        height: calc(100vh - 48px);
    }
}

/* ==================== PRINT ==================== */

@media print {
    .header,
    .ticker-container,
    .right-panel,
    .modal {
        display: none;
    }

    .chart-container {
        background: white;
        color: black;
    }
}

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== PERFORMANCE ==================== */

.chart-canvas-zone,
.right-panel,
.chb-btn {
    will-change: auto;
    transform: translateZ(0);
}

/* ==================== LIGHT THEME SPECIFIC ==================== */

[data-theme="light"] .header {
    background: var(--bg-tertiary);
}

[data-theme="light"] .sidebar {
    background: var(--bg-secondary);
}

[data-theme="light"] .right-panel {
    background: var(--bg-primary);
}

[data-theme="light"] .ctr-name,
[data-theme="light"] .ticker-symbol,
[data-theme="light"] .chb-symbol-btn,
[data-theme="light"] .panel-title,
[data-theme="light"] .logo-wordmark {
    color: var(--accent-primary);
}

[data-theme="light"] .ctr-price,
[data-theme="light"] .chb-price,
[data-theme="light"] .ticker-price {
    color: var(--text-primary);
    font-weight: 500;
}

[data-theme="light"] .modal-content {
    background: var(--bg-elevated);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select {
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus {
    background: var(--bg-primary);
    border-color: var(--accent-primary);
}

/* ==================== TUTORIAL FIXES ==================== */

.tutorial-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.tutorial-spotlight {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.tutorial-highlight {
    border-radius: var(--radius-md) !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8) !important;
}

/* ══════════════════════════════════════════════════════════════════════ */
/* ✅ v3.1: CACHE INDICATORS - Gold/Silver Premium Theme */
/* ══════════════════════════════════════════════════════════════════════ */

/**
 * ✅ v3.1: Cache Indicators v1.1
 * 
 * Используются переменные темы:
 * - --accent-primary: #d4af37 (золото)
 * - --accent-light: #f0d060 (светлое золото)
 * - --accent-dim: rgba(212, 175, 55, 0.08) (тусклое золото)
 * - --bg-glass: прозрачный фон
 * - --shadow-md: тень
 * 
 * Классы:
 * - .cache-fresh ⚡ (Свежий кэш)
 * - .cache-silver ✓ (Данные из кэша)
 * - .cache-stale (Устаревшие данные)
 * - .chart-loading-gold (Загрузка графика)
 */

/* ── GOLD: Свежий кэш / Успешная загрузка ── */
.cache-fresh {
    position: fixed;
    top: 70px;
    right: 20px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--accent-primary);
    border-left: 4px solid var(--accent-primary);
    border-radius: 10px;
    padding: 10px 16px;
    color: var(--accent-light);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.2);
    animation: cacheSlideIn 0.3s ease, cacheFadeOut 3s ease 2s forwards;
    letter-spacing: 0.3px;
}

.cache-fresh::before {
    content: '⚡';
    font-size: 14px;
    filter: drop-shadow(0 0 4px var(--accent-primary));
}

/* ── SILVER: Данные из кэша (не свежие, но ок) ── */
.cache-silver {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(192, 192, 192, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #c0c0c0;
    border-left: 4px solid #c0c0c0;
    border-radius: 10px;
    padding: 8px 14px;
    color: #c0c0c0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: cacheSlideIn 0.3s ease, cacheFadeOut 2.5s ease 1.5s forwards;
    letter-spacing: 0.2px;
}

.cache-silver::before {
    content: '✓';
    font-size: 12px;
    font-weight: 700;
}

/* ── GOLD STALE: Устаревшие данные (обновляются) ── */
.cache-stale {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(255, 152, 0, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #ff9800;
    border-left: 4px solid #ff9800;
    border-radius: 10px;
    padding: 10px 16px;
    color: #ff9800;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: cacheSlideIn 0.3s ease;
    letter-spacing: 0.3px;
}

.cache-stale::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 152, 0, 0.3);
    border-top-color: #ff9800;
    border-radius: 50%;
    animation: cacheSpin 0.8s linear infinite;
    flex-shrink: 0;
}

/* ── CHART LOADING (Gold spinner) ── */
.chart-loading-gold {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 28, 38, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 200;
    border: 1px solid var(--accent-primary);
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.2);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

.chart-loading-gold .spinner-gold {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(212, 175, 55, 0.25);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: cacheSpin 0.8s linear infinite;
    flex-shrink: 0;
}

.chart-loading-gold span {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    letter-spacing: 0.5px;
}

/* ── ANIMATIONS ── */
@keyframes cacheSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes cacheFadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes cacheSpin {
    to { transform: rotate(360deg); }
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.9; box-shadow: 0 8px 32px rgba(212, 175, 55, 0.15); }
    50% { opacity: 1; box-shadow: 0 8px 32px rgba(212, 175, 55, 0.35); }
}

/* ==================== LIGHT THEME CACHE INDICATORS ==================== */

[data-theme="light"] .cache-fresh {
    background: rgba(184, 134, 11, 0.08);
    border-color: #b8860b;
    border-left-color: #b8860b;
    color: #8b6300;
    box-shadow: 0 4px 20px rgba(184, 134, 11, 0.15);
}

[data-theme="light"] .cache-fresh::before {
    filter: drop-shadow(0 0 4px #b8860b);
}

[data-theme="light"] .cache-silver {
    background: rgba(160, 160, 160, 0.08);
    border-color: #a0a0a0;
    border-left-color: #a0a0a0;
    color: #6b7280;
}

[data-theme="light"] .cache-stale {
    background: rgba(255, 152, 0, 0.08);
    border-color: #f57c00;
    border-left-color: #f57c00;
    color: #e65100;
}

[data-theme="light"] .cache-stale::before {
    border-color: rgba(245, 124, 0, 0.3);
    border-top-color: #f57c00;
}

[data-theme="light"] .chart-loading-gold {
    background: rgba(255, 255, 255, 0.98);
    border-color: #b8860b;
    box-shadow: 0 8px 32px rgba(184, 134, 11, 0.15);
}

[data-theme="light"] .chart-loading-gold .spinner-gold {
    border-color: rgba(184, 134, 11, 0.25);
    border-top-color: #b8860b;
}

[data-theme="light"] .chart-loading-gold span {
    color: #8b6300;
}

/* ==================== RESPONSIVE CACHE INDICATORS ==================== */

@media (max-width: 768px) {
    .cache-fresh,
    .cache-silver,
    .cache-stale {
        top: 56px;
        right: 12px;
        padding: 6px 12px;
        font-size: 10px;
    }

    .cache-fresh::before,
    .cache-silver::before {
        font-size: 12px;
    }

    .cache-stale::before {
        width: 10px;
        height: 10px;
        border-width: 1.5px;
    }

    .chart-loading-gold {
        padding: 12px 20px;
    }

    .chart-loading-gold .spinner-gold {
        width: 16px;
        height: 16px;
    }

    .chart-loading-gold span {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .cache-fresh,
    .cache-silver,
    .cache-stale {
        top: 50px;
        right: 8px;
        padding: 4px 10px;
        font-size: 9px;
        gap: 8px;
    }

    .cache-fresh::before,
    .cache-silver::before {
        font-size: 10px;
    }

    .cache-stale::before {
        width: 8px;
        height: 8px;
        border-width: 1px;
    }

    .chart-loading-gold {
        padding: 10px 16px;
        gap: 10px;
    }

    .chart-loading-gold .spinner-gold {
        width: 14px;
        height: 14px;
    }

    .chart-loading-gold span {
        font-size: 10px;
    }
}

/* ==================== PRINT MEDIA ==================== */

@media print {
    .cache-fresh,
    .cache-silver,
    .cache-stale,
    .chart-loading-gold {
        display: none !important;
    }
}

/* ==================== HIGH CONTRAST ==================== */

@media (prefers-contrast: more) {
    .cache-fresh {
        border-left-width: 5px;
        box-shadow: 0 6px 24px rgba(212, 175, 55, 0.35);
    }

    .cache-silver {
        border-left-width: 5px;
    }

    .cache-stale {
        border-left-width: 5px;
    }

    .chart-loading-gold {
        border-width: 2px;
        box-shadow: 0 8px 32px rgba(212, 175, 55, 0.4);
    }
}

/* Логотип - финальные правки */
.logo-wordmark {
    font-size: 16px !important;
    font-weight: 600 !important;
    letter-spacing: -0.5px !important;
    margin-left: 4px !important;
}

.logo-icon-wrap svg {
    width: 24px !important;
    height: 24px !important;
}

.logo {
    align-items: center !important;
    gap: 6px !important;
}