/* ORCSGirls Admin — shared stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Open+Sans:wght@400;600&display=swap');

:root {
    --p:  #4a148c; --p2: #6a1fa2; --p-pale: #f3e5f5;
    --teal: #0097a7; --teal-pale: #e0f7fa;
    --green: #00873c; --green-pale: #e8f5e9;
    --mag: #c2185b; --mag-pale: #fce4ec;
    --orange: #e65100;
    --text: #1a1a2e; --muted: #6b5f7a;
    --bg: #f5f3f8; --card: #fff; --border: #e0d8f0;
    --r: 10px; --rs: 6px;
}
html[data-theme="dark"] {
    --text: #e8e0f8; --muted: #9b8fb8; --bg: #120d20; --card: #1e1630; --border: #2d1f4a;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Open Sans', system-ui, sans-serif; background: var(--bg); color: var(--text);
       margin: 0; line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }
html[data-theme="dark"] body { background: #0d0920; }
main { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; width: 100%; }
main.container { padding-top: 28px; padding-bottom: 40px; }

/* ── Header ── */
.site-header { background: var(--p); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.site-header .container { display: flex; align-items: center; gap: 12px; height: 56px; }
.nav-logo { height: 36px; width: auto; }
.header-divider { width: 1px; height: 28px; background: rgba(255,255,255,.3); flex-shrink: 0; }
.header-title { color: #fff; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1rem; white-space: nowrap; }
.header-spacer { flex: 1; }

/* ── Nav ── */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { color: rgba(255,255,255,.75); text-decoration: none; padding: 4px 10px; border-radius: 6px;
               font-size: .82rem; font-weight: 600; transition: all .12s; }
.admin-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.admin-nav a.active { background: rgba(255,255,255,.22); color: #fff; }

/* ── Theme switch ── */
.theme-switch { display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.theme-switch input { display: none; }
.switch-icon { font-size: .9rem; }
.switch-track { width: 36px; height: 20px; background: rgba(255,255,255,.25); border-radius: 10px; position: relative; transition: background .25s; flex-shrink: 0; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: transform .25s; }
.theme-switch input:checked ~ .switch-track { background: rgba(255,255,255,.45); }
.theme-switch input:checked ~ .switch-track .switch-knob { transform: translateX(16px); }

/* ── Panel / card ── */
.panel { background: var(--card); border-radius: var(--r); box-shadow: 0 2px 12px rgba(0,0,0,.08); padding: 20px; border-top: 4px solid var(--teal); margin-bottom: 16px; }
.panel-purple { border-top-color: var(--p); }
.panel-green  { border-top-color: var(--green); }
.panel-mag    { border-top-color: var(--mag); }
h2 { font-family: 'Montserrat', sans-serif; font-size: 1.3rem; color: var(--p); margin: 0 0 16px; }
html[data-theme="dark"] h2 { color: var(--text); }
h3 { font-family: 'Montserrat', sans-serif; font-size: 1rem; color: var(--p); margin: 0 0 10px; }
html[data-theme="dark"] h3 { color: var(--text); }

/* ── Stats bar ── */
.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-pill { background: var(--bg); border-radius: 40px; padding: 5px 14px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.stat-pill span { color: var(--teal); font-family: 'Montserrat', sans-serif; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
th { background: var(--p); color: #fff; padding: 10px 12px; text-align: left;
     font-family: 'Montserrat', sans-serif; font-size: .73rem; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
html[data-theme="dark"] tr:hover td { background: rgba(255,255,255,.03); }
.hidden-row td { opacity: .6; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-live    { background: #d4f0e0; color: #005a20; }
.badge-hidden  { background: #f0e8f8; color: #4a148c; }
.badge-content { background: #fce4ec; color: #880e2f; }
.badge-error   { background: #fff3cd; color: #7a4a00; }
.badge-active  { background: #d4f0e0; color: #005a20; }
.badge-lobby   { background: #e0f7fa; color: #006064; }
.badge-running { background: #fff9c4; color: #5d4037; }
.badge-done    { background: #f0e8f8; color: #4a148c; }

/* ── Action buttons ── */
.act-btn { border: none; border-radius: 5px; padding: 4px 10px; font-size: .78rem; font-weight: 600;
           cursor: pointer; font-family: 'Open Sans', sans-serif; margin-right: 4px; transition: opacity .12s; }
.act-btn:hover { opacity: .8; }
.btn-view   { background: #e0f7fa; color: #006064; }
.btn-toggle { background: #f3e5f5; color: #4a148c; }
.btn-delete { background: #fce4ec; color: #880e2f; }
.btn-edit   { background: #e8f5e9; color: #005a20; }
.btn-start  { background: var(--teal); color: #fff; }

/* ── Form controls ── */
.field-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.field-input, .field-select, .field-textarea {
    border: 1.5px solid var(--border); border-radius: var(--rs); padding: 9px 11px;
    font-size: .9rem; font-family: 'Open Sans', sans-serif; color: var(--text);
    background: var(--card); width: 100%; outline: none; transition: border-color .12s;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--p); }
.field-textarea { resize: vertical; min-height: 70px; }
html[data-theme="dark"] .field-input,
html[data-theme="dark"] .field-select,
html[data-theme="dark"] .field-textarea { background: #1a1030; border-color: #3d2a6a; }

/* ── Primary / secondary buttons ── */
.btn-primary   { background: var(--p); color: #fff; border: none; border-radius: var(--rs); padding: 9px 20px;
                 font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .88rem; cursor: pointer; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--rs);
                 padding: 9px 20px; font-family: 'Open Sans', sans-serif; font-weight: 600; font-size: .88rem; cursor: pointer; }
.btn-teal      { background: var(--teal); color: #fff; border: none; border-radius: var(--rs); padding: 9px 20px;
                 font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .88rem; cursor: pointer; }
.btn-green     { background: var(--green); color: #fff; border: none; border-radius: var(--rs); padding: 9px 20px;
                 font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .88rem; cursor: pointer; }
.btn-danger    { background: var(--mag); color: #fff; border: none; border-radius: var(--rs); padding: 9px 20px;
                 font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .88rem; cursor: pointer; }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(60px);
         background: #1a1a2e; color: #fff; padding: 10px 22px; border-radius: 30px;
         font-size: .88rem; font-weight: 600; z-index: 9999; opacity: 0; transition: all .3s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
                  align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--card); border-radius: var(--r); width: 90%; max-width: 900px;
         max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-bar { background: var(--p); padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.modal-bar strong { flex: 1; font-family: 'Montserrat', sans-serif; color: #fff; font-size: .95rem; }
.modal-close { background: none; border: none; color: rgba(255,255,255,.75); cursor: pointer;
               padding: 4px 10px; border-radius: 5px; font-size: .88rem; }
.modal-close:hover { background: rgba(255,255,255,.15); }
.modal-iframe { flex: 1; width: 100%; border: none; background: #fff; }

/* ── Submissions bar ── */
.submissions-bar { border-radius: var(--rs); padding: 12px 16px; display: flex; align-items: center;
                   gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.submissions-bar.open   { background: var(--green-pale); border-left: 4px solid var(--green); }
.submissions-bar.closed { background: var(--mag-pale);   border-left: 4px solid var(--mag); }
html[data-theme="dark"] .submissions-bar.open   { background: #0a2a14; }
html[data-theme="dark"] .submissions-bar.closed { background: #2a0a14; }
.submissions-bar-text { flex: 1; min-width: 160px; }
.submissions-bar-label { font-weight: 700; font-size: .92rem; }
.submissions-bar-sub   { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.btn-submissions { border: none; border-radius: var(--rs); padding: 8px 16px;
                   font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.btn-open  { background: var(--green); color: #fff; }
.btn-close { background: var(--mag);   color: #fff; }

/* ── Code chips ── */
.code-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.code-chip { background: var(--p-pale); border-radius: 8px; padding: 8px 14px; display: flex;
             align-items: center; gap: 10px; }
.code-chip-val   { font-family: 'Montserrat', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--p); letter-spacing: .1em; }
.code-chip-label { font-size: .8rem; color: var(--muted); }
.code-chip-uses  { font-size: .75rem; background: var(--p); color: #fff; border-radius: 12px; padding: 1px 7px; }

/* ── Dashboard grid ── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.dash-card { background: var(--card); border-radius: var(--r); box-shadow: 0 2px 10px rgba(0,0,0,.07);
             padding: 20px; text-decoration: none; color: var(--text); border-left: 5px solid var(--teal);
             display: flex; flex-direction: column; gap: 6px; transition: transform .12s, box-shadow .12s; }
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.dash-card.dp { border-left-color: var(--p); }
.dash-card.dg { border-left-color: var(--green); }
.dash-card.dm { border-left-color: var(--mag); }
.dash-card.do { border-left-color: var(--orange); }
.dash-card-icon  { font-size: 1.6rem; }
.dash-card-num   { font-family: 'Montserrat', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--p); line-height: 1; }
.dash-card-label { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ── Footer ── */
footer { text-align: center; padding: 10px; font-size: .8rem; color: var(--muted);
         border-top: 1px solid var(--border); flex-shrink: 0; }
html[data-theme="dark"] footer { border-top-color: #2d1f4a; }

/* ── Hamburger nav (narrow viewports) ────────────────────────────────────── */
/* Hidden by default — only appears at narrow widths. Mirrors the play side's
   .nav-hamburger from style.css so the visual treatment matches. */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .22s, opacity .22s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 900px) {
    .nav-hamburger { display: flex; }
    .header-spacer { display: none; }

    /* Admin nav becomes a dropdown panel anchored to the header */
    .site-header .container { position: relative; flex-wrap: nowrap; }
    .admin-nav#nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--p);
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
        padding: 8px 12px 12px;
        flex-direction: column;
        gap: 4px;
        min-width: 180px;
        box-shadow: 0 8px 24px rgba(0,0,0,.3);
        z-index: 200;
    }
    .admin-nav#nav-links.open { display: flex; }
    .admin-nav#nav-links a { display: block; width: 100%; }

    /* Keep theme switch always visible after the hamburger */
    .theme-switch { order: 2; margin-left: 8px; }
    .nav-hamburger { order: 1; }
}
