/* Wydaho Ice Cream — Tablet-first dark theme */
:root {
  --bg: #111110;
  --surface: #1a1a19;
  --surface2: #242423;
  --border: #333332;
  --text: #f0efe9;
  --muted: #888883;
  --accent: #d1432a;
  --green: #3ecf8e;
  --accent2: #c8a86b;
  --yellow: #f7c948;
  --orange: #f6993f;
}

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

html, body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Login Screen ─────────────────────────────────────────────── */

.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
}

.login-screen .brand {
  margin-bottom: 32px;
  text-align: center;
}

.login-screen .brand img {
  height: 48px;
  margin-bottom: 8px;
}

.login-screen .brand-sub {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

.team-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.team-btn:active {
  background: var(--accent);
  border-color: var(--accent);
}

/* PIN Pad */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.pin-pad {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px;
  max-width: 340px;
  width: 90%;
}

.pin-pad h3 {
  text-align: center;
  margin-bottom: 16px;
  font-size: 20px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: background 0.1s;
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.pin-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-key {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 18px;
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.1s;
}

.pin-key:active { background: var(--accent); }
.pin-key.fn { font-size: 16px; }

.pin-error {
  color: var(--accent);
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

/* ── Lock Screen ──────────────────────────────────────────────── */
.lock-screen {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px);
}
.lock-content {
  text-align: center;
  width: 320px;
}
.lock-pin-dots {
  display: flex; justify-content: center; gap: 16px;
  margin-bottom: 20px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake { animation: shake 0.4s ease-in-out; }

/* ── App Shell ────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-header .logo { height: 32px; }
.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.app-header .logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Bottom Nav ───────────────────────────────────────────────── */

.bottom-nav {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s;
  gap: 2px;
}

.bottom-nav a.active { color: var(--accent); }
.bottom-nav a .nav-icon { font-size: 24px; }

/* ── Pages ────────────────────────────────────────────────────── */

.page { display: none; }
.page.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-weight: 700; font-size: 18px; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn:active { opacity: 0.7; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Checklist ────────────────────────────────────────────────── */

.checklist-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.checklist-tab {
  flex: 1;
  padding: 14px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.checklist-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface);
}

.checklist-progress {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  margin-bottom: 16px;
  overflow: hidden;
}

.checklist-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s;
}

.checklist-item-wrapper {
  border-bottom: 1px solid var(--border);
}
.checklist-item-wrapper:last-child { border-bottom: none; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  transition: background 0.1s;
  min-height: 56px;
}

.check-box {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  transition: all 0.15s;
  cursor: pointer;
}

.check-box:active { transform: scale(0.9); }

.checklist-item.done .check-box {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.checklist-item.done .item-desc { color: var(--muted); text-decoration: line-through; }

.item-desc { flex: 1; font-size: 16px; }
.item-meta { font-size: 12px; color: var(--muted); text-align: right; }

.checklist-detail {
  display: none;
  padding: 0 20px 16px 68px;
}

.checklist-item-wrapper.open .checklist-detail {
  display: block;
}

/* ── Flavor Cards ────────────────────────────────────────────── */

.flavor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.flavor-card {
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  border: 3px solid transparent;
  position: relative;
}

.flavor-card:active { transform: scale(0.96); }

.flavor-card.selected {
  border-color: var(--green);
}

.flavor-card .flavor-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.flavor-card .flavor-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.flavor-card.selected .flavor-check { display: flex; }

/* ── Bucket Log ──────────────────────────────────────────────── */

.bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.bucket-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.bucket-btn:active {
  background: var(--accent);
  border-color: var(--accent);
}

.log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.log-entry:last-child { border-bottom: none; }

/* ── Handbook ─────────────────────────────────────────────────── */

.handbook-section { margin-bottom: 20px; }
.handbook-section-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent2);
  margin-bottom: 8px;
  padding: 0 4px;
}

.handbook-item {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.handbook-item:last-child { border-bottom: none; }
.handbook-item:active { background: var(--surface2); }

.handbook-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
}

.handbook-chevron {
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.handbook-item.open .handbook-chevron {
  transform: rotate(90deg);
}

.handbook-a {
  display: none;
  padding: 0 20px 16px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

.handbook-item.open .handbook-a {
  display: block;
}

/* ── Shift Notes ─────────────────────────────────────────────── */

.shift-note-form { margin-bottom: 20px; }

.shift-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.shift-note-card.mgmt {
  border-left: 3px solid var(--accent2);
  background: #1f1d18;
}

.shift-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.shift-note-author {
  font-weight: 700;
  font-size: 14px;
}

.shift-note-author.mgmt { color: var(--accent2); }

.shift-note-time {
  font-size: 13px;
  color: var(--muted);
}

.shift-note-body {
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.shift-note-card.own { cursor: pointer; }
.shift-note-card.own:active { opacity: 0.85; }

.note-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mention-tag {
  color: var(--accent2);
  font-weight: 700;
}

.mention-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  margin-bottom: 4px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}

.mention-opt {
  padding: 12px 16px;
  font-size: 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.mention-opt:last-child { border-bottom: none; }
.mention-opt:active { background: var(--surface2); }

/* ── Training ────────────────────────────────────────────────── */

.training-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.training-member-selector select { min-width: 180px; }

.training-progress-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.training-summary-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 100px;
  justify-content: center;
}

.training-summary-chip .chip-pct { color: var(--green); }

.training-position { margin-bottom: 20px; }

.training-position-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent2);
  margin-bottom: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.training-position-progress {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.training-item-wrapper { border-bottom: 1px solid var(--border); }
.training-item-wrapper:last-child { border-bottom: none; }
.training-item-wrapper.expandable { cursor: pointer; }
.training-item-wrapper.expandable:active { background: var(--surface2); }

.training-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: 56px;
}

.training-check {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.training-check:active { opacity: 0.7; }
.training-check.self-checked { background: var(--yellow); border-color: var(--yellow); color: #000; }
.training-check.verified { background: var(--green); border-color: var(--green); color: #fff; }

.training-item-info { flex: 1; min-width: 0; }
.training-item-desc { font-size: 16px; }
.training-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.training-item-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

.training-video-btn {
  background: none; border: 1px solid var(--border); color: var(--accent);
  border-radius: 8px; width: 36px; height: 36px; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background 0.1s;
}
.training-video-btn:active { background: var(--surface2); }

.training-verify-btn {
  background: none; border: 1px solid var(--green); color: var(--green);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.training-verify-btn:active { background: rgba(62,207,142,0.15); }

.training-uncheck-btn {
  background: none; border: 1px solid var(--accent); color: var(--accent);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.training-uncheck-btn:active { background: rgba(209,67,42,0.15); }

.training-chevron { color: var(--muted); font-size: 13px; margin-left: 8px; transition: transform 0.2s; display: inline-block; }
.training-item-wrapper.open .training-chevron { transform: rotate(90deg); }
.training-detail { display: none; padding: 0 16px 16px 60px; }
.training-item-wrapper.open .training-detail { display: block; }
.training-detail-text { background: var(--surface2); border-radius: 10px; padding: 16px; font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 12px; }
.training-video-btn-large { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 10px; padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.training-video-btn-large:active { background: rgba(209,67,42,0.15); }
.training-video-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.training-detail-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ── Picker/Modal overlays ───────────────────────────────────── */

.picker-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 60px; z-index: 100;
}

.picker-panel {
  background: var(--surface); border-radius: 16px; padding: 24px;
  max-width: 500px; width: 90%; max-height: 70vh; overflow-y: auto;
}

/* ── Toast ────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  transition: transform 0.3s;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--accent); }

/* ── Utilities ────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 16px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
