﻿
/* ── CSS Variables ── */
:root {
    /* Identity */
    --mill-id: 532;
    --accent-1: #f59e0b; /* amber-400 */
    --accent-2: #fbbf24; /* amber-300 */
    --accent-glow: rgba(245,158,11,.25);
    --accent-subtle: rgba(245,158,11,.10);
    --accent-border: rgba(245,158,11,.30);
    --accent-text: #fcd34d; /* amber-200 */
    /* Surfaces */
    --bg-base: #080600;
    --bg-card: #0e0b00;
    --bg-card-inner: rgba(255,248,230,.04);
    --surface-1: rgba(255,248,230,.06);
    --surface-hover: rgba(245,158,11,.07);
    --border-subtle: rgba(255,248,230,.09);
    --border-med: rgba(255,248,230,.14);
    /* Text */
    --text-primary: #fef3c7; /* amber-100 */
    --text-secondary: rgba(254,243,199,.70);
    --text-muted: rgba(254,243,199,.45);
    /* Status */
    --ok: #4ade80;
    --warn: #fb923c;
    --error: #f87171;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

    /* Subtle grid-texture over background */
    body::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -3;
        background-image: linear-gradient(rgba(245,158,11,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(245,158,11,.035) 1px, transparent 1px);
        background-size: 36px 36px;
        pointer-events: none;
    }

.page {
    padding: 22px;
    width: 100%;
    max-width: none;
    margin: 0;
}

/* ── Background (gif + overlay) ── */
.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
}

    .bg img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: .12;
        filter: sepia(.6) hue-rotate(-10deg);
    }

.overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 20% 10%, rgba(8,6,0,.20), rgba(8,6,0,.92));
}

/* ── Brand Header ── */
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.logo {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 1px rgba(245,158,11,.08), 0 10px 30px rgba(245,158,11,.12);
}

    .logo img {
        width: 70%;
        height: 70%;
        object-fit: contain;
        filter: drop-shadow(0 0 6px rgba(245,158,11,.5));
    }

/* Mill ID badge next to title */
.titles {
    position: relative;
}

    .titles h1 {
        margin: 0;
        font-family: 'Segoe UI', Tahoma, sans-serif;
        font-size: 30px;
        font-weight: 800;
        letter-spacing: -.5px;
        /* golden shimmer */
        background: linear-gradient(135deg, var(--accent-2) 0%, #fff8e1 50%, var(--accent-1) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

        /* coloured pill "532" badge */
        .titles h1::after {
            content: '';
            display: inline-block;
            margin-left: 10px;
            font-size: 13px;
            font-family: 'Courier New', Consolas, monospace;
            font-weight: 500;
            padding: 2px 9px;
            border-radius: 999px;
            background: var(--accent-subtle);
            border: 1px solid var(--accent-border);
            color: var(--accent-2);
            -webkit-text-fill-color: var(--accent-2);
            vertical-align: middle;
            letter-spacing: .5px;
        }

    .titles .sub {
        margin-top: 5px;
        color: var(--text-muted);
        font-size: 12px;
        letter-spacing: .2px;
    }

/* ── Layout ── */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* ── Card ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 0 0 1px rgba(245,158,11,.05), 0 12px 40px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.04);
    transition: box-shadow .25s ease;
}

    .card:hover {
        box-shadow: 0 0 0 1px rgba(245,158,11,.10), 0 16px 50px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
    }

/* ── Top row (title + Advisor btn) ── */
.topRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

    .topRow h2 {
        margin: 0;
        font-family: 'Segoe UI', Tahoma, sans-serif;
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
    }

/* ── Metric tiles ── */
.metricsGrid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

