@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Lora:wght@400;500;600&display=swap');

:root {
  --bg:        #0d0803;
  --bg2:       #110c06;
  --bg3:       #1a120a;
  --border:    #2d1f0e;
  --border2:   #3d2a18;
  --gold:      #c8904a;
  --gold-light:#e8c070;
  --text:      #e8d5b0;
  --text-dim:  #a07850;
  --text-muted:#6b4c2a;
  --accent:    #7c4a1e;
  --accent2:   #a0622a;
  --danger:    #c05030;
  --success:   #4a8a4a;
  --radius:    10px;
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', Georgia, serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}

/* ── Layout ── */
.container { max-width: 640px; margin: 0 auto; padding: 0 18px; }

/* ── Sticky header ── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  padding: 14px 18px;
}
.site-header .inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.site-header h1 { font-size: 20px; color: var(--text); }
.site-header .sub { font-size: 11px; color: var(--text-muted); letter-spacing: .1em; text-transform: uppercase; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: none;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px; cursor: pointer; text-decoration: none;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #f0dfc0;
  box-shadow: 0 3px 14px #7c4a1e44;
}
.btn-secondary {
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-danger {
  background: #2a0a0a; border: 1px solid #5a1a1a; color: var(--danger);
}
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-body { padding: 18px; }
.card + .card { margin-top: 12px; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 6px;
  font-family: 'Playfair Display', Georgia, serif;
}
.form-control, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  font-family: 'Lora', Georgia, serif;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a07850' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Section headings inside forms ── */
.section-heading {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Stat chips ── */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.stat-chip {
  background: var(--bg3); border-radius: 20px;
  padding: 3px 12px; font-size: 12px; color: var(--text-dim);
}
.stat-chip.highlight { color: var(--gold); }

/* ── Star rating ── */
.stars { display: flex; gap: 4px; }
.stars button {
  background: none; border: none; font-size: 26px;
  cursor: pointer; color: var(--gold); opacity: .3;
  transition: opacity .15s;
  padding: 2px;
}
.stars button.active { opacity: 1; }

/* ── Roast entry list item ── */
.entry-card {
  display: flex; gap: 0; cursor: pointer;
  text-decoration: none; color: inherit;
  transition: border-color .15s;
}
.entry-card:hover { border-color: var(--border2); }
.entry-thumb {
  width: 82px; height: 82px;
  object-fit: cover; flex-shrink: 0;
}
.entry-thumb-placeholder {
  width: 82px; height: 82px; flex-shrink: 0;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--border2);
}
.entry-info { padding: 12px 14px; flex: 1; min-width: 0; }
.entry-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px; color: #f0dfc0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entry-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Detail view rows ── */
.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--bg3);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 13px; }

/* ── Metric boxes ── */
.metric-grid { display: flex; gap: 10px; }
.metric-box {
  flex: 1; background: var(--bg3); border-radius: 10px;
  padding: 14px; text-align: center;
}
.metric-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px; color: var(--text);
}
.metric-label { font-size: 10px; color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }

/* ── Alerts ── */
.alert {
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; margin-bottom: 16px;
}
.alert-success { background: #1a3a1a; border: 1px solid #2d5a2d; color: #70c070; }
.alert-error   { background: #2a0a0a; border: 1px solid #5a1a1a; color: #e07060; }
.alert-info    { background: #1a2a3a; border: 1px solid #2d4a5a; color: #70a0c0; }

/* ── Photo upload ── */
.photo-upload-btn {
  width: 100%; background: var(--bg3);
  border: 2px dashed var(--border2); border-radius: 8px;
  color: var(--text-dim); padding: 20px;
  font-size: 14px; cursor: pointer;
  font-family: 'Lora', Georgia, serif;
  text-align: center; transition: border-color .15s;
}
.photo-upload-btn:hover { border-color: var(--gold); }
.photo-preview { width: 100%; border-radius: 8px; margin-top: 12px; max-height: 240px; object-fit: cover; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  width: 100%; max-width: 360px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 28px;
  text-align: center; box-shadow: 0 20px 60px #00000088;
}
.login-icon { font-size: 42px; margin-bottom: 10px; }
.login-box h1 { font-size: 26px; color: var(--text); margin-bottom: 4px; }
.login-box p  { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--border2); }
.empty-state .icon { font-size: 48px; margin-bottom: 14px; }
.empty-state h3 { font-size: 18px; color: var(--text-muted); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ── Moisture loss bar ── */
.loss-bar-wrap { background: var(--bg3); border-radius: 8px; padding: 12px 14px; margin-top: 4px; }
.loss-bar-label { font-size: 13px; color: var(--gold); margin-bottom: 6px; }
.loss-bar-track { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.loss-bar-fill  { background: linear-gradient(90deg, var(--accent), var(--gold)); height: 100%; border-radius: 99px; transition: width .4s; }

/* ── Tasting page ── */
.taste-wrap { max-width: 500px; margin: 40px auto; padding: 0 18px 60px; }

/* ── Nav back link ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); text-decoration: none; font-size: 20px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
  .metric-grid { flex-wrap: wrap; }
  .metric-box { min-width: calc(50% - 5px); }
}
