/* ======================================================
   ThaaiQuant Sprint 2.8
   Professional Live Dashboard Enhancements
====================================================== */

.brand-section {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.header-status-grid {
    display: grid;
    grid-template-columns:
        repeat(5, minmax(112px, 1fr));
    gap: 10px;
}

.header-status-card {
    min-width: 0;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background:
        linear-gradient(
            145deg,
            rgba(24, 42, 67, 0.76),
            rgba(15, 27, 45, 0.84)
        );
    text-align: center;
}

.header-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.header-status-card strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-status-card .status-positive,
.header-status-card strong.status-positive {
    color: var(--green);
}

.header-status-card .status-negative,
.header-status-card strong.status-negative {
    color: var(--red);
}

.header-status-card .status-information,
.header-status-card strong.status-information {
    color: var(--blue);
}

.header-status-card .status-warning,
.header-status-card strong.status-warning {
    color: var(--yellow);
}

.header-status-card .status-pending,
.header-status-card strong.status-pending {
    color: var(--text-muted);
}

/* Live market summary */

.live-market-overview {
    margin: 4px 0 28px;
}

.section-heading-row {
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.section-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section-heading-row h2,
.detailed-analysis-heading h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -0.025em;
}

.live-refresh-note {
    color: var(--text-muted);
    font-size: 11px;
}

.live-summary-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.live-summary-card {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background:
        linear-gradient(
            150deg,
            rgba(24, 42, 67, 0.94),
            rgba(10, 23, 40, 0.98)
        );
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.18);
}

.live-summary-loading,
.live-summary-error {
    min-height: 225px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    text-align: center;
}

.live-summary-top,
.live-summary-price-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.live-summary-exchange {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.live-summary-card h3 {
    margin: 5px 0 0;
    font-size: 20px;
}

.live-summary-status {
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.live-summary-status.live {
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(20, 83, 45, 0.34);
}

.live-summary-status.stale {
    color: var(--yellow);
    border-color: rgba(250, 204, 21, 0.3);
    background: rgba(113, 63, 18, 0.34);
}

.live-summary-price-row {
    margin-top: 18px;
    align-items: flex-end;
}

.live-summary-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 10px;
}

.live-summary-price {
    display: block;
    font-size: clamp(27px, 4vw, 38px);
    line-height: 1;
    letter-spacing: -0.04em;
}

.live-summary-decision {
    min-width: 92px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    text-align: center;
    font-size: 13px;
    font-weight: 850;
}

.live-summary-decision.buy {
    color: #dcfce7;
    border-color: rgba(74, 222, 128, 0.4);
    background: rgba(20, 83, 45, 0.68);
}

.live-summary-decision.sell {
    color: #ffe4e6;
    border-color: rgba(251, 113, 133, 0.4);
    background: rgba(136, 19, 55, 0.68);
}

.live-summary-decision.wait {
    color: #fef9c3;
    border-color: rgba(250, 204, 21, 0.38);
    background: rgba(113, 63, 18, 0.66);
}

.live-summary-times {
    margin-top: 17px;
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.live-summary-times div,
.live-candle-item {
    min-width: 0;
    padding: 10px;
    border-radius: 10px;
    background: rgba(7, 17, 31, 0.46);
}

.live-summary-times span,
.live-candle-item span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 9px;
}

.live-summary-times strong {
    display: block;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-candle-row {
    margin-top: 9px;
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.live-candle-item {
    text-align: center;
}

.live-candle-item strong {
    font-size: 12px;
}

.live-summary-unavailable {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.65;
}

.detailed-analysis-heading {
    margin: 4px 0 14px;
}

/* Confidence gauge correction */

.confidence-circle {
    position: relative;
    isolation: isolate;
}

.confidence-circle > div {
    width: 82px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-radius: 50%;
    background: var(--surface);
    text-align: center;
}

.confidence-value {
    margin: 0;
    color: var(--text);
    font-size: 25px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.confidence-label {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-heading {
    padding-top: 4px;
}

.dashboard-heading .eyebrow {
    color: var(--blue);
}

@media (max-width: 1180px) {
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-status-grid {
        width: 100%;
        grid-template-columns:
            repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .live-summary-grid {
        grid-template-columns: 1fr;
    }

    .header-status-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .section-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .live-summary-times {
        grid-template-columns: 1fr;
    }

    .live-candle-row {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .header-status-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 390px) {
    .header-status-grid,
    .live-candle-row {
        grid-template-columns: 1fr;
    }
}

/* ======================================================
   Decision History
====================================================== */

.history-section {
    margin-top: 30px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-controls label {
    color: var(--text-muted);
    font-size: 11px;
}

.history-controls select {
    min-width: 125px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: none;
    color: var(--text);
    background: var(--surface);
    font: inherit;
    font-size: 12px;
}

.history-controls select:focus {
    border-color: var(--blue);
}

.history-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        linear-gradient(
            150deg,
            rgba(24, 42, 67, 0.9),
            rgba(10, 23, 40, 0.97)
        );
    box-shadow: var(--shadow);
}

.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.history-table th,
.history-table td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.history-table th {
    color: var(--text-muted);
    background: rgba(7, 17, 31, 0.38);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-table td {
    color: var(--text-soft);
    font-size: 12px;
}

.history-table tbody tr {
    transition: background 0.15s ease;
}

.history-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.05);
}

.history-table tbody tr:last-child td {
    border-bottom: 0;
}

.history-exchange {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
}

.history-decision,
.history-trend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 800;
}

.history-decision {
    min-width: 72px;
    padding: 5px 9px;
    font-size: 10px;
}

.history-decision.buy {
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(20, 83, 45, 0.32);
}

.history-decision.sell {
    color: var(--red);
    border-color: rgba(251, 113, 133, 0.3);
    background: rgba(136, 19, 55, 0.3);
}

.history-decision.wait {
    color: var(--yellow);
    border-color: rgba(250, 204, 21, 0.3);
    background: rgba(113, 63, 18, 0.3);
}

.history-trend {
    padding: 4px 8px;
    font-size: 9px;
}

.history-trend.bullish {
    color: var(--green);
}

.history-trend.bearish {
    color: var(--red);
}

.history-trend.neutral {
    color: var(--yellow);
}

.history-loading-cell,
.history-empty-cell,
.history-error-cell {
    padding: 36px !important;
    text-align: center !important;
}

.history-loading-cell,
.history-empty-cell {
    color: var(--text-muted) !important;
}

.history-error-cell {
    color: var(--red) !important;
}

.history-footer {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
}

@media (max-width: 650px) {
    .history-section .section-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .history-controls {
        width: 100%;
        justify-content: space-between;
    }

    .history-footer {
        flex-direction: column;
    }
}
