/* Alpha Attendance kiosk: built for a Surface tablet in landscape, operated by touch.
   Colours follow MembersCorner (Styles/app.css + its Tailwind blue/gray palette). */
:root {
    /* MembersCorner theme tokens */
    --background: #f9fafb;          /* gray-50 page */
    --foreground: #1f2937;          /* gray-800 */
    --card: #ffffff;
    --muted-foreground: #6b7280;    /* gray-500 */
    --border: #e5e7eb;              /* gray-200 */
    --border-soft: #f3f4f6;         /* gray-100 */
    --input-background: #f3f3f5;
    --destructive: #d4183d;
    --radius: 0.625rem;

    /* Blue brand scale */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;

    /* Kiosk roles */
    --primary: var(--blue-600);
    --primary-hover: var(--blue-700);
    --primary-ink: #ffffff;
    --secondary: #ffffff;
    --secondary-ink: #374151;       /* gray-700 */
    --tile: #ffffff;
    --tile-on: var(--blue-50);
    --tile-on-border: var(--blue-400);
    --alert: #dc2626;               /* red-600 */
    --alert-bg: #fef2f2;            /* red-50 */
    --alert-border: #fecaca;        /* red-200 */
}

/* Staff screens: the same palette on a dark blue background so they stand apart from student check-in. */
body.theme-staff {
    --background: #111827;          /* gray-900 */
    --foreground: #f9fafb;
    --card: #1f2937;                /* gray-800 */
    --muted-foreground: #9ca3af;    /* gray-400 */
    --border: #374151;              /* gray-700 */
    --border-soft: #374151;
    --input-background: #111827;
    --secondary: #374151;
    --secondary-ink: #f9fafb;
    --tile: #374151;
    --alert: #f87171;               /* red-400 */
    --alert-bg: transparent;
    --alert-border: #7f1d1d;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
}

body {
    background: var(--background);
    color: var(--foreground);
    font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
    font-size: 22px;
    /* Touch kiosk: no double-tap zoom, no accidental text selection or long-press callouts. */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    flex-direction: column;
}

input { user-select: text; -webkit-user-select: text; }

/* Header: MembersCorner's "bg-gradient-to-r from-blue-700 to-blue-900/90 text-white shadow-lg" */
.kiosk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: linear-gradient(to right, var(--blue-700), rgb(30 58 138 / 0.9));
    color: #fff;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.brand { position: relative; display: flex; align-items: center; gap: 12px; color: inherit; }
.brand img { width: 48px; height: 48px; cursor: pointer; }
/* Kiosk menu: opened by double-clicking the logo. */
.kiosk-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-width: 260px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.15), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.kiosk-menu button {
    min-height: 56px;
    padding: 8px 16px;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--foreground);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.kiosk-menu button:active { background: var(--tile-on); }
.kiosk-menu button[disabled] { opacity: 0.4; cursor: default; }
.brand-name { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 0.8rem; color: var(--blue-100); }
.clock { font-size: 1.2rem; font-weight: 600; color: var(--blue-100); }
.header-right { display: flex; align-items: center; gap: 20px; }
/* MembersCorner's header button: "text-white hover:bg-blue-800 rounded-md" */
.btn-fullscreen {
    min-height: 48px;
    padding: 8px 18px;
    border: 1px solid rgb(219 234 254 / 0.5);
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}
.btn-fullscreen:active { background: var(--blue-800); }
[hidden] { display: none !important; }

/* Full-screen shell: the kiosk runs in this frame so page changes don't end full screen. */
.kiosk-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 2147483647;
    background: var(--background);
}

.kiosk-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* "safe": a screen taller than the tablet scrolls from its top instead of being clipped under the header */
    justify-content: safe center;
    padding: 16px;
    gap: 16px;
    overflow-y: auto;
}

