/* /static/css/pages/sentiment.css */

:root {
    --card-bg:
        linear-gradient(180deg, rgba(14, 24, 45, 0.96) 0%, rgba(8, 16, 33, 0.96) 100%);
    --card-border: rgba(147, 197, 253, 0.10);
    --card-shadow:
        0 16px 50px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
    --panel-soft:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)),
        linear-gradient(180deg, rgba(15, 23, 42, 0.84), rgba(10, 18, 35, 0.92));
}

body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.11), transparent 24%),
        linear-gradient(180deg, #04101f 0%, #071224 46%, #040b17 100%);
}

.sentiment-page {
    min-width: 0;
}

body:has(.sentiment-page) > .layout > .sidebar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    overflow: visible !important;
}

body:has(.sentiment-page) > .layout > .content > .topbar {
    position: relative !important;
    top: auto !important;
}

.page-title {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f3f4f6;
}

.sentiment-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) 480px;
    gap: 14px;
    align-items: start;
}

.sentiment-main,
.sentiment-side {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.sentiment-main {
    grid-template-columns: 1fr;
}

.sentiment-side {
    align-content: start;
}

.card {
    position: relative;
    overflow: hidden;
    min-width: 0;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(96, 165, 250, 0.05), transparent 18%, transparent 82%, rgba(96, 165, 250, 0.04)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%);
}

.card > .hd {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
        linear-gradient(90deg, rgba(59, 130, 246, 0.06), transparent 35%);
}

.card > .hd h2 {
    margin: 0;
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.card > .bd {
    position: relative;
    z-index: 1;
    padding: 14px;
    min-width: 0;
}

.btn {
    appearance: none;
    height: 34px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn:hover {
    text-decoration: none;
    border-color: rgba(96, 165, 250, 0.28);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.14), rgba(96, 165, 250, 0.06));
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.14);
}

.btn.secondary {
    border-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.seg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.winBtn,
.segBtn {
    appearance: none;
    height: 28px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.winBtn.active,
.segBtn.active {
    color: #eff6ff;
    border-color: rgba(96, 165, 250, 0.30);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.34), rgba(37, 99, 235, 0.16));
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(6, 16, 34, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #c7d2fe;
    font-size: 11px;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.link {
    color: #93c5fd;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

.kpi {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.box,
.info-box {
    min-width: 0;
    min-height: 88px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--panel-soft);
    box-shadow:
        0 0 0 1px rgba(96, 165, 250, 0.04),
        0 10px 30px rgba(30, 64, 175, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.box .val,
.info-box .value {
    color: #eef2ff;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 900;
    word-break: break-word;
}

.box .sub,
.info-box .label {
    margin-top: 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.sentiment-page [hidden] {
    display: none !important;
}

.overall-shell {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.overall-gauge-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--panel-soft);
    box-shadow:
        0 0 0 1px rgba(96, 165, 250, 0.04),
        0 10px 30px rgba(30, 64, 175, 0.08);
}

.overall-gauge-wrap {
    position: relative;
    min-height: 210px;
}

#overallGauge {
    width: 100% !important;
    height: 210px !important;
}

.overall-gauge-center {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    pointer-events: none;
}

.overall-gauge-score {
    color: #eef2ff;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
}

.overall-gauge-label {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.overall-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 16, 34, 0.72);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.legend-chip b {
    color: #eef2ff;
    font-size: 13px;
}

.legend-chip.positive {
    border-color: rgba(74, 222, 128, 0.24);
    background: rgba(74, 222, 128, 0.10);
}

.legend-chip.neutral {
    border-color: rgba(148, 163, 184, 0.24);
    background: rgba(148, 163, 184, 0.10);
}

.legend-chip.negative {
    border-color: rgba(251, 113, 133, 0.24);
    background: rgba(251, 113, 133, 0.10);
}

.overall-info-grid {
    align-content: start;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.divider {
    height: 1px;
    margin: 14px 0;
    background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.02), rgba(255,255,255,.06));
}

.chart-wrap {
    position: relative;
    width: 100%;
    height: 360px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at 18% 10%, rgba(59, 130, 246, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(10, 19, 38, 0.95), rgba(7, 14, 29, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 12px 30px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    padding: 10px;
}

#timelineChart,
.timeline-fallback {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.timeline-toolbar {
    justify-content: space-between;
}

.table-wrap {
    overflow: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table th,
.table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
    text-align: left;
}

.table th {
    color: #93a4bf;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.refs {
    display: grid;
    gap: 12px;
}

.ref {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 46%);
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: var(--panel-soft);
}

.ref .k {
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 800;
}

.ref .v {
    color: #cbd5e1;
    font-size: 12px;
    word-break: break-word;
}

.small {
    font-size: 11px;
}

#jsonModal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
}

#jsonModal.open {
    display: flex;
}

#jsonModal .inner {
    width: min(1100px, 96vw);
    max-height: 88vh;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(15, 23, 42, 0.94));
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#jsonModal .mh {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(8, 12, 22, 0.88);
    backdrop-filter: blur(10px);
}

#jsonPre {
    margin: 0;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #dbeafe;
    font-size: 12px;
    line-height: 1.5;
}

.sentiment-grid,
.sentiment-grid * {
    min-width: 0;
}

@media (max-width: 1450px) {
    .sentiment-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .overall-shell {
        grid-template-columns: 1fr;
    }

    .card > .hd {
        flex-direction: column;
        align-items: start;
    }

    .kpi,
    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .timeline-toolbar {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 760px) {
    #overallGauge {
        height: 190px !important;
    }

    .kpi,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .ref {
        grid-template-columns: 1fr;
    }

    .chart-wrap {
        height: 300px;
    }
}

@media (max-width: 620px) {
    .btn {
        width: 100%;
    }

    .row {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .row > * {
        width: 100%;
    }

    .seg {
        width: 100%;
    }
}

/* unified header spacing */
.sentiment-page .page-title,
.sentiment-page .page-subtitle {
  margin: 0 !important;
}

.sentiment-page > .sentiment-grid,
.sentiment-page > .grid,
.sentiment-page > .stack,
.sentiment-page > section + section {
  margin-top: 0 !important;
}


/* larger sentiment typography */
.sentiment-page {
  font-size: 14px;
}

.sentiment-page .page-title {
  font-size: 20px !important;
}

.sentiment-page .page-subtitle,
.sentiment-page .hint,
.sentiment-page .ref .v,
.sentiment-page .table,
.sentiment-page .table td,
.sentiment-page .value,
.sentiment-page .mono,
.sentiment-page .link {
  font-size: 14px !important;
}

.sentiment-page .card > .hd h2,
.sentiment-page .ref .k {
  font-size: 14px !important;
}

.sentiment-page .pill,
.sentiment-page .winBtn,
.sentiment-page .segBtn,
.sentiment-page .btn {
  font-size: 13px !important;
}

.sentiment-page .box .val,
.sentiment-page .info-box .value {
  font-size: 22px !important;
}

.sentiment-page .box .sub,
.sentiment-page .info-box .label,
.sentiment-page .table th,
.sentiment-page .small {
  font-size: 12px !important;
}
