/* ============================================
   GEOMETRICAL MACROECONOMICS - TERMINAL THEME
   Retro CRT Terminal Aesthetic
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #0d1117;
    --bg-panel: #0c1218;
    --bg-hover: rgba(0, 255, 65, 0.05);

    --green-bright: #00ff41;
    --green-primary: #00d632;
    --green-dim: #00802b;
    --green-dark: #004d1a;

    --cyan: #00ffff;
    --cyan-dim: #008b8b;

    --yellow: #ffcc00;
    --orange: #ff8c00;
    --red: #ff3333;
    --red-dim: #990000;

    --text-primary: #00ff41;
    --text-dim: #00802b;
    --text-muted: #3d5c3d;

    --border-color: #00802b;
    --border-bright: #00ff41;

    --font-mono: 'Fira Code', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', 'Courier New', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.terminal-body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* CRT Scanline Effect */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    animation: scanlines 0.1s linear infinite;
}

.crt-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.3) 90%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(2px); }
}

/* Flicker effect - subtle */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.9; }
    94% { opacity: 1; }
}

body.terminal-body {
    animation: flicker 4s infinite;
}

/* Container */
.terminal-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    position: relative;
}

/* ============================================
   HEADER
   ============================================ */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
}

.terminal-title {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.site-title {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    margin: 0;
    padding: 0;
    color: inherit;
    line-height: inherit;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    color: var(--green-bright);
}

.prompt {
    color: var(--cyan);
    margin-right: 8px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.terminal-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--green-bright);
}

/* ============================================
   NAVIGATION
   ============================================ */
.terminal-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
    background: linear-gradient(180deg, transparent, rgba(0, 255, 65, 0.02));
}

.terminal-nav a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    position: relative;
}

.terminal-nav a::before {
    content: "[ ";
    color: var(--text-dim);
}

.terminal-nav a::after {
    content: " ]";
    color: var(--text-dim);
}

.terminal-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.terminal-nav a:hover::before,
.terminal-nav a:hover::after {
    color: var(--text-dim);
}

.terminal-nav a.active {
    color: var(--green-bright);
    border-color: var(--border-color);
    background: rgba(0, 255, 65, 0.08);
}

.terminal-nav a.active::before,
.terminal-nav a.active::after {
    color: var(--green-primary);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.terminal-main {
    min-height: 60vh;
    padding-bottom: 40px;
}

/* ============================================
   PANELS
   ============================================ */
.terminal-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 20px 25px;
    margin-bottom: 25px;
    position: relative;
    max-width: 100%;
}

.terminal-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--green-dim), transparent);
}

.terminal-panel-header {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.terminal-panel-header::before {
    content: "// ";
    color: var(--text-muted);
}

/* ============================================
   GRID LAYOUTS
   ============================================ */
.terminal-grid {
    display: grid;
    gap: 20px;
}

.terminal-grid-2 { grid-template-columns: repeat(2, 1fr); }
.terminal-grid-3 { grid-template-columns: repeat(3, 1fr); }
.terminal-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1000px) {
    .terminal-grid-3, .terminal-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .terminal-grid-2, .terminal-grid-3, .terminal-grid-4 { grid-template-columns: 1fr; }
}

/* ============================================
   METRIC BOXES
   ============================================ */
.metric-box {
    text-align: center;
    padding: 25px 20px;
    border: 1px solid var(--border-color);
    background: rgba(0, 255, 65, 0.02);
    transition: all 0.3s ease;
}

.metric-box:hover {
    border-color: var(--border-bright);
    background: rgba(0, 255, 65, 0.05);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.metric-value.positive { color: var(--green-bright); }
.metric-value.negative { color: var(--red); }
.metric-value.warning { color: var(--yellow); }

.metric-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.metric-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

/* ============================================
   TABLES
   ============================================ */
.terminal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.terminal-table th,
.terminal-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--green-dark);
}

.terminal-table th {
    color: var(--cyan);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border-color);
    background: rgba(0, 255, 255, 0.03);
}

.terminal-table tbody tr {
    transition: background 0.2s ease;
}

.terminal-table tbody tr:hover {
    background: var(--bg-hover);
}

