@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #0a1b18;
    --panel: #123430;
    --panel-soft: #163d38;
    --accent: #1fa187;
    --accent-deep: #0e5f51;
    --accent-bright: #37c9ab;
    --lime: #c7e24a;
    --lime-deep: #7f9420;
    --ink: #f3f6f4;
    --ink-dim: #9fbab3;
    --line: #28524a;
    --radius: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", system-ui, sans-serif;
}

input::placeholder {
    user-select: none;
}

/* ---------- Printed pass (unchanged in print media, styled quietly on screen) ---------- */

#studentName {
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: clamp(20px, 4vh, 44px);
    font-weight: 600;
    font-style: normal;
    letter-spacing: 0.01em;
    color: var(--ink);
    display: block;
    padding: 4px 4px 10px;
    flex: 0 0 auto;
}

/* ---------- Big action buttons ---------- */

.bigbutton {
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-weight: 600;
    font-style: normal;
    letter-spacing: 0.01em;

    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    width: 100%;
    border: none;
    cursor: pointer;
    background-color: var(--accent-deep);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 20px;
    line-height: 1.15;
    transition: background-color 0.15s ease-in-out, transform 0.05s ease-in-out;

    /* Fills an equal share of whatever vertical room is left in #buttons,
       and its own text scales with viewport height instead of the button
       overflowing the screen -- this is what keeps all six buttons (plus
       the camera preview, when it's open) on one page with no scrolling. */
    flex: 1 1 0;
    min-height: 0;
    font-size: clamp(14px, 4.4vh, 42px);
}

.bigbutton:active {
    transform: scale(0.99);
}

button img {
    width: 100%;
    border-radius: 10px;
}

button:hover {
    background-color: var(--accent);
    color: #06231e;
}

#buttons {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 18px;
    gap: 8px;
    box-sizing: border-box;
}

#pass {
    display: none;
}

#logo {
    width: 150px;
}

/* ---------- Camera-on button: a secondary/utility toggle, not a primary
   action, so it stays fixed-size and muted instead of growing with the
   others and instead of the bright lime call-out it had before. ---------- */

#buttonPreview {
    flex: 0 0 auto;
    background-color: var(--panel-soft);
    color: var(--ink-dim);
    border: 1px solid var(--line);
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
}

#buttonPreview:hover {
    background-color: var(--accent-deep);
    color: var(--ink);
    border-color: var(--accent);
}

/* JS toggles this to display:flex. flex-wrap + the widths below force the
   video (live feed) and canvas (what actually prints) onto their own row,
   with the name/pass inputs wrapping to a clear row underneath instead of
   overlapping either feed. */
#preview_video {
    display: none;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    width: 100%;
    margin-bottom: 8px;
    background: #06120f;
    flex: 0 1 auto;
}

#video,
#canvas {
    background: #000;
    width: calc(50% - 5px);
    height: min(210px, 26vh);
    border-radius: 6px;
    flex-shrink: 0;
}

#video {
    object-fit: cover;
}

#text-entry {
    flex: 1 1 100%;
    margin-left: 0;
    margin-top: 6px;
    display: flex;
    gap: 12px;
}

@media (max-width: 620px) {
    #video,
    #canvas {
        width: 100%;
        height: 180px;
    }

    #text-entry {
        flex-direction: column;
    }
}

/* ---------- Print styles for the physical pass ---------- */

