@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

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

:root {
  --cream: #faf6ef;
  --cream-dark: #f0eadd;
  --olive: #4a6741;
  --olive-dark: #3a5233;
  --olive-light: #5a7d4f;
  --terracotta: #c1553a;
  --terracotta-light: #d4694f;
  --amber: #e8a838;
  --amber-light: #f5d88a;
  --text: #2c2c2c;
  --text-muted: #8a8177;
  --card-bg: #fff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle texture on background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23d4c9b5' fill-opacity='0.15'%3E%3Ccircle cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

/* Nav */
.nav {
  background: linear-gradient(135deg, var(--olive) 0%, var(--olive-dark) 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(74,103,65,0.25);
}

.nav-title {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  line-height: 1.2;
  flex: 1;
  letter-spacing: 0.3px;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.nav a:active {
  background: rgba(255,255,255,0.15);
}

.status {
  font-size: 0.75rem;
  opacity: 0.8;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.status.saving { opacity: 1; }
.status.saved { opacity: 0.6; }
.status.error { color: #ffb4a9; }

/* Main content */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
  padding-bottom: 100px;
}

/* Cards (homepage) */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  border: 1px solid rgba(0,0,0,0.03);
}
.card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow);
}

.card-link {
  display: block;
  padding: 16px 48px 16px 16px;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1px;
}

.card-meta span:last-child {
  background: var(--cream);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.75rem;
}

.delete-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #ccc;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.delete-btn:hover { color: var(--terracotta); }

/* FAB */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--terracotta) 0%, #b34830 100%);
  color: #fff;
  border: none;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(193,85,58,0.4), 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.2s;
  z-index: 50;
}
.fab:hover {
  box-shadow: 0 6px 20px rgba(193,85,58,0.5), 0 2px 6px rgba(0,0,0,0.15);
}
.fab:active { transform: scale(0.9); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px 60px;
  color: var(--text-muted);
}
.empty-illustration {
  margin-bottom: 24px;
  opacity: 0.7;
}
.empty-state p {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.empty-state small {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Visit detail */
.visit-header {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(0,0,0,0.03);
}

.visit-header input {
  width: 100%;
  border: none;
  outline: none;
  font-family: inherit;
  background: transparent;
}

.visit-title-input {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e2ddd4 !important;
}
.visit-title-input::placeholder { color: #c5bfb5; }

.visit-date-input {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Items */
.items-card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 4px 0;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.03);
}

.item-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 52px;
  border-bottom: 1px solid #ece7de;
  gap: 8px;
  background-image: repeating-linear-gradient(
    transparent, transparent 51px, #ece7de 51px, #ece7de 52px
  );
}
.item-row:last-child { border-bottom: none; }

.item-name {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  min-height: 44px;
}
.item-name::placeholder { color: #c5bfb5; }

.item-score {
  width: 56px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dark) 100%);
  border-radius: 10px;
  padding: 6px 4px;
  font-weight: 700;
  color: var(--olive);
  -moz-appearance: textfield;
  transition: box-shadow 0.2s;
}
.item-score:focus {
  box-shadow: 0 0 0 2px rgba(74,103,65,0.2);
}
.item-score::-webkit-inner-spin-button,
.item-score::-webkit-outer-spin-button { -webkit-appearance: none; }

.item-delete {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #d4cfc5;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.item-delete:hover { color: var(--terracotta); }

/* Add item button */
.add-item-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: none;
  border: none;
  border-top: 1px dashed #ddd;
  color: var(--olive);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
  letter-spacing: 0.2px;
}
.add-item-btn:hover { background: rgba(74,103,65,0.04); }
.add-item-btn:active { background: rgba(74,103,65,0.08); }

/* Responsive */
@media (min-width: 600px) {
  .container { padding: 28px; }
  .nav { padding: 18px 24px; }
  .nav-title { font-size: 1.5rem; }
  .card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
  }
}

/* Smooth transitions for page feel */
@media (prefers-reduced-motion: no-preference) {
  .card { transition: box-shadow 0.25s ease, transform 0.2s ease; }
  .fab { transition: transform 0.2s ease, box-shadow 0.25s ease; }
}