.terminal-table .positive { color: var(--green-bright); }
.terminal-table .negative { color: var(--red); }
.terminal-table .warning { color: var(--yellow); }

/* ============================================
   BUTTONS
   ============================================ */
.terminal-btn {
    display: inline-block;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.terminal-btn::before {
    content: '> ';
    color: var(--text-dim);
}

.terminal-btn:hover {
    background: var(--green-bright);
    color: var(--bg-primary);
    border-color: var(--green-bright);
}

.terminal-btn:hover::before {
    color: var(--bg-primary);
}

.terminal-btn-primary {
    border-color: var(--cyan);
    color: var(--cyan);
}

.terminal-btn-primary::before {
    color: var(--cyan-dim);
}

.terminal-btn-primary:hover {
    background: var(--cyan);
    border-color: var(--cyan);
}

.terminal-btn-danger {
    border-color: var(--red);
    color: var(--red);
}

.terminal-btn-danger:hover {
    background: var(--red);
    border-color: var(--red);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

/* ============================================
   FORMS
   ============================================ */
.terminal-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-label::before {
    content: '$ ';
    color: var(--text-muted);
}

.terminal-input,
.terminal-select {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.terminal-input:focus,
.terminal-select:focus {
    outline: none;
    border-color: var(--green-bright);
}

.terminal-input::placeholder {
    color: var(--text-muted);
}

.terminal-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff41' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.terminal-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 10px;
}

.form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}

/* ============================================
   ALERTS
   ============================================ */
.terminal-alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-left: 4px solid;
    background: rgba(0, 0, 0, 0.3);
}

.terminal-alert-success {
    border-color: var(--green-bright);
    background: rgba(0, 255, 65, 0.05);
}

.terminal-alert-warning {
    border-color: var(--yellow);
    background: rgba(255, 204, 0, 0.05);
    color: var(--yellow);
}

.terminal-alert-error {
    border-color: var(--red);
    background: rgba(255, 51, 51, 0.05);
    color: var(--red);
}

.alert-prefix {
    font-weight: bold;
    margin-right: 10px;
}

/* ============================================
   LOADING ANIMATION
   ============================================ */
.terminal-loading {
    color: var(--text-dim);
}

.terminal-loading::after {
    content: "";
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60% { content: "..."; }
    80%, 100% { content: ""; }
}

/* ============================================
   TEXT STYLES
   ============================================ */
.terminal-text {
    margin: 12px 0;
    line-height: 1.7;
}

.terminal-muted {
    color: var(--text-muted);
}

.terminal-error {
    color: var(--red);
}

.positive { color: var(--green-bright); }
.negative { color: var(--red); }
.warning { color: var(--yellow); }

/* ============================================
   LISTS
   ============================================ */
.terminal-list {
    list-style: none;
    padding-left: 0;
}

.terminal-list li {
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.terminal-list li::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--text-dim);
}

.step-num {
    color: var(--cyan);
    font-weight: bold;
    margin-right: 10px;
}

/* ============================================
   LINKS
   ============================================ */
a {
    color: var(--cyan);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* ============================================
   STATUS & STATS GRIDS
   ============================================ */
.status-grid, .stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
}

.status-item, .stat-item {
    flex: 1;
    min-width: 150px;
}

.status-label, .stat-label {
    color: var(--text-dim);
    margin-right: 10px;
    font-size: 0.85rem;
}

.status-value, .stat-value {
    font-weight: bold;
    color: var(--green-bright);
}

/* ============================================
   TICKER BADGES
   ============================================ */
