/* MessMate Menu (App 2) — Stylesheet (Drop 3)
 * Mobile-first, crew-facing, restaurant feel with bigger cards.
 */

:root {
  --bg: #0f1419;
  --bg-elev: #1a2028;
  --bg-elev-2: #232b36;
  --border: #2d3742;
  --border-strong: #3a4553;
  --text: #e8edf2;
  --text-dim: #9ba8b8;
  --text-faint: #6b7886;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-dim: #78530a;
  --danger: #ef4444;
  --success: #10b981;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
}

/* ============ LOADING + ERROR ============ */

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 9999;
}

.spinner-lg {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen .text {
  color: var(--text-dim);
  font-size: 14px;
}

.screen {
  min-height: 100vh;
  padding: 20px;
  max-width: 720px;
  margin: 0 auto;
}

.error-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  margin-top: 20px;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.error-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text);
}

.error-card p {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ============ BRAND HEADER ============ */

.brand-header {
  text-align: center;
  padding: 24px 0 16px;
}

.brand-header .logo {
  font-size: 40px;
  margin-bottom: 4px;
}

.brand-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-header h1 span { color: var(--accent); }

.brand-header .subtitle,
.brand-header .vessel-label {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
}

.brand-header .vessel-label {
  color: var(--accent-hover);
  font-weight: 600;
}

.screen-h2 {
  margin: 20px 0 4px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.screen-sub {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #1a1300;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }

/* ============ VESSEL PICKER ============ */

.vessel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.vessel-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.vessel-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

.vessel-btn-icon { font-size: 28px; }
.vessel-btn-info { flex: 1; }
.vessel-btn-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.vessel-btn-id { font-size: 12px; color: var(--text-faint); font-family: ui-monospace, Menlo, monospace; }

/* ============ CREW PICKER ============ */

.crew-grid-big {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 520px) {
  .crew-grid-big { grid-template-columns: repeat(3, 1fr); }
}

.crew-tile {
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  text-align: center;
}

.crew-tile:hover, .crew-tile:active {
  transform: scale(0.98);
  border-color: var(--accent);
}

.crew-tile-photo {
  aspect-ratio: 1 / 1;
  background: var(--bg-elev-2);
  overflow: hidden;
}

.crew-tile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.crew-tile-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: 700;
  color: var(--text-faint);
  background: linear-gradient(135deg, var(--bg-elev-2), var(--bg-elev));
}

.crew-tile-name {
  padding: 10px 8px 2px;
  font-size: 14px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.crew-tile-rank {
  padding: 0 8px 10px;
  font-size: 11px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ MENU VIEW ============ */

.menu-screen { padding: 0; max-width: 800px; }

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.menu-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.me-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--accent);
  background: var(--bg-elev-2);
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: var(--accent);
}

.me-info { min-width: 0; }
.me-name {
  font-size: 14px; font-weight: 700;
  line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-rank {
  font-size: 11px; color: var(--text-dim);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.switch-btn {
  padding: 7px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
  transition: color 0.12s, border-color 0.12s;
}
.switch-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.week-header {
  padding: 18px 18px 10px;
  text-align: center;
}

.vessel-name {
  font-size: 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.week-label {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.week-toggle {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.week-toggle-btn {
  padding: 6px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  border-radius: 14px;
  font-size: 12px; font-weight: 600;
  transition: all 0.12s;
}

.week-toggle-btn.active {
  background: var(--accent);
  color: #1a1300;
  border-color: var(--accent);
}

/* Day tabs */

.day-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px 14px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 71px;
  z-index: 9;
}
.day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  text-align: center;
  min-width: 60px;
  transition: all 0.12s;
}

.day-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1300;
}

.day-tab-short {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.day-tab-date {
  font-size: 14px; font-weight: 700;
  margin-top: 1px;
}

/* Day content */

.day-content { padding: 20px 18px 100px; }

.day-title h2 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
}

.meal-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px;
  margin-bottom: 18px;
}

.meal-section.locked-section { opacity: 0.7; }

.meal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.meal-name {
  font-size: 17px; font-weight: 800;
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meal-cutoff {
  font-size: 11px;
  color: var(--text-faint);
  font-family: ui-monospace, Menlo, monospace;
}

.meal-status {
  font-size: 13px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 14px;
  display: inline-block;
  margin-bottom: 14px;
}
.meal-status.locked {
  background: rgba(107, 120, 134, 0.15);
  color: var(--text-faint);
}
.meal-status.ordered {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}
.meal-status.pending {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.meal-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  font-style: italic;
}

/* ============ BIG DISH CARDS (Drop 3) ============ */

.dish-cards-big {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (min-width: 640px) {
  .dish-cards-big { grid-template-columns: repeat(2, 1fr); }
}

.dish-card-big {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  padding: 0;
  text-align: left;
  width: 100%;
}

.dish-card-big:hover:not(.disabled) {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.dish-card-big.selected {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.dish-card-big.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.dish-card-big-img {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-elev-2);
  overflow: hidden;
}

.dish-card-big-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dish-card-big-img .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  opacity: 0.3;
}

.sel-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #1a1300;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.dish-card-big-info {
  padding: 14px 16px 16px;
}

.dish-card-big-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.25;
}

.dish-card-big-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.dish-card-big-hint {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dish-card-big.selected .dish-card-big-hint {
  color: var(--accent);
}

/* Skip button */

.skip-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1.5px dashed var(--border-strong);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.12s;
  cursor: pointer;
}

.skip-btn:hover:not(.disabled) {
  border-color: var(--text-dim);
  color: var(--text);
}

.skip-btn.active {
  border: 1.5px solid var(--accent);
  border-style: solid;
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-hover);
}

.skip-btn.disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ============ DISH DETAIL MODAL (Drop 3) ============ */

.dish-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  overflow-y: auto;
}

.dish-modal {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.dish-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background 0.12s;
}

.dish-modal-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.dish-modal-img {
  aspect-ratio: 4 / 3;
  background: var(--bg-elev-2);
  overflow: hidden;
  flex-shrink: 0;
}

.dish-modal-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dish-modal-img .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  opacity: 0.3;
}

.dish-modal-body {
  padding: 20px 22px 12px;
  flex: 1;
}

.dish-modal-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-hover);
  background: rgba(245, 158, 11, 0.15);
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.dish-modal-name {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.3px;
}

.dish-modal-desc {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
}

.dish-modal-body .muted-small {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 10px;
}

.dish-modal-footer {
  padding: 14px 22px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev-2);
}

.dish-modal-action {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.dish-modal-action.add {
  background: var(--accent);
  color: #1a1300;
}
.dish-modal-action.add:hover { background: var(--accent-hover); }

.dish-modal-action.remove {
  background: var(--danger);
  color: #fff;
}
.dish-modal-action.remove:hover { background: #dc2626; }

.dish-modal-action.disabled {
  background: var(--bg);
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  cursor: not-allowed;
}

/* ============ EMPTY STATE ============ */

.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state h3 {
  margin: 12px 0 6px;
  color: var(--text);
  font-size: 18px;
}
.empty-state p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
}
.empty-state .empty-icon {
  font-size: 48px;
  opacity: 0.4;
  margin-bottom: 8px;
}

/* ============ SAVE INDICATOR ============ */

.save-indicator {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  box-shadow: var(--shadow);
}
.save-indicator.saving { opacity: 1; color: var(--text-dim); }
.save-indicator.saved {
  opacity: 1;
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.5);
}
.save-indicator.error {
  opacity: 1;
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
}