@media (max-width: 1100px) {
    .metricsGrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .metricsGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.metric {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px 11px 9px;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color .2s, background .2s;
    position: relative;
    overflow: hidden;
}

    /* left accent stripe */
    .metric::before {
        content: '';
        position: absolute;
        left: 0;
        top: 18%;
        bottom: 18%;
        width: 2px;
        border-radius: 999px;
        background: linear-gradient(180deg, var(--accent-1), transparent);
        opacity: .55;
    }

    .metric:hover {
        border-color: var(--accent-border);
        background: var(--accent-subtle);
    }

    .metric .k {
        font-size: 11px;
        color: var(--text-muted);
        line-height: 1.2;
        padding-left: 6px;
    }

    .metric .v {
        font-size: 20px;
        font-weight: 700;
        font-family: 'Courier New', Consolas, monospace;
        letter-spacing: .3px;
        color: var(--text-primary);
        display: flex;
        align-items: baseline;
        gap: 5px;
        padding-left: 6px;
    }

    .metric .u {
        font-size: 11px;
        color: var(--text-muted);
        font-weight: 500;
    }

/* ── Result row ── */
.resultRow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

@media (max-width: 900px) {
    .resultRow {
        grid-template-columns: 1fr;
    }
}

.result {
    font-size: 24px;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    position: relative;
    overflow: hidden;
}

    /* animated glow sweep */
    .result::after {
        content: '';
        position: absolute;
        inset: -40%;
        background: conic-gradient(transparent 270deg, rgba(245,158,11,.06) 360deg);
        animation: sweepGlow 4s linear infinite;
        pointer-events: none;
    }

@keyframes sweepGlow {
    to {
        transform: rotate(360deg);
    }
}

.result.online b {
    color: var(--accent-text);
    font-weight: 800;
    text-shadow: 0 0 20px rgba(245,158,11,.5);
}

/* ── Footer ── */
.footer {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'Courier New', Consolas, monospace;
    line-height: 1.7;
}

/* ── Buttons ── */
.btn {
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    border: 0;
    color: #1a0f00;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(245,158,11,.25), 0 6px 20px rgba(245,158,11,.30);
    transition: all .2s ease;
    white-space: nowrap;
}

    .btn:hover {
        filter: brightness(1.08);
        box-shadow: 0 0 0 1px rgba(245,158,11,.40), 0 8px 28px rgba(245,158,11,.45);
        transform: translateY(-1px);
    }

    .btn:active {
        transform: translateY(0);
    }

.btnGhost {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 11px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all .2s ease;
}

    .btnGhost:hover {
        border-color: var(--accent-border);
        color: var(--accent-text);
        background: var(--accent-subtle);
    }

/* ── Chart tabs ── */
.chartTabs {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.tabBtn {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    transition: all .2s ease;
}

    .tabBtn.active {
        background: var(--accent-subtle);
        border-color: var(--accent-border);
        color: var(--accent-2);
    }

    .tabBtn:hover:not(.active) {
        border-color: var(--border-med);
        color: var(--text-primary);
    }

.chartPane {
    display: none;
}

    .chartPane.active {
        display: block;
    }

    .chartPane h2 {
        font-family: 'Segoe UI', Tahoma, sans-serif;
        font-size: 15px;
        font-weight: 700;
        margin: 14px 0 10px;
        color: var(--text-secondary);
    }

.chartGrid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 900px) {
    .chartGrid2 {
        grid-template-columns: 1fr;
    }
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 99999;
}

.modalBox {
    width: min(1100px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(245,158,11,.08), 0 30px 80px rgba(0,0,0,.7), 0 0 60px rgba(245,158,11,.06);
}

.modalHeader {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--accent-subtle);
}

.modalTitle {
    font-size: 18px;
    font-weight: 800;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: var(--accent-text);
}

.modalSub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.modalBody {
    padding: 18px 20px 20px;
}

/* ── Advisor form ── */
.formRow {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}

    .formRow label {
        font-size: 12px;
        color: var(--text-muted);
        display: block;
        margin-bottom: 4px;
    }

    .formRow input {
        background: var(--surface-1);
        border: 1px solid var(--border-subtle);
        border-radius: 12px;
        padding: 10px 12px;
        color: var(--text-primary);
        outline: none;
        font-family: 'Courier New', Consolas, monospace;
        transition: border-color .2s;
    }

        .formRow input:focus {
            border-color: var(--accent-border);
            box-shadow: 0 0 0 3px rgba(245,158,11,.10);
        }

.planSummary {
    margin: 10px 0 14px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Courier New', Consolas, monospace;
    line-height: 1.6;
}

/* ── Plan table ── */
.planTableWrap {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
}

.planTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .planTable thead th {
        text-align: left;
        padding: 10px 13px;
        background: var(--accent-subtle);
        border-bottom: 1px solid var(--accent-border);
        font-family: 'Segoe UI', Tahoma, sans-serif;
        font-size: 12px;
        color: var(--accent-text);
        letter-spacing: .3px;
    }

    .planTable tbody td {
        padding: 10px 13px;
        border-bottom: 1px solid var(--border-subtle);
       font-family: 'Courier New', Consolas, monospace;
    }

    .planTable tbody tr:hover {
        background: var(--surface-hover);
    }

    .planTable code {
        background: var(--accent-subtle);
        border: 1px solid var(--accent-border);
        border-radius: 6px;
        padding: 2px 6px;
        font-size: 12px;
        color: var(--accent-text);
       font-family: 'Courier New', Consolas, monospace;
    }

/* ── Badges ── */
.badgeOk {
    color: var(--ok);
    font-weight: 800;
}

.badgeWarn {
    color: var(--warn);
    font-weight: 800;
}

/* ── Helpers ── */
.mini {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
   font-family: 'Courier New', Consolas, monospace;
}

    .mini.warn {
        color: var(--warn);
        font-weight: 700;
    }

/* WS status dot */
#ws_status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
   font-family: 'Courier New', Consolas, monospace;
}

    #ws_status::before {
        content: '';
        display: inline-block;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--accent-1);
        box-shadow: 0 0 8px var(--accent-1);
        animation: pulse 2s ease-in-out infinite;
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(245,158,11,.25);
    border-radius: 999px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(245,158,11,.45);
    }

/* ── Modes (اگر فعال بشن) ── */
.modeBox {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card-inner);
}

.modeTitle {
    font-weight: 700;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.modeSub {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
    margin-bottom: 10px;
}

.seg {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    background: var(--surface-1);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
}

    .seg input {
        display: none;
    }

    .seg label {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        border-radius: 10px;
        cursor: pointer;
        user-select: none;
        background: transparent;
        border: 1px solid var(--border-subtle);
        color: var(--text-secondary);
        opacity: .85;
        transition: all .15s ease;
    }

    .seg input:checked + label {
        background: var(--accent-subtle);
        border-color: var(--accent-border);
        color: var(--accent-text);
        opacity: 1;
    }