.ticker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ticker-badge {
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.ticker-badge:hover {
    border-color: var(--green-bright);
}

.ticker-more {
    color: var(--text-muted);
    padding: 6px 12px;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 20px;
    min-height: 350px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
}

/* ============================================
   RISK DISPLAY
   ============================================ */
.risk-display {
    text-align: center;
    padding: 15px;
}

.risk-level {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px 20px;
    margin-bottom: 12px;
    border: 1px solid;
    display: inline-block;
    letter-spacing: 2px;
}

.risk-level.risk-low {
    border-color: var(--green-bright);
    color: var(--green-bright);
}

.risk-level.risk-medium {
    border-color: var(--yellow);
    color: var(--yellow);
}

.risk-level.risk-high {
    border-color: var(--orange);
    color: var(--orange);
}

.risk-level.risk-critical {
    border-color: var(--red);
    color: var(--red);
    animation: critical-pulse 1s infinite;
}

@keyframes critical-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.risk-label {
    margin-right: 15px;
    color: var(--text-dim);
}

/* ============================================
   ALERT ITEMS
   ============================================ */
.alerts-list {
    max-height: 400px;
    overflow-y: auto;
}

.alerts-list::-webkit-scrollbar {
    width: 8px;
}

.alerts-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.alerts-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.alert-item {
    padding: 15px 20px;
    margin-bottom: 12px;
    border-left: 3px solid;
    background: rgba(0, 0, 0, 0.3);
}

.alert-item.alert-low { border-color: var(--green-bright); }
.alert-item.alert-medium { border-color: var(--yellow); }
.alert-item.alert-high { border-color: var(--orange); }
.alert-item.alert-critical { border-color: var(--red); }

.alert-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.alert-level {
    font-weight: bold;
    letter-spacing: 1px;
}

.alert-low .alert-level { color: var(--green-bright); }
.alert-medium .alert-level { color: var(--yellow); }
.alert-high .alert-level { color: var(--orange); }
.alert-critical .alert-level { color: var(--red); }

.alert-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.alert-message {
    margin-bottom: 8px;
}

.alert-details {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ============================================
   FOOTER
   ============================================ */
.terminal-footer {
    margin-top: 50px;
    padding: 25px 0;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.footer-time {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.footer-link {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--cyan);
    text-decoration: underline;
}

/* ============================================
   GUIDE CONTENT
   ============================================ */
.guide-content {
    padding: 15px;
}

.guide-content ol {
    padding-left: 0;
    list-style: none;
    counter-reset: guide-counter;
}

.guide-content li {
    margin: 15px 0;
    padding-left: 35px;
    position: relative;
    counter-increment: guide-counter;
}

.guide-content li::before {
    content: counter(guide-counter, decimal-leading-zero);
    position: absolute;
    left: 0;
    color: var(--cyan);
    font-weight: bold;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    height: 20px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--green-dim), var(--green-bright));
    height: 100%;
    transition: width 0.3s ease;
}

/* ============================================
   ASCII ART BOX
   ============================================ */
.ascii-box {
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--text-dim);
    white-space: pre;
    overflow-x: auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .terminal-container {
        padding: 15px;
    }

    .terminal-title {
        font-size: 1.2rem;
    }

    .terminal-nav {
        justify-content: center;
    }

    .metric-value {
        font-size: 2rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .crt-overlay,
    .terminal-nav,
    .terminal-footer {
        display: none;
    }

    body.terminal-body {
        background: white;
        color: black;
    }

    .terminal-panel {
        border-color: #ccc;
        box-shadow: none;
    }
}

/* ============================================
   ABOUT PAGE STYLES
   ============================================ */
.about-content {
    padding: 20px;
    line-height: 1.8;
}

.about-content h2,
.about-content h3 {
    color: var(--cyan);
    margin-top: 25px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

.about-content h2::before,
.about-content h3::before {
    content: "## ";
    color: var(--text-muted);
}

.about-content p {
    margin: 15px 0;
}

.about-content em {
    color: var(--yellow);
    font-style: italic;
}

.about-content strong {
    color: var(--green-bright);
}

.section-title {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 25px;
    text-align: center;
}

/* Table of Contents */
.toc {
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid var(--cyan-dim);
    padding: 20px;
    margin: 20px 0;
}

.toc-title {
    color: var(--cyan);
    font-weight: bold;
    margin-bottom: 15px;
}

.toc .terminal-list li::before {
    color: var(--cyan-dim);
}

/* Axiom Box */
.axiom-box {
    background: rgba(0, 255, 65, 0.05);
    border: 2px solid var(--green-bright);
    padding: 20px;
    margin: 25px 0;
}

.axiom-title {
    color: var(--green-bright);
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.axiom-title::before {
    content: ">>> ";
}

.axiom-box p {
    margin: 0;
    color: var(--text-primary);
}

/* Hypothesis Box */
.hypothesis-box {
    background: rgba(255, 204, 0, 0.05);
    border: 2px solid var(--yellow);
    padding: 20px;
    margin: 25px 0;
}

.hypothesis-title {
    color: var(--yellow);
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.hypothesis-title::before {
    content: "!!! ";
}

/* Equation Box */
.equation-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 20px 30px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.1rem;
    color: var(--cyan);
    font-family: var(--font-mono);
    overflow-x: auto;
}

/* Blockquotes */
.terminal-quote {
    border-left: 3px solid var(--cyan);
    padding: 15px 25px;
    margin: 20px 0;
    background: rgba(0, 255, 255, 0.03);
    font-style: italic;
    color: var(--text-dim);
}

/* Download Button */
.download-btn {
    font-size: 1rem;
    padding: 15px 30px;
    margin-top: 15px;
}

.download-btn::before {
    content: ">> ";
}

/* ============================================
   INFO TOOLTIPS
   ============================================ */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--cyan-dim);
    color: var(--cyan-dim);
    font-size: 0.7rem;
    font-weight: bold;
    cursor: help;
    margin-left: 8px;
    vertical-align: middle;
    transition: all 0.2s ease;
    position: relative;
}

.info-icon:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(0, 255, 255, 0.1);
}

