/* MenuScan — mobile-first styles */
:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #0f3460;
  --highlight: #e94560;
  --text: #eaeaea;
  --muted: #888;
  --radius: 10px;
  --font: system-ui, -apple-system, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  gap: 2rem;
}

header {
  text-align: center;
}

header h1 {
  font-size: 2rem;
  letter-spacing: 0.05em;
  color: var(--highlight);
}

header p {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* API health pill */
.api-status {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.api-status.checking { background: #333; color: var(--muted); }
.api-status.ok       { background: #1a3a1a; color: #6fcf6f; border: 1px solid #2a5a2a; }
.api-status.warn     { background: #3a2e00; color: #f0c040; border: 1px solid #5a4a00; }
.api-status.error    { background: #3a1a1a; color: #f07070; border: 1px solid #5a2a2a; }

main {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

form {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--accent);
  border: 1px solid #ffffff15;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 2px solid var(--highlight);
}

#preview-container {
  border-radius: var(--radius);
  overflow: hidden;
}


button[type="submit"] {
  margin-top: 0.5rem;
  padding: 0.85rem;
  background: var(--highlight);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#status {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

#status.error { border-left: 3px solid var(--highlight); }
#status.success { border-left: 3px solid #4caf50; }

/* ─── Results section ───────────────────────────────────────────────────── */

#results {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#download-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#download-bar button {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: var(--text);
  border: 1px solid #ffffff20;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#download-bar button:hover:not(:disabled) {
  background: #1a4a80;
}

#download-bar button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

#results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

#results-table th {
  background: var(--accent);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.75rem;
  text-align: left;
  white-space: nowrap;
}

#results-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #ffffff08;
  vertical-align: top;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#results-table tr:last-child td { border-bottom: none; }
#results-table tr:hover td { background: #ffffff07; }

#results-more {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 0.5rem;
}

/* ─── Capture source selector ───────────────────────────────────────────── */

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.capture-row {
  display: flex;
  gap: 0.75rem;
}

.capture-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.85rem 0.5rem;
  background: var(--accent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  /* override base label styles */
  text-transform: none;
  letter-spacing: normal;
  border: 1px solid #ffffff20;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.capture-btn:hover {
  background: #1a4a80;
}

.capture-btn.active {
  border-color: var(--highlight);
  background: #2a1028;
  color: #fff;
}

.capture-btn input[type="file"] {
  display: none;
}

/* ─── Quality preset selector ──────────────────────────────────────────── */

.preset-row {
  display: flex;
  gap: 0.75rem;
}

.preset-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.5rem;
  background: var(--accent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  border: 1px solid #ffffff20;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.preset-btn:hover {
  background: #1a4a80;
}

.preset-btn:has(input:checked) {
  border-color: var(--highlight);
  background: #2a1028;
  color: #fff;
}

.preset-btn input[type="radio"] {
  display: none;
}

/* ─── Preview + action row ──────────────────────────────────────────────── */

#photo-preview {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

.preview-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.preview-actions button {
  flex: 1;
  padding: 0.55rem 0.5rem;
  background: var(--accent);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #ffffff20;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.preview-actions button:hover {
  background: #1a4a80;
}

#btn-clear:hover {
  background: #3a1a1a;
  border-color: var(--highlight);
}

.preview-size {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.3rem;
  letter-spacing: 0.02em;
}
