/* ==========================================================================
   NetSec Shift Planner - stylesheet
   Team colours are CSS variables: change them in :root to re-theme the app.
   Team classes come from the team code in the database: team-netops / team-secops
   ========================================================================== */

:root {
    /* neutrals */
    --bg:       #f1f5f9;
    --surface:  #ffffff;
    --ink:      #0f172a;
    --muted:    #64748b;
    --line:     #e2e8f0;
    --navy:     #0f172a;

    /* TOP BANNER (logo + menu): change these 4 values to re-colour it.
       Dark alternative: --topbar:#0f172a; --topbar-ink:#ffffff; --topbar-muted:#cbd5e1; --topbar-hover:rgba(255,255,255,.12) */
    --topbar:        #f8fafc;                 /* background */
    --topbar-ink:    #0f172a;                 /* app name */
    --topbar-muted:  #475569;                 /* menu links */
    --topbar-hover:  rgba(15, 23, 42, .07);   /* menu link hover background */

    /* NetOps = blue   (AM slightly darker than PM) */
    --netops:      #2563eb;
    --netops-ink:  #1e3a8a;
    --netops-am:   #bfdbfe;
    --netops-pm:   #dbeafe;

    /* SecOps = orange (AM slightly darker than PM) */
    --secops:      #ea580c;
    --secops-ink:  #7c2d12;
    --secops-am:   #fed7aa;
    --secops-pm:   #ffedd5;

    --danger:  #b91c1c;
    --ok:      #15803d;
    --warn:    #b45309;
    --radius:  12px;
    --shadow:  0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.container { width: min(1100px, 100% - 32px); margin-inline: auto; }
a { color: var(--netops); }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }

/* ---------- top bar ---------- */
.topbar { background: var(--topbar); color: var(--topbar-ink); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--topbar-ink); text-decoration: none; }
.brand-text { font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }
.topnav { display: flex; gap: 6px; }
.topnav a { color: var(--topbar-muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; }
.topnav a:hover { background: var(--topbar-hover); color: var(--topbar-ink); }

main.container { padding: 24px 0 8px; }
.footer { color: var(--muted); font-size: .85rem; padding: 16px 0 32px; }

.page-head {
    display: flex; flex-wrap: wrap; gap: 12px 24px;
    align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

/* ---------- month picker ---------- */
.month-picker { display: flex; align-items: center; gap: 8px; }
.month-picker label { color: var(--muted); font-weight: 600; }
select, input[type=text], input[type=password] {
    font: inherit; color: inherit;
    padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff;
}
select:focus, input:focus { outline: 2px solid var(--netops); outline-offset: 1px; }

/* ---------- legend ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.legend-note { color: var(--muted); font-size: .85rem; margin-left: 6px; }
.chip { padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: .85rem; color: #fff; }
.chip.team-netops { background: var(--netops); }
.chip.team-secops { background: var(--secops); }

/* ---------- planning table ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }

table.planning th, table.planning td { padding: 9px 12px; text-align: center; }

.planning thead th { color: #fff; font-weight: 700; }
.planning .date-head { background: var(--navy); text-align: left; }
.planning .team-head.team-netops { background: var(--netops); }
.planning .team-head.team-secops { background: var(--secops); }
.planning .half-head { font-size: .8rem; letter-spacing: .05em; }
.planning .half-head.team-netops { background: var(--netops-ink); }
.planning .half-head.team-secops { background: var(--secops-ink); }
.planning .team-head + .team-head,
.planning .slot.half-am.team-secops { border-left: 3px solid var(--surface); }

.planning .week-row td {
    background: #f8fafc; color: var(--muted); text-align: left;
    font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    padding: 5px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

.planning .date-cell { text-align: left; white-space: nowrap; background: var(--surface); }
.planning .dow { display: inline-block; width: 2.4em; font-weight: 700; }
.planning .dom { color: var(--muted); }
.planning .day-row + .day-row .slot,
.planning .day-row + .day-row .date-cell { border-top: 1px solid rgba(255, 255, 255, .85); }

.slot.team-netops.half-am { background: var(--netops-am); color: var(--netops-ink); }
.slot.team-netops.half-pm { background: var(--netops-pm); color: var(--netops-ink); }
.slot.team-secops.half-am { background: var(--secops-am); color: var(--secops-ink); }
.slot.team-secops.half-pm { background: var(--secops-pm); color: var(--secops-ink); }
.slot { font-weight: 500; }

.unassigned {
    display: inline-block; padding: 1px 10px; border-radius: 6px;
    border: 1px dashed var(--danger); color: var(--danger); background: rgba(255, 255, 255, .7);
    font-size: .85rem;
}

/* today */
.day-row.is-today .date-cell { box-shadow: inset 4px 0 0 var(--navy); background: #f8fafc; }
.day-row.is-today .dow, .day-row.is-today .dom { color: var(--ink); }
.today-badge {
    margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    background: var(--navy); color: #fff; font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
}

/* ---------- stats ---------- */
.stats { margin-top: 28px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stats-table { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stats-table th, .stats-table td { padding: 7px 12px; text-align: center; border-top: 1px solid var(--line); }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table thead th { color: #fff; border-top: 0; }
.stats-table.team-netops thead th { background: var(--netops); }
.stats-table.team-secops thead th { background: var(--secops); }

/* ---------- notices / flash ---------- */
.notice, .flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.notice { background: #fff; border: 1px dashed #94a3b8; color: var(--muted); }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error   { background: #fee2e2; color: #7f1d1d; }
.flash-warning { background: #fef3c7; color: #78350f; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 0; }

/* ---------- buttons / forms ---------- */
.btn {
    display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
    padding: 7px 14px; border-radius: 8px; text-decoration: none;
    background: #fff; color: var(--ink); border: 1px solid #cbd5e1;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: #1e293b; }
.btn-danger { color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fee2e2; }

.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.inline-form label { color: var(--muted); font-weight: 600; }
form.inline { display: inline; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-top: 20px; }
.savebar { position: sticky; bottom: 0; padding: 12px 0; margin-top: 12px; background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ---------- admin: tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
    padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 600;
    border-radius: 8px 8px 0 0; margin-bottom: -2px; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--navy); background: var(--surface); }

/* admin: editable planning grid */
.shift-select { width: 100%; min-width: 140px; padding: 5px 6px; font-size: .9rem; background: rgba(255, 255, 255, .85); }

/* admin: engineers table */
.team-title { padding-left: 12px; border-left: 6px solid; margin-top: 24px; }
.team-title.team-netops { border-color: var(--netops); }
.team-title.team-secops { border-color: var(--secops); }
.avail th, .avail td { padding: 6px 8px; text-align: center; border-top: 1px solid var(--line); }
.avail thead th { color: #fff; border-top: 0; }
.avail.team-netops thead th { background: var(--netops); }
.avail.team-secops thead th { background: var(--secops); }
.avail .half-head { font-size: .75rem; opacity: .9; }
.avail .left { text-align: left; }
.avail .left input[type=text] { width: 100%; min-width: 170px; }
.avail td.day-end, .avail th.day-group { border-right: 1px solid var(--line); }
.avail input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }
.avail tr.is-inactive td { background: #f8fafc; color: var(--muted); }

/* admin: months list */
.list th, .list td { padding: 9px 12px; text-align: center; border-top: 1px solid var(--line); }
.list thead th { border-top: 0; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.list .left { text-align: left; }
.list .actions { text-align: right; white-space: nowrap; }
.badge { padding: 1px 9px; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.badge-warn { background: #fef3c7; color: var(--warn); }

/* ---------- login ---------- */
.login-box { max-width: 360px; margin: 40px auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.login-box h1 { margin-bottom: 16px; }
.login-box label { display: block; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.login-box input { width: 100%; margin-bottom: 14px; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
    .brand-text { font-size: .95rem; }
    table.planning th, table.planning td { padding: 7px 8px; font-size: .88rem; }
    .planning .dow { width: 2.1em; }
}

/* ---------- print: planning on paper ---------- */
@media print {
    .topbar, .month-picker, .footer, .savebar, .topnav { display: none; }
    body { background: #fff; }
    .table-wrap, .stats-table { box-shadow: none; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
