/* ==========================================================================
   Kiosk Admin panel (admin.js)
   Large touch targets, UHMC palette, on-screen keyboard docked at the bottom.
   ========================================================================== */

/* The kiosk resets `user-select: none` everywhere; typing fields need it back */
.adm-overlay input,
.adm-overlay textarea,
.adm-overlay select {
  -webkit-user-select: text;
  user-select: text;
}

/* Hidden-attribute elements must stay hidden even though we set display below */
.adm-overlay [hidden] {
  display: none !important;
}

/* The logo badge is a hidden press-and-hold trigger */
#header-logo-badge {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* Custom info pages created from the Layout tab */
.custom-page-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-kiosk);
}

.custom-page-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--uhmc-primary);
  margin-bottom: 14px;
}

.custom-page-body p {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* ------------------------------------------------------------------ overlay */
.adm-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: none;
  flex-direction: column;
  background: #eef3f6;
  color: var(--text-primary);
  font-size: 15px;
}

.adm-overlay.open {
  display: flex;
}

.adm-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.adm-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

/* -------------------------------------------------------------------- login */
.adm-login {
  margin: auto;
  width: calc(100% - 40px);
  max-width: 440px;
  background: #ffffff;
  border: 2px solid var(--uh-gold);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 18px 40px rgba(0, 49, 60, 0.25);
}

.adm-login .adm-title {
  color: var(--uhmc-primary);
  margin-bottom: 6px;
}

.adm-pw-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.adm-login .adm-field + .adm-field {
  margin-top: 10px;
}

.adm-login-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.adm-error {
  min-height: 20px;
  margin-top: 8px;
  color: var(--uhmc-coral);
  font-weight: 700;
  font-size: 14px;
}

/* -------------------------------------------------------------------- panel */
.adm-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.adm-panel-head {
  background: var(--uhmc-primary);
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 3px solid var(--uh-gold);
}

.adm-head-top,
.adm-head-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.adm-who {
  color: #cfe3ee;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.adm-status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.adm-status.ok { background: rgba(120, 153, 4, 0.25); color: #d7f08a; }
.adm-status.pending { background: rgba(255, 182, 0, 0.25); color: #ffe08a; }
.adm-status.error { background: rgba(230, 63, 81, 0.3); color: #ffd0d5; white-space: normal; }

.adm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #dbe6ec;
  border-bottom: 1px solid var(--surface-border);
}

.adm-tab {
  flex: 1 1 calc(33% - 6px); /* 6 tabs wrap as 3 + 3 */
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1.5px solid var(--surface-border);
  font-weight: 700;
  font-size: 14px;
  color: var(--uhmc-primary);
}

.adm-tab.active {
  background: var(--uhmc-primary);
  border-color: var(--uhmc-primary);
  color: #ffffff;
}

.adm-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 28px;
  -webkit-overflow-scrolling: touch;
}

/* ----------------------------------------------------------------- sections */
.adm-section {
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--uhmc-primary);
}

.adm-h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--uhmc-navy);
  margin-top: 6px;
}

.adm-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
}

.adm-hint.strong {
  color: var(--text-dark);
  font-weight: 700;
}

.adm-empty {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 10px;
}

.adm-msg {
  font-size: 14px;
  font-weight: 700;
  min-height: 18px;
}

.adm-msg.ok { color: var(--uhmc-green); }
.adm-msg.error { color: var(--uhmc-coral); }

/* ------------------------------------------------------------------- fields */
.adm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.adm-field.grow {
  flex: 1 1 0;
}

.adm-row {
  display: flex;
  gap: 10px;
}

.adm-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.adm-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  background: #f8fbfd;
  border: 1.5px solid #b9cbd6;
  border-radius: var(--radius-md);
  outline: none;
}

textarea.adm-input {
  resize: vertical;
  line-height: 1.4;
}

.adm-input:focus {
  border-color: var(--uhmc-primary-light);
  box-shadow: 0 0 0 3px rgba(0, 108, 150, 0.2);
  background: #ffffff;
}

.adm-input.big {
  font-size: 18px;
  min-height: 52px;
}

.adm-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-weight: 700;
  font-size: 15px;
}

.adm-check-box {
  width: 26px;
  height: 26px;
  accent-color: var(--uhmc-primary);
  flex-shrink: 0;
}

.adm-file {
  font-size: 14px;
  padding: 6px 0;
}

/* ------------------------------------------------------------------ buttons */
.adm-btn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1.5px solid var(--uhmc-primary);
  color: var(--uhmc-primary);
  font-weight: 800;
  font-size: 15px;
}

