/* ===========================================================================
   Centracom Support Desk Dashboard -- stylesheet
   Colours come from config.php and are injected as CSS variables by the page,
   so you do not need to edit colours in here.
   =========================================================================== */

:root {
    --ink:    #1B0038;
    --panel:  #2A0057;
    --purple: #300063;
    --violet: #B500FF;
    --blue:   #1F85FF;
    --text:   #FFFFFF;
    --muted:  #B9A6D6;

    --line:   rgba(255, 255, 255, 0.10);
    --line-2: rgba(255, 255, 255, 0.18);
    --good:   #3DDC97;
    --bad:    #FF6B8A;
    --warn:   #FFC048;

    --radius: 18px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--ink);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

body {
    background-image:
        radial-gradient(1200px 700px at 12% -10%, rgba(181, 0, 255, 0.20), transparent 60%),
        radial-gradient(1000px 600px at 105% 8%, rgba(31, 133, 255, 0.18), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: var(--blue); }

/* ------------------------------------------------------------- shared bits */

.brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-mark img { height: 46px; width: auto; display: block; }
.brand-mark .brand-text { line-height: 1.15; }
.brand-mark .brand-text strong { display: block; font-size: 1.05rem; letter-spacing: 0.2px; }
.brand-mark .brand-text span { display: block; font-size: 0.78rem; color: var(--muted); }

.btn {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--violet), var(--blue));
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
    background: transparent;
    border: 1px solid var(--line-2);
    color: var(--text);
}
.btn.danger { background: linear-gradient(135deg, #ff4d6d, #c9184a); }
.btn.small { padding: 7px 12px; font-size: 0.85rem; border-radius: 8px; }

.notice {
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0 0 18px;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}
.notice.ok    { border-color: rgba(61, 220, 151, 0.5); background: rgba(61, 220, 151, 0.10); }
.notice.error { border-color: rgba(255, 107, 138, 0.5); background: rgba(255, 107, 138, 0.10); }
.notice.warn  { border-color: rgba(255, 192, 72, 0.5);  background: rgba(255, 192, 72, 0.10); }
.notice ul { margin: 8px 0 0 18px; padding: 0; }
.notice li { margin: 3px 0; }

/* ------------------------------------------------------- sign in / set up */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(42, 0, 87, 0.75);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 32px;
    backdrop-filter: blur(6px);
}
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 1.4rem; margin: 22px 0 6px; }
.auth-card p.lead { color: var(--muted); margin: 0 0 22px; font-size: 0.94rem; line-height: 1.5; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input[type=text],
.field input[type=password],
.field input[type=number],
.field input[type=file],
.field select,
.field textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--line-2);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--violet);
    outline-offset: 1px;
}
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px; line-height: 1.45; }

/* ------------------------------------------------------------- admin shell */

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 26px;
    border-bottom: 1px solid var(--line);
    background: rgba(27, 0, 56, 0.7);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
}
.admin-top .who { font-size: 0.85rem; color: var(--muted); }
.admin-body { max-width: 1180px; margin: 0 auto; padding: 26px 22px 80px; }