@media print {

    html,
    body {
        background: white;
        color: black;
        font-family: "Courier New", ui-monospace, "SFMono-Regular", monospace;
        height: auto !important;
        overflow: visible;
    }

    /* Reset the on-screen font weight/decoration everywhere in print --
       everything prints bold and large so it's legible on thermal paper. */
    * {
        margin: 0;
        padding: 0;
        font-weight: 900 !important;
        text-shadow: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    @page {
        margin-bottom: 0;
    }

    #pass_page,
    #month_picker,
    #floatingWindow {
        display: none !important;
        height: 0px;
    }

    #pass {
        border: 0px solid gray;
        text-align: center;
        display: block;
        width: 300px;
        margin: 0 auto;
        padding: 10px 6px 16px;
    }

    /* "Palumbo" header -- the biggest line on the pass */
    #pass>h2:first-child {
        font-size: 2.4em;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        margin-bottom: 8px !important;
    }

    #logo {
        width: 100px;
        text-align: left;
        margin: 0 auto 6px !important;
        display: block;
    }

    #photo {
        width: 130px;
        height: auto;
        margin: 4px auto !important;
        display: block;
        filter: grayscale(1);
    }

    /* Student name is the one thing a hall monitor actually needs to check
       at a glance, so it's the single deliberate point of emphasis. */
    h3#studentname {
        font-size: 2em;
        font-weight: 900 !important;
        margin: 8px 0 !important;
    }

    /* Pass type, set off like a receipt line item */
    #passtext {
        font-size: 1.5em;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        border-top: 1px dashed black;
        border-bottom: 1px dashed black;
        padding: 8px 0 !important;
        margin: 10px 0 !important;
    }

    #txtcontainer {
        display: block;
        text-align: left;
        margin-top: 8px;
    }

    .text p {
        font-size: 1.3em;
        width: auto;
        text-align: left;
        margin: 4px 0 !important;
    }

    #wiessmannsig {
        height: 22px;
        display: block;
        margin: 6px 0 0 auto !important;
    }
}

#photo {
    width: 180px;
    height: 105px;
    border-radius: 14px;
}

#color_photo {
    display: none;
}

#signature {
    height: 30px;
}

#wiessmannsig {
    display: block;
    margin-left: auto;
    margin-right: 0;
    height: 30px;
}

#wiessmannpic {
    width: 90px;
    border-radius: 100%;
    text-align: left;
}

#txtcontainer {
    display: flex;
    align-items: flex-start;
}

/* ---------- Floating settings window ---------- */

/* ---------- Floating settings window ---------- */

#floatingWindow {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: auto;
    display: flex;
    flex-direction: column;
    background-color: rgba(18, 52, 48, 0.94);
    backdrop-filter: blur(6px);
    border: 1px solid var(--accent);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    transition: background-color 0.2s ease-in-out;
    color: var(--ink);
    font-family: "Inter", system-ui, sans-serif;
    font-size: 14px;
}

#floatingWindow:hover {
    background-color: rgba(18, 52, 48, 1);
}

#floatingWindow .header {
    cursor: move;
    height: 38px;
    flex-shrink: 0;
    background-color: var(--accent-deep);
    color: var(--ink);
    border-radius: 9px 9px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px 0 14px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.fw-minimize {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    color: var(--ink);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.fw-minimize:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Collapses the body without changing the window's width, and without
   touching top/left so it stays exactly where it was dragged to. */
#floatingWindowBody {
    overflow: hidden;
    max-height: 400px;
    padding-bottom: 14px;
    opacity: 1;
    transition: max-height 0.18s ease, opacity 0.18s ease, padding-bottom 0.18s ease;
}

#floatingWindow.minimized #floatingWindowBody {
    max-height: 0;
    padding-bottom: 0;
    opacity: 0;
}

#floatingWindow.minimized .header {
    border-radius: 9px;
}

#floatingWindowBody > * {
    margin: 10px 16px 0;
}

#settings {
    height: 100%;
    overflow-y: auto;
}

p.settings-item {
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-dim);
    font-family: "SF Mono", "Consolas", monospace;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container label {
    font-size: 13px;
    color: var(--ink-dim);
    white-space: nowrap;
}

#lightness {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    outline: none;
}

#lightness::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--accent-bright);
    border: 2px solid var(--ink);
    cursor: pointer;
}

#lightness::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--accent-bright);
    border: 2px solid var(--ink);
    cursor: pointer;
}

#lightnessValue {
    font-size: 13px;
    color: var(--ink-dim);
    width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#populatenames {
    align-self: flex-start;
    background: var(--accent);
    color: #06231e;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

#populatenames:hover {
    background: var(--lime);
    color: #172000;
}

#signature {
    align-self: flex-end;
    height: 26px;
    background: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
}

#pass_page {
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#text-entry {
    margin-left: auto;
}

.top-setting {
    display: block;
    background: var(--ink);
    color: #0a1b18;
    font-size: 24px;
    font-weight: 600;
    font-style: normal;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    width: 100%;
}

.top-setting:focus {
    outline: 2px solid var(--lime);
}
