/* Brutalist Design System - Vanilla CSS */

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url('../fonts/MaterialSymbolsOutlined.ttf') format('truetype');
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
}

:root {
    --color-bg-dark: #000000;
    --color-panel-dark: #000000;
    /* Same as bg for now */
    --color-border-dark: #333333;
    --color-border-active: #FFFFFF;

    --color-text-primary: #FFFFFF;
    --color-text-muted: #737373;
    /* neutral-500 */
    --color-text-subtle: #525252;
    /* neutral-600 */

    --color-neon-red: #FF0033;
    --color-neon-gold: #FFCC00;
    --color-neon-green: #00FF41;
    --color-neon-blue: #00FFFF;

    --font-sans: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #000000;
    border-left: 1px solid #333333;
}

::-webkit-scrollbar-thumb {
    background: #333333;
    border: 2px solid #000000;
}

::-webkit-scrollbar-thumb:hover {
    background: #FFFFFF;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Anti-flicker: hide configurable features until runtime config is applied */
body:not(.ui-ready) [data-ui-feature] {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

.gap-8 {
    gap: 2rem;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.025em;
}

.font-mono {
    font-family: var(--font-mono);
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-6xl {
    font-size: 3.75rem;
    line-height: 1;
}

.font-black {
    font-weight: 900;
}

.font-bold {
    font-weight: 700;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-widest {
    letter-spacing: 0.1em;
}

.tracking-tight {
    letter-spacing: -0.025em;
}

.text-white {
    color: #fff;
}

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

.text-neutral-600 {
    color: var(--color-text-subtle);
}

.text-neon-red {
    color: var(--color-neon-red);
}

.text-neon-gold {
    color: var(--color-neon-gold);
}

.text-neon-green {
    color: var(--color-neon-green);
}

.text-neon-blue {
    color: var(--color-neon-blue);
}

/* Layout - Brutalist Borders */
.brutalist-border {
    border: 2px solid var(--color-border-dark);
    background-color: var(--color-bg-dark);
}

.brutalist-border-active {
    border: 2px solid var(--color-border-active);
}

/* Header */
header {
    background-color: black;
    border-bottom: 2px solid white;
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0 1rem;
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-icon {
    border: 2px solid white;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--color-neon-green);
    margin-right: 0.5rem;
}

/* Main Grid */
main {
    max-width: 1920px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 1280px) {
    main {
        grid-template-columns: repeat(12, 1fr);
    }

    .col-span-8 {
        grid-column: span 8;
    }

    .col-span-4 {
        grid-column: span 4;
    }
}

/* Sections */
section {
    margin-bottom: 1.5rem;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--color-border-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Components: Selects & Inputs (Brutalist) */
select,
input[type="text"] {
    background-color: black;
    border: 2px solid var(--color-border-dark);
    color: white;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 1rem;
    outline: none;
    height: 2rem;
}

select:focus,
input:focus {
    border-color: white;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    border-bottom: 2px solid var(--color-border-dark);
}

@media (min-width: 640px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.kpi-card {
    padding: 1.5rem;
    border-right: 2px solid var(--color-border-dark);
    transition: background-color 0.2s;
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kpi-card:last-child {
    border-right: none;
}

.kpi-card:hover {
    background-color: #0a0a0a;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .charts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.chart-wrapper {
    padding: 1.5rem;
    border-right: 2px solid var(--color-border-dark);
    height: 280px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chart-wrapper:last-child {
    border-right: none;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
}

/* Overlay text for donuts */
.chart-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
}

.chart-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    background: #111;
    border: 2px solid #fff;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.chart-tooltip.visible {
    opacity: 1;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    text-align: left;
}

th {
    background-color: #0a0a0a;
    border-bottom: 2px solid var(--color-border-dark);
    color: var(--color-text-muted);
    font-size: 10px;
    text-transform: uppercase;
    padding: 1rem;
    font-weight: 900;
}

td {
    padding: 1rem;
    border-bottom: 2px solid rgba(51, 51, 51, 0.5);
    font-size: 11px;
    vertical-align: top;
}

tr:hover {
    background-color: #111;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.badge.critical {
    background-color: var(--color-neon-red);
    color: black;
}

.badge.high {
    background-color: var(--color-neon-gold);
    color: black;
}

/* Using Gold/Amber for High */

/* Activity Feed */
.activity-feed-container {
    height: 700px;
    display: flex;
    flex-direction: column;
}

.activity-feed {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-family: var(--font-mono);
}

.feed-item {
    position: relative;
    padding-left: 1.5rem;
    border-left: 2px solid var(--color-border-dark);
    padding-bottom: 1.5rem;
}

.feed-item.critical {
    border-left-color: var(--color-neon-red);
}

.feed-dot {
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    background-color: var(--color-text-subtle);
}

.feed-item.critical .feed-dot {
    background-color: var(--color-neon-red);
}

/* Buttons */
.btn {
    background: white;
    color: black;
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-weight: 900;
    text-transform: uppercase;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.btn:hover:not(:disabled) {
    background-color: var(--color-neon-blue);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    font-size: 9px;
    padding: 4px 12px;
    border: 1px solid var(--color-border-dark);
    background: #111;
    color: white;
}

/* Status Indicator Pulse */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--color-status-ok);
    border-radius: 50%;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.status-indicator.pulse-active {
    background-color: var(--color-neon-blue);
    box-shadow: 0 0 8px var(--color-neon-blue);
    animation: pulse-blue 1.5s infinite;
}

@keyframes pulse-blue {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-sm:hover {
    background: white;
    color: black;
}

/* Narrative AI Card */
.narrative-card {
    background: #0d0d12;
    border: 1px solid #1f1f2e;
    padding: 1.5rem;
    position: relative;
    font-family: var(--font-mono);
}

.ai-badge {
    border: 1px solid var(--color-neon-purple);
    background: rgba(176, 38, 255, 0.15);
    color: var(--color-neon-purple);
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 0.1em;
    box-shadow: 0 0 8px rgba(176, 38, 255, 0.3);
    text-shadow: 0 0 4px rgba(176, 38, 255, 0.5);
}

.narrative-title {
    color: #737373;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.purple-star {
    color: var(--color-neon-purple);
    font-size: 14px;
}

.narrative-text {
    font-size: 13px;
    line-height: 1.6;
    color: #a0a0a0;
}

.highlight-blue {
    color: var(--color-neon-blue);
    font-weight: bold;
}

.narrative-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    text-transform: uppercase;
    color: #555;
    font-weight: bold;
}

.link-purple {
    color: var(--color-neon-purple);
    text-decoration: none;
    transition: opacity 0.2s;
}

.link-purple:hover {
    opacity: 0.8;
}

.demo-indicator {
    font-size: 9px;
    color: var(--color-neon-purple);
    border: 1px solid var(--color-neon-purple);
    padding: 2px 6px;
    margin-left: 10px;
    vertical-align: middle;
    background: rgba(176, 38, 255, 0.1);
    font-weight: bold;
    letter-spacing: 0.05em;
}

/* Responsive Grids */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border: 1px solid var(--color-border-dark);
}

/* Tablet Header Responsiveness */
@media (max-width: 1024px) {
    .header-inner {
        padding: 0 0.5rem;
    }

    .header-left,
    .header-right {
        gap: 0.75rem;
    }

    .header-right {
        font-size: 10px;
    }

    .header-right .btn {
        padding: 0.4rem 0.6rem;
        white-space: nowrap;
        font-size: 10px;
    }

    .logo-link img {
        height: 24px !important;
        margin-right: 8px !important;
    }
}

/* Tablet Responsiveness */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .col-span-8,
    .col-span-4 {
        grid-column: span 12;
        /* Stack on tablet */
    }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {

    .kpi-grid,
    .charts-grid {
        grid-template-columns: 1fr;
    }

    /* Header Responsive */
    header {
        height: auto;
        padding: 1rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: center;
        /* Center status text */
        gap: 0.8rem;
    }

    .header-right .btn {
        width: 100%;
        justify-content: center;
    }

    /* Unhide critical info on mobile, despite class name */
    .hidden-md-down {
        display: flex !important;
        /* Force flex for the status row */
        justify-content: center;
        width: 100%;
    }

    /* Existing Mobile Styles */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header .flex {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .narrative-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .narrative-title {
        flex-wrap: wrap;
    }

    .demo-indicator {
        margin-left: 0;
        margin-top: 4px;
        display: inline-block;
    }
}