.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}
.tabs a {
    text-decoration: none;
    color: var(--muted);
    padding: 9px 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
}
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tabs a.on { color: #fff; background: linear-gradient(135deg, var(--violet), var(--blue)); }

.card {
    background: rgba(42, 0, 87, 0.55);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 22px;
}
.card h2 { margin: 0 0 6px; font-size: 1.12rem; }
.card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
table.data tr:last-child td { border-bottom: 0; }
/* Inputs anywhere in the admin area, not only inside a .field wrapper. */
.admin-body input[type=text],
.admin-body input[type=password],
.admin-body input[type=number],
.admin-body select,
.admin-body textarea {
    border-radius: 10px;
    border: 1px solid var(--line-2);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
}
.admin-body input::placeholder { color: rgba(185, 166, 214, 0.65); }
.admin-body input:focus, .admin-body select:focus, .admin-body textarea:focus {
    outline: 2px solid var(--violet);
    outline-offset: 1px;
}
.admin-body input[type=checkbox], .admin-body input[type=radio] { accent-color: var(--violet); width: 16px; height: 16px; }
table.data input[type=text], table.data input[type=color], table.data select { padding: 7px 9px; font-size: 0.9rem; }
table.data input[type=color] { width: 48px; height: 34px; padding: 2px; border-radius: 8px; cursor: pointer; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; }
.pill.admin  { background: rgba(181, 0, 255, 0.25); color: #E9C6FF; }
.pill.viewer { background: rgba(31, 133, 255, 0.22); color: #BEDCFF; }
.pill.off    { background: rgba(255, 255, 255, 0.10); color: var(--muted); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row input[type=range] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    cursor: pointer;
}
.slider-row input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 19px; height: 19px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--blue));
    border: 2px solid #fff;
    cursor: pointer;
}
.slider-row input[type=range]::-moz-range-thumb {
    width: 15px; height: 15px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--blue));
    border: 2px solid #fff;
    cursor: pointer;
}
.slider-row output { min-width: 46px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.dropzone {
    border: 2px dashed var(--line-2);
    border-radius: var(--radius);
    padding: 34px;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.hot { border-color: var(--violet); background: rgba(181, 0, 255, 0.08); }
.dropzone .big { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.dropzone .small { color: var(--muted); font-size: 0.86rem; }
.dropzone .filename { margin-top: 14px; font-weight: 600; color: var(--blue); }

/* =========================================================================
   THE WALLBOARD
   ========================================================================= */

body.wallboard {
    overflow: hidden;
    height: 100vh;
}
body.wallboard.scrollable { overflow: auto; height: auto; }

.wb {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: clamp(12px, 1.6vh, 26px) clamp(14px, 1.6vw, 30px);
    gap: clamp(10px, 1.4vh, 20px);
}
body.wallboard.scrollable .wb { height: auto; min-height: 100vh; }

.wb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.wb-head .period {
    font-size: clamp(0.8rem, 1.1vw, 1rem);
    color: var(--muted);
}
.wb-head .period strong { color: var(--text); font-size: clamp(1rem, 1.5vw, 1.35rem); display: block; }
.wb-clock {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.wb-clock .time { font-size: clamp(1.1rem, 1.9vw, 1.7rem); font-weight: 700; letter-spacing: 0.5px; }
.wb-clock .date { font-size: clamp(0.7rem, 0.9vw, 0.85rem); color: var(--muted); }

/* --- team totals strip ---------------------------------------------------- */
.team-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: clamp(8px, 1vw, 16px);
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: clamp(10px, 1.2vh, 16px) clamp(14px, 1.4vw, 22px);
}
.team-bar .cell { text-align: center; }
.team-bar .cell .k {
    font-size: clamp(0.62rem, 0.72vw, 0.76rem);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    margin-bottom: 2px;
}
.team-bar .cell .v {
    font-size: clamp(1.15rem, 2.1vw, 2rem);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.team-bar .cell .v.voice { color: #D9A6FF; }
.team-bar .cell .v.data  { color: #A6CCFF; }
.team-bar .cell .v.other { color: var(--muted); }

/* --- the agent grid ------------------------------------------------------- */
.agent-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: clamp(10px, 1.2vw, 20px);
    min-height: 0;
}
body.wallboard.scrollable .agent-grid { grid-auto-rows: minmax(300px, auto); }

.agent {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: var(--radius);
    padding: clamp(12px, 1.5vh, 22px) clamp(14px, 1.2vw, 22px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
        var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.agent::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--agent-colour, var(--violet));
}

/* MVP treatment */
.agent.mvp {
    background:
        linear-gradient(150deg, rgba(181, 0, 255, 0.30), rgba(31, 133, 255, 0.22)),
        var(--purple);
    border-color: rgba(233, 198, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(233, 198, 255, 0.35), 0 22px 50px rgba(181, 0, 255, 0.28);
}
.agent.mvp::before { background: linear-gradient(90deg, var(--violet), var(--blue)); height: 5px; }

.agent-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: clamp(8px, 1.2vh, 16px);
}
.agent-name .first {
    font-size: clamp(1.3rem, 2.4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.01em;
}
.agent-name .last {
    font-size: clamp(0.72rem, 0.95vw, 1rem);
    color: var(--muted);
    margin-top: 2px;
}
.agent-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.rank {
    font-size: clamp(0.7rem, 0.95vw, 0.95rem);
    font-weight: 800;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 11px;
    font-variant-numeric: tabular-nums;
}
.agent.mvp .rank { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

.mvp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: clamp(0.66rem, 0.85vw, 0.85rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 5px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #FFD86B, #FF9A3C);
    color: #3A1C00;
    box-shadow: 0 6px 18px rgba(255, 154, 60, 0.35);
    white-space: nowrap;
}

/* headline total */
.total-block { margin-bottom: clamp(8px, 1.2vh, 14px); }
.total-block .n {
    font-size: clamp(2.2rem, 5.2vw, 4.6rem);
    font-weight: 800;
    line-height: 0.95;
    font-variant-numeric: tabular-nums;
}
.total-block .k {
    font-size: clamp(0.62rem, 0.8vw, 0.78rem);
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--muted);
    margin-top: 4px;
}

/* the subtle comparison against the team average */
.gauge { margin-top: 7px; }
.gauge .track {
    position: relative;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    overflow: visible;
}
.gauge .fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 999px;
    background: var(--agent-colour, var(--violet));
    opacity: 0.85;
}
.agent.mvp .gauge .fill { background: linear-gradient(90deg, #FFD86B, #FF9A3C); }
.gauge .avg-mark {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 2px;
}
.gauge .avg-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -3px;
    width: 5px; height: 5px;
    transform: translateX(-50%) rotate(45deg);
    background: rgba(255, 255, 255, 0.85);
}
.gauge .cap {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    font-size: clamp(0.6rem, 0.75vw, 0.76rem);
    color: var(--muted);
}
.gauge .cap .delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge .cap .delta.up   { color: var(--good); }
.gauge .cap .delta.down { color: var(--bad); }
.gauge .cap .delta.flat { color: var(--muted); }

/* voice / data / other split */
/* Everything below the headline total sits at the bottom of the block, so
   blocks of different heights still line up with each other. */
.agent-foot { margin-top: auto; }

.splits {
    display: grid;
    grid-template-columns: repeat(var(--split-cols, 3), minmax(0, 1fr));
    gap: clamp(8px, 0.9vw, 14px);
    padding-top: clamp(8px, 1.1vh, 14px);
    border-top: 1px solid var(--line);
}
.split .k {
    font-size: clamp(0.58rem, 0.72vw, 0.72rem);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}
.split .n {
    font-size: clamp(1.1rem, 2.1vw, 1.9rem);
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.split .n.voice { color: #E2BBFF; }
.split .n.data  { color: #B7D6FF; }
.split .n.other { color: #CFC3E4; }

/* resolve time row */
.resolve {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: clamp(8px, 1.1vh, 14px);
    padding-top: clamp(8px, 1.1vh, 14px);
    border-top: 1px solid var(--line);
}
.resolve .k {
    font-size: clamp(0.58rem, 0.72vw, 0.72rem);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}
.resolve .n {
    font-size: clamp(1rem, 1.8vw, 1.6rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.resolve .delta { font-size: clamp(0.6rem, 0.78vw, 0.78rem); font-weight: 700; }
.resolve .delta.up   { color: var(--good); }
.resolve .delta.down { color: var(--bad); }
.resolve .delta.flat { color: var(--muted); }

/* Compact mode: switched on automatically when six blocks would not
   otherwise fit on the screen (a laptop, or a smaller wall screen). The
   numbers stay; the small print under the Voice/Data bars is dropped, and the
   tick mark showing the team average stays on every bar. */
.agent-grid.compact .agent { padding: clamp(8px, 1vh, 15px) clamp(10px, 1vw, 16px); }
.agent-grid.compact .agent-head { margin-bottom: 6px; }
.agent-grid.compact .agent-name .first { font-size: clamp(1.05rem, 1.8vw, 1.7rem); }
.agent-grid.compact .agent-name .last { font-size: clamp(0.66rem, 0.8vw, 0.85rem); }
.agent-grid.compact .total-block .n { font-size: clamp(1.7rem, 3.3vw, 3rem); }
.agent-grid.compact .split .n { font-size: clamp(0.95rem, 1.5vw, 1.35rem); }
.agent-grid.compact .resolve .n { font-size: clamp(0.9rem, 1.4vw, 1.3rem); }
.agent-grid.compact .splits .gauge .cap { display: none; }
.agent-grid.compact .splits .gauge { margin-top: 4px; }
.agent-grid.compact .total-block { margin-bottom: 5px; }
.agent-grid.compact .total-block .gauge { margin-top: 5px; }
.agent-grid.compact .splits,
.agent-grid.compact .resolve { padding-top: 7px; margin-top: 7px; }
body.wallboard.tight .wb { gap: clamp(7px, 0.9vh, 14px); padding: clamp(8px, 1vh, 20px) clamp(10px, 1.2vw, 26px); }
body.wallboard.tight .team-bar { padding: clamp(7px, 0.8vh, 12px) clamp(12px, 1.2vw, 18px); }
body.wallboard.tight .team-bar .cell .v { font-size: clamp(1rem, 1.7vw, 1.6rem); }

.wb-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    font-size: clamp(0.65rem, 0.8vw, 0.8rem);
    color: var(--muted);
    flex-wrap: wrap;
}
.wb-foot a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.wb-foot a:hover { color: var(--text); }

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    color: var(--muted);
}
.empty-state h2 { color: var(--text); margin: 0; font-size: 1.4rem; }

/* Narrow screens: stop trying to fit everything on one screen. */
@media (max-width: 720px) {
    body.wallboard { overflow: auto; height: auto; }
    .wb { height: auto; }
    .agent-grid { grid-template-columns: 1fr; }
    .agent { min-height: 240px; }
}

@media print {
    body { background: #fff; color: #000; }
}