.info-tooltip {
    position: relative;
    display: inline-block;
}

.info-tooltip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--cyan);
    padding: 12px 15px;
    font-size: 0.8rem;
    font-weight: normal;
    line-height: 1.5;
    width: 280px;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.info-tooltip .tooltip-text::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--cyan) transparent transparent transparent;
}

.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Tooltip positioned below */
.info-tooltip.tooltip-bottom .tooltip-text {
    bottom: auto;
    top: 130%;
}

.info-tooltip.tooltip-bottom .tooltip-text::before {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent var(--cyan) transparent;
}

/* Tooltip positioned left */
.info-tooltip.tooltip-left .tooltip-text {
    left: auto;
    right: 0;
    transform: none;
}

.info-tooltip.tooltip-left .tooltip-text::before {
    left: auto;
    right: 15px;
}

/* Tooltip positioned right */
.info-tooltip.tooltip-right .tooltip-text {
    left: 0;
    transform: none;
}

.info-tooltip.tooltip-right .tooltip-text::before {
    left: 15px;
}

/* Tooltip title */
.tooltip-title {
    color: var(--cyan);
    font-weight: bold;
    margin-bottom: 6px;
    display: block;
    font-size: 0.85rem;
}

/* Panel header with info icon */
.terminal-panel-header .info-tooltip {
    float: right;
    margin-left: 10px;
}

.metric-label .info-tooltip {
    display: inline-block;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Hamburger Menu Button */
.nav-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--green-bright);
    transition: all 0.3s ease;
}

.nav-hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.nav-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Nav Links Container */
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Horizontal Scroll for Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive .terminal-table {
    min-width: 500px;
}

/* Horizontal Scroll for Overflow Content */
.overflow-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Chart Containers - Responsive */
.chart-container,
.viz-box,
.viz-panel {
    min-width: 0;
    overflow: hidden;
}

