:root {
    --bg-dark: #0a0e14;
    --card-bg: #11161d;
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --danger: #ef4444;
    /* Red */
    --warning: #eab308;
    /* Yellow */
    --success: #22c55e;
    /* Green */
    --border: #1e293b;

    --neon-green: #00ff9d;
    --neon-red: #ff0055;
    --neon-yellow: #fff200;
    --neon-blue: #00f7ff;
    --btn-blue: #3b82f6;
    --btn-blue-bright: #60a5fa;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    /* Remove padding from body */
    height: 100vh;
    overflow: hidden;
    /* Lock body scroll */
}

.dashboard-container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 5px 20px 20px 20px;
    box-sizing: border-box;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

h1 {
    font-size: 1.5rem;
    letter-spacing: 1px;
    margin: 0;
    color: var(--text-primary);
}

.header-logo {
    height: 300px;
    width: auto;
    display: block;
    margin-bottom: -110px;
    margin-left: -130px;
    margin-top: -105px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    margin-top: -15px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-left: 10px;
}

.warning-ticker {
    font-size: 0.75rem;
    color: var(--neon-red);
    font-weight: bold;
    margin-top: 5px;
    height: 1rem;
    text-transform: uppercase;
}

.macro-banner {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 8px 16px;
    background: var(--border);
    border-radius: 4px;
    color: var(--neon-green);
    border: 1px solid rgba(0, 255, 157, 0.2);
    white-space: nowrap;
}

.regime-group {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.confidence-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-left: none;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--text-secondary);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.dest-banner {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 5px;
    padding: 5px 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#money-dest-value {
    color: var(--text-primary);
    font-weight: bold;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.window-card.institutional {
    grid-column: 1 / span 3;
    border: 1px solid rgba(0, 247, 255, 0.3);
    background: linear-gradient(135deg, rgba(17, 22, 29, 1) 0%, rgba(0, 247, 255, 0.05) 100%);
    min-height: 180px;
}

.window-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.window-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    /* Allow shrinking if needed */
    flex: 1;
}

.window-header h2 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.summary-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* Traffic Lights */
.traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.traffic-light.Green {
    background-color: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green);
}

.traffic-light.Red {
    background-color: var(--neon-red);
    box-shadow: 0 0 8px var(--neon-red);
}

.traffic-light.Yellow {
    background-color: var(--neon-yellow);
    box-shadow: 0 0 8px var(--neon-yellow);
}

.traffic-light.unknown {
    background-color: #333;
}

.window-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.signal-box {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.metrics-list {
    flex: 1;
    font-size: 0.82rem;
    overflow-y: auto;
    padding-right: 5px;
}

.metrics-list::-webkit-scrollbar {
    width: 3px;
}

.metrics-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.metric-name {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.metric-name:hover {
    color: var(--neon-blue);
    text-decoration: underline;
}

.metric-value {
    font-weight: 600;
    color: var(--text-primary);
}

.next-step-box {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid var(--accent);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* TradingView Widget Container */
#tv-widget-container {
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .modal-content.large-format {
        height: 80vh;
        padding: 15px;
        padding-top: 40px;
        /* Space for close button */
    }
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* --- Minimal Button Styles --- */
.minimal-button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    white-space: nowrap;
}

.minimal-button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 247, 255, 0.2);
}

.minimal-button:active {
    transform: scale(0.98);
}

/* --- NEW STYLES for Button & Modal --- */

.glow-button {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 10px 20px;
    font-family: 'JetBrains Mono', monospace;
    /* Fallback if intl fonts not loaded */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    margin: 0 15px;
}

.glow-button:hover {
    background: var(--neon-green);
    color: #000;
    box-shadow: 0 0 20px var(--neon-green);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #0a0a0a;
    border: 1px solid var(--border);
    padding: 30px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    position: relative;
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Specific size for large content modals like TradingView */
.modal-content.large-format {
    width: 95%;
    max-width: 1400px;
    height: 85vh;
}

/* Hide scrollbar for grid but allow container scroll */
.modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
    flex: none;
    /* Don't grow/shrink to force container scroll if needed */
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
}

.summary-body {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 15px;
    margin-top: 20px;
}

/* Standardize scrolling for all modal containers */
.modal-content::-webkit-scrollbar,
.summary-body::-webkit-scrollbar,
.metrics-list::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track,
.summary-body::-webkit-scrollbar-track,
.metrics-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb,
.summary-body::-webkit-scrollbar-thumb,
.metrics-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 5px var(--accent);
}

.summary-body h3 {
    color: var(--neon-yellow);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-left: 3px solid var(--neon-yellow);
    padding-left: 10px;
}