/* Card: MembersCorner's "bg-white rounded-xl border border-gray-100 shadow-sm" */
.panel {
    width: min(100%, 960px);
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: calc(var(--radius) + 4px);
    padding: 32px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.center { text-align: center; }
.huge { font-size: 2.6rem; margin: 0 0 12px; color: var(--foreground); }
.large { font-size: 1.6rem; margin: 12px 0; }
h1, h2 { color: var(--foreground); }
h2 { font-size: 1.8rem; margin: 12px 0; }
.warn { color: var(--muted-foreground); }
.alert {
    color: var(--alert);
    background: var(--alert-bg);
    border: 1px solid var(--alert-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 1.5rem;
}

.choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    min-width: 160px;
    padding: 12px 32px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.4; }
.btn-xl { min-height: 110px; min-width: 260px; font-size: 2.2rem; }
/* Primary action (YES / ENTER / NEXT / LOG IN): MembersCorner's blue-600 button */
.btn-yes { background: var(--primary); color: var(--primary-ink); }
.btn-yes:active { background: var(--primary-hover); }
/* Secondary (NO / GO BACK): white outlined button */
.btn-no, .btn-back {
    background: var(--secondary);
    color: var(--secondary-ink);
    border-color: var(--border);
}
.btn-back { margin-top: 16px; }
/* Low-key on purpose: staff know where it is, students shouldn't be drawn to it. */
.btn-staff {
    background: transparent;
    color: #9ca3af;                 /* gray-400 */
    border-color: #e5e7eb;          /* gray-200 */
    min-height: 56px;
    font-size: 1.1rem;
    font-weight: 500;
    align-self: center;
}
.btn-staff:active { background: #f3f4f6; color: #6b7280; }

/* ID entry and keypad */
.id-form { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.field { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted-foreground); }
.id-input {
    width: 320px;
    font-size: 2.4rem;
    text-align: center;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--input-background);
    color: var(--foreground);
}
.id-input:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgb(96 165 250 / 0.35); }
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 96px);
    gap: 12px;
}
.key {
    height: 80px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--tile);
    color: var(--foreground);
    font: inherit;
    font-size: 2rem;
    font-weight: 600;
}
.key:active { background: var(--tile-on); border-color: var(--tile-on-border); }
.key-enter { background: var(--primary); border-color: var(--primary); color: #fff; font-size: 1.2rem; }
.key-enter:active { background: var(--primary-hover); }

/* Name picker */
.letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }
.letter {
    width: 64px; height: 64px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--tile); color: var(--foreground);
    font: inherit; font-size: 1.6rem; font-weight: 700;
}
.letter.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.name-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 52vh;
    overflow-y: auto;
}
.name {
    display: flex; align-items: center; justify-content: center;
    min-height: 72px; padding: 8px;
    border: 1px solid var(--blue-100);
    border-radius: var(--radius);
    background: var(--blue-50); color: var(--blue-700);
    text-decoration: none; font-weight: 600;
}
.name:active { background: var(--blue-100); }
.name[hidden] { display: none; }

/* "Is this you?" */
.who { display: flex; justify-content: center; align-items: center; gap: 24px; }
.photo { height: 200px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); }
.birthday { height: 200px; }
.invited {
    background: #fffbeb;            /* amber-50 */
    color: #b45309;                 /* amber-700 */
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 12px;
}
.already { color: var(--alert); }
.already ul, .review-list { list-style: none; padding: 0; font-size: 1.4rem; }
.review-list { color: var(--blue-700); font-weight: 600; }

/* Class tiles */
.class-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; text-align: left; }
.class-tile {
    display: flex; align-items: center; gap: 20px;
    min-height: 80px; padding: 12px 20px;
    border: 2px solid var(--border); border-radius: calc(var(--radius) + 4px);
    background: var(--tile);
    font-size: 1.5rem;
    cursor: pointer;
}
.class-tile input { width: 40px; height: 40px; accent-color: var(--primary); }
.class-tile .time { font-weight: 700; min-width: 120px; color: var(--blue-700); }
.class-tile .tag { margin-left: auto; font-size: 1rem; color: var(--muted-foreground); }
.class-tile:has(input:checked:not(:disabled)) { border-color: var(--tile-on-border); background: var(--tile-on); }
.class-tile.done { opacity: 0.55; cursor: default; }

body.theme-staff .class-tile .time,
body.theme-staff .review-list { color: var(--blue-300); }

/* Windows display scaling: the kiosk tablet runs at 150%, which shrinks the CSS viewport to 2/3 of the
   panel's pixels and pushes the UI off screen. Scale the whole page back down so it is laid out as it
   would be at 100%. Zoom goes on body, not html, so body's height: 100% still fills the real viewport. */
@media (min-resolution: 1.5dppx) {
    body { zoom: 0.6667; }
    /* zoom also scales vh, so restore the name grid to ~52% of the real screen height */
    .name-grid { max-height: 78vh; }
}

@media (max-width: 700px) {
    body { font-size: 18px; }
    .panel { padding: 20px; }
    .btn-xl { min-width: 200px; min-height: 90px; font-size: 1.8rem; }
}