/* ============================================
   MOBILE BREAKPOINT (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Container */
    .terminal-container {
        padding: 10px 15px;
    }

    /* Header - keep row layout with hamburger on right */
    .terminal-header {
        flex-direction: row;
        gap: 10px;
        padding: 15px 0;
    }

    .terminal-title {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    /* Hide ONLINE status on mobile */
    .terminal-status {
        display: none;
    }

    /* Hamburger Menu - Show in header top-right */
    .nav-hamburger {
        display: flex;
        margin-left: auto;
    }

    /* Navigation */
    .terminal-nav {
        position: relative;
        padding: 10px 0;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--bg-panel);
        border: 1px solid var(--border-color);
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 100;
        padding: 10px 0;
    }

    .nav-links.open {
        display: flex;
    }

    .terminal-nav a {
        padding: 12px 20px;
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--green-dark);
    }

    .terminal-nav a:last-child {
        border-bottom: none;
    }

    /* Panels */
    .terminal-panel {
        padding: 15px;
        margin-bottom: 15px;
        overflow-x: auto;
    }

    .terminal-panel-header {
        font-size: 0.85rem;
        letter-spacing: 1px;
        margin-bottom: 15px;
    }

    /* Grids - Stack Everything */
    .terminal-grid-2,
    .terminal-grid-3,
    .terminal-grid-4,
    .viz-row {
        grid-template-columns: 1fr !important;
    }

    /* Metric Boxes */
    .metric-value {
        font-size: 1.8rem;
    }

    .metric-box {
        padding: 20px 15px;
    }

    .metric-label {
        font-size: 0.7rem;
    }

    /* Tables - ensure they fit within panels */
    .terminal-panel .terminal-table {
        width: 100%;
        table-layout: fixed;
    }

    .terminal-table th,
    .terminal-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: normal;
        word-wrap: break-word;
    }

    /* Buttons */
    .terminal-btn {
        padding: 14px 20px;
        font-size: 0.8rem;
        min-height: 44px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .terminal-btn {
        width: 100%;
        text-align: center;
    }

    /* Status Grid */
    .status-grid, .stats-grid {
        flex-direction: column;
        gap: 10px;
    }

    .status-item, .stat-item {
        min-width: 0;
        display: flex;
        justify-content: space-between;
    }

    /* Forms */
    .terminal-form {
        max-width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-row .form-group {
        min-width: 0;
        width: 100%;
    }

    .terminal-input,
    .terminal-select {
        padding: 14px 15px;
        font-size: 16px; /* Prevents iOS zoom */
        max-width: 100%;
    }

    /* Viz Boxes (Dashboard Charts) */
    .viz-box {
        min-height: 250px;
    }

    #gauge-chart {
        height: 200px;
    }

    #network-pulse {
        height: 200px;
    }

    #network-canvas {
        width: 100%;
        max-width: 280px;
    }

    /* Charts - Allow Horizontal Scroll */
    .chart-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
    }

    /* Footer */
    .terminal-footer {
        margin-top: 30px;
        padding: 20px 0;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    /* Alerts */
    .alert-item {
        padding: 12px 15px;
    }

    /* About Page */
    .about-content {
        padding: 15px 10px;
    }

    .about-content h2,
    .about-content h3 {
        font-size: 1rem;
    }

    .toc {
        padding: 15px;
    }

    .axiom-box,
    .hypothesis-box {
        padding: 15px;
    }

    .equation-box {
        padding: 15px;
        font-size: 0.9rem;
        overflow-x: auto;
    }

    /* Tooltips - Position Better on Mobile */
    .info-tooltip .tooltip-text {
        width: 220px;
        font-size: 0.75rem;
        padding: 10px 12px;
    }

    /* Risk Display */
    .risk-level {
        font-size: 1rem;
        padding: 8px 16px;
    }

    /* Guide Content */
    .guide-content li {
        padding-left: 25px;
    }
}

/* ============================================
   SMALL MOBILE BREAKPOINT (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .terminal-container {
        padding: 8px 10px;
    }

    .terminal-title {
        font-size: 0.95rem;
    }

    .terminal-panel {
        padding: 12px 10px;
    }

    .terminal-panel-header {
        font-size: 0.75rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .terminal-btn {
        padding: 12px 16px;
        font-size: 0.75rem;
    }

    .viz-box {
        min-height: 220px;
        padding: 10px;
    }

    .viz-box-title {
        font-size: 0.75rem;
    }

    /* Hide CRT effect on small screens for performance */
    .crt-overlay {
        display: none;
    }

    /* Simplify animations */
    body.terminal-body {
        animation: none;
    }
}

/* ============================================
   TABLET BREAKPOINT (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) and (min-width: 769px) {
    .terminal-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .viz-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   LANDSCAPE PHONE ORIENTATION
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .terminal-header {
        flex-direction: row;
        padding: 10px 0;
    }

    .viz-row {
        grid-template-columns: 1fr 1fr !important;
    }

    .viz-box {
        min-height: 200px;
    }
}

/* ============================================
   TOUCH DEVICE IMPROVEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .terminal-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .terminal-btn {
        min-height: 44px;
    }

    .info-icon {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    /* Remove hover effects that don't work on touch */
    .terminal-table tbody tr:hover {
        background: transparent;
    }

    .metric-box:hover {
        border-color: var(--border-color);
        background: rgba(0, 255, 65, 0.02);
    }
}