.summary-body p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.summary-body ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.summary-body li {
    margin-bottom: 8px;
}

.summary-section-title {
    color: var(--neon-blue);
    font-weight: bold;
    display: block;
    margin-top: 15px;
    text-decoration: underline;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    color: var(--text-secondary);
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s, transform 0.2s;
}

.close-btn:hover {
    color: var(--neon-red);
    transform: scale(1.1);
}

.modal h2 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-top: 0;
    text-align: center;
    font-size: 1.5rem;
}

@media (max-width: 480px) {
    .modal h2 {
        font-size: 1.2rem;
    }
}

.modal h3 {
    color: var(--neon-blue);
    margin-bottom: 10px;
    font-size: 1.2em;
    border-left: 3px solid var(--neon-blue);
    padding-left: 10px;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 1100px) {
    .modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

.analysis-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #222;
}

.analysis-box p {
    margin: 8px 0;
    line-height: 1.5;
    color: #ccc;
    font-size: 0.95rem;
}

.key-stat {
    color: var(--neon-yellow);
    font-weight: bold;
}

.modal-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.highlight-text {
    font-size: 1.2em;
    text-shadow: 0 0 10px currentColor;
    color: var(--neon-green);
}

.mini-table {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* v6.0 Visual Panels (Refined 6.1) */
.section-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 40px 0 20px 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 3px;
    opacity: 0.6;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.section-divider span {
    padding: 0 15px;
}

.visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 50px;
}

.visual-panel {
    background: rgba(17, 22, 29, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.visual-panel:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.visual-panel h3 {
    font-size: 0.8rem;
    color: var(--accent);
    margin: 0 0 15px 0;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
}

.visual-panel h3::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--accent);
    margin-right: 10px;
    box-shadow: 0 0 10px var(--accent);
}

.chart-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 250px;
    /* Important for flex-child height */
}

@media (max-width: 480px) {
    .chart-wrapper {
        min-height: 200px;
    }
}

@media (max-width: 1000px) {
    .visual-grid {
        grid-template-columns: 1fr;
    }

    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* v6.4 Global Growth Composite Styles */
.visual-panel.full-width {
    grid-column: 1 / -1;
    min-height: 450px;
}

.panel-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.interpretation-badge {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--neon-yellow);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chart-wrapper.big {
    min-height: 350px;
}

/* Progress Bar Styles */
.progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 20, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.progress-content {
    width: 400px;
    text-align: center;
}

.progress-text {
    color: var(--neon-blue);
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 247, 255, 0.1);
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue);
    transition: width 0.3s ease;
}

.progress-subtext {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
}

/* Manual Refresh Button Styles */
/* Action Buttons Redesign (Horizontal Group) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 15px;
    padding: 0 15px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.glow-button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

#refresh-btn {
    border-color: rgba(0, 247, 255, 0.3);
    color: var(--neon-blue);
    background: none;
}

#refresh-btn:hover {
    background: rgba(0, 247, 255, 0.1);
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 247, 255, 0.3);
    transform: translateY(-2px);
}

#analyze-btn {
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--btn-blue);
    background: rgba(59, 130, 246, 0.05);
}

#analyze-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--btn-blue-bright);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    color: #fff;
}

.glow-button:active {
    transform: translateY(1px);
}

.refresh-pulse {
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 247, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 247, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 247, 255, 0);
    }
}

/* Indicator Description Box (History Modal) */
.indicator-desc-box {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    backdrop-filter: blur(5px);
    border-left: 3px solid var(--accent);
}

.scrollable-desc {
    overflow-y: auto;
    max-height: 250px;
    padding-right: 10px;
}

.scrollable-desc::-webkit-scrollbar {
    width: 4px;
}

.scrollable-desc::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.indicator-desc-box h4 {
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.indicator-desc-box .impact-tag {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
}

/* Macro Metrics Strip (Header Redesign) */
.macro-strip {
    display: flex;
    align-items: center;
    background: rgba(17, 22, 29, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 15px;
    margin-right: 20px;
    backdrop-filter: blur(5px);
}

.macro-metric {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 10px;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 2px;
    font-weight: 600;
}

.metric-value-large {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.metric-value-medium {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.macro-divider {
    width: 1px;
    height: 25px;
    background: var(--border);
    margin: 0 5px;
}

#refresh-btn:hover {
    background: rgba(0, 247, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 247, 255, 0.3);
    transform: translateY(-1px);
}

#refresh-btn:active {
    transform: translateY(1px);
}

.refresh-pulse {
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 247, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 247, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 247, 255, 0);
    }
}