.adm-btn:active { transform: scale(0.98); }
.adm-btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.adm-btn.primary { background: var(--uhmc-primary); color: #ffffff; }
.adm-btn.ghost { border-color: #b9cbd6; color: var(--text-dim); }
.adm-btn.add { border-style: dashed; background: #f3f9fc; flex: 1; }
.adm-btn.danger { border-color: var(--uhmc-coral); color: var(--uhmc-coral); }
.adm-btn.danger-outline { background: transparent; border-color: rgba(255, 255, 255, 0.7); color: #ffffff; }
.adm-btn.armed,
.adm-icon-btn.armed { background: var(--uhmc-coral); border-color: var(--uhmc-coral); color: #ffffff; }

.adm-icon-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1.5px solid #b9cbd6;
  color: var(--uhmc-primary);
  font-size: 15px;
  font-weight: 800;
}

.adm-icon-btn:disabled { opacity: 0.35; cursor: default; }
.adm-icon-btn.danger { border-color: var(--uhmc-coral); color: var(--uhmc-coral); }

.adm-add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.adm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.adm-pill {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1.5px solid var(--surface-border);
  font-weight: 700;
  font-size: 14px;
  color: var(--uhmc-primary);
}

.adm-pill.active {
  background: var(--uh-gold);
  border-color: var(--uh-gold);
  color: #3a2a00;
}

/* -------------------------------------------------------------------- cards */
.adm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-card {
  border: 1.5px solid #c8d8e1;
  border-radius: var(--radius-md);
  background: #fbfdfe;
  overflow: hidden;
}

.adm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #e6eff4;
}

.adm-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--uhmc-navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.adm-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.adm-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ----------------------------------------------------------------- keyboard */
.adm-kbd {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px 8px 10px;
  background: #1c2b34;
  border-top: 3px solid var(--uh-gold);
}

.adm-overlay.kbd-open .adm-kbd {
  display: flex;
}

.adm-kbd-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.adm-key {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  border-radius: 8px;
  background: #3a4d59;
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
}

.adm-key:active { background: var(--uh-gold); color: #1c2b34; }
.adm-key.wide { flex: 1.5 1 0; font-size: 15px; }
.adm-key.space { flex: 4 1 0; font-size: 14px; }
.adm-key.active { background: var(--uh-gold); color: #1c2b34; }

/* ----------------------------------------------------------- event calendar */
.adm-cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-cal-month {
  flex: 1;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--uhmc-navy);
}

.adm-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.adm-cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 0;
}

.adm-cal-day {
  position: relative;
  min-height: 48px;
  border-radius: var(--radius-md);
  background: #f8fbfd;
  border: 1.5px solid #d3e0e7;
  font-size: 16px;
  font-weight: 700;
  color: var(--uhmc-primary);
}

.adm-cal-day.out { opacity: 0.45; }
.adm-cal-day.today { border-color: var(--uh-gold); box-shadow: inset 0 0 0 1.5px var(--uh-gold); }
.adm-cal-day.selected { background: var(--uhmc-primary); border-color: var(--uhmc-primary); color: #ffffff; opacity: 1; }

.adm-cal-count {
  position: absolute;
  top: 3px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--uh-gold);
  color: #3a2a00;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.adm-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.adm-time-row {
  display: flex;
  gap: 6px;
}

.adm-time-row .adm-input {
  padding-left: 8px;
  padding-right: 4px;
}

/* ------------------------------------------------------------ photo picker */
.adm-photo-preview {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-md);
  border: 1.5px solid #b9cbd6;
  background-color: var(--uhmc-primary-dark, #00313c);
  background-size: cover;
  background-position: center;
}

.adm-photo-preview.empty {
  background-image: repeating-linear-gradient(45deg, #e6eff4, #e6eff4 10px, #f3f9fc 10px, #f3f9fc 20px) !important;
}

/* ==========================================================================
   Theme alignment with the kiosk frontend (header, cards, pills, keyboard)
   ========================================================================== */
.adm-overlay {
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 108, 150, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 90% 92%, rgba(255, 182, 0, 0.14) 0%, transparent 45%),
    var(--bg-dark);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* Header looks like the kiosk header: blue bar, gold-outlined UHMC badge */
.adm-panel-head {
  background: rgba(0, 79, 110, 0.97);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: 0 4px 14px rgba(0, 49, 60, 0.25);
}

.adm-panel-head .adm-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.adm-panel-head .adm-title::before {
  content: 'UHMC';
  background: var(--uh-green-primary);
  border: 1.5px solid var(--uh-gold);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* Tabs: rounded pills, gold highlight like the kiosk's filter chips */
.adm-tabs {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--surface-border-subtle);
}

.adm-tab {
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.adm-tab.active {
  background: var(--uhmc-primary);
  border-color: var(--uh-gold);
  box-shadow: 0 0 0 2px rgba(255, 182, 0, 0.45);
}

/* Cards: white surface, soft blue-tinted shadow */
.adm-section {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px -12px rgba(0, 49, 60, 0.35);
}

.adm-h3 {
  font-size: 20px;
  letter-spacing: -0.2px;
}

.adm-card { border-radius: var(--radius-lg); }
.adm-card-head { background: rgba(0, 79, 110, 0.08); }

.adm-btn,
.adm-icon-btn,
.adm-pill { border-radius: var(--radius-full); }

.adm-btn.primary {
  border-color: var(--uh-gold);
  box-shadow: 0 0 0 2px rgba(255, 182, 0, 0.35);
}

.adm-pill.active { box-shadow: 0 0 0 2px rgba(255, 182, 0, 0.35); }

.adm-cal-day.selected { box-shadow: 0 0 0 2px var(--uh-gold); }
.adm-cal-month { font-size: 20px; }

.adm-photo-preview.empty { box-shadow: none; }

.adm-photo-preview {
  border-radius: var(--radius-lg);
  box-shadow: inset 0 -40px 40px -20px rgba(0, 20, 30, 0.55);
}

/* Keyboard dock matches the kiosk's deep-navy footer */
.adm-kbd {
  background: var(--uhmc-navy);
  border-top-color: var(--uh-gold);
}

.adm-key { background: rgba(0, 108, 150, 0.55); }

/* Online sign-in extras */
.adm-login-note {
  min-height: 0;
  margin-top: 6px;
  color: var(--uhmc-green);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}

.adm-login-extras {
  margin-top: 12px;
  justify-content: flex-end;
}
