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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #faf7f2;
  color: #3C2415;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

/* Coffee splatters - fixed position so they don't scroll away */
.coffee-splatter {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 640px;
  width: 100%;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 2.8rem;
  color: #3C2415;
  margin: 0;
  line-height: 1.1;
}

.header .subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: #8B6F5C;
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}

/* Section headers */
h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8B6F5C;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-left: 0.25rem;
}

/* Cards */
.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow:
    0 4px 6px -1px rgba(60, 36, 21, 0.06),
    0 2px 4px -2px rgba(60, 36, 21, 0.04);
  border: 1px solid rgba(60, 36, 21, 0.08);
}

/* Estimator */
.estimate-display {
  text-align: center;
  padding: 1.5rem 0;
}

.estimate-display .time {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 900;
  color: #6F4E37;
  line-height: 1;
}

.estimate-display .unit {
  font-size: 1rem;
  color: #8B6F5C;
  font-weight: 500;
  margin-top: 0.25rem;
}

.estimate-display .note {
  font-size: 0.75rem;
  color: #B09A8A;
  margin-top: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

.input-group {
  flex: 1;
}

.input-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #8B6F5C;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.input-group input {
  width: 100%;
  padding: 0.75rem;
  background: #faf7f2;
  border: 1.5px solid #D2A679;
  border-radius: 10px;
  color: #3C2415;
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  min-height: 48px; /* comfortable touch target */
}

.input-group input:focus {
  border-color: #6F4E37;
}

/* Log visit toggle */
.btn-log {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  min-height: 52px;
  background: #3C2415;
  color: #faf7f2;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
}

.btn-log:hover {
  background: #6F4E37;
  box-shadow: 0 4px 16px rgba(60, 36, 21, 0.2);
  transform: translateY(-1px);
}

.btn-log.active {
  background: #D2A679;
  color: #3C2415;
}

/* Log form */
.log-form {
  display: none;
}

.log-form.visible {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-submit {
  width: 100%;
  padding: 1rem;
  min-height: 52px;
  background: linear-gradient(135deg, #6F4E37 0%, #3C2415 100%);
  color: #faf7f2;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(60, 36, 21, 0.3);
}

.btn-submit:hover {
  box-shadow: 0 4px 12px rgba(60, 36, 21, 0.5);
  transform: translateY(-1px);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#statusMsg {
  font-size: 0.8rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-top: 0.75rem;
  display: none;
}

#statusMsg.success {
  display: block;
  background: rgba(111, 78, 55, 0.12);
  border: 1px solid rgba(111, 78, 55, 0.3);
  color: #6F4E37;
}

#statusMsg.error {
  display: block;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #dc2626;
}

/* Chart */
.chart-container {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  height: 400px;
  box-shadow:
    0 4px 6px -1px rgba(60, 36, 21, 0.06),
    0 2px 4px -2px rgba(60, 36, 21, 0.04);
  border: 1px solid rgba(60, 36, 21, 0.08);
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 4px 6px -1px rgba(60, 36, 21, 0.06),
    0 2px 4px -2px rgba(60, 36, 21, 0.04);
  border: 1px solid rgba(60, 36, 21, 0.08);
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(60, 36, 21, 0.06);
}

th {
  font-weight: 600;
  color: #8B6F5C;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(60, 36, 21, 0.03);
}

tbody tr:hover {
  background: rgba(60, 36, 21, 0.02);
}

tbody tr:last-child td {
  border-bottom: none;
}

.loading {
  color: #8B6F5C;
  text-align: center;
  padding: 2rem;
}

/* Mobile */
@media (max-width: 640px) {
  .container {
    padding: 0.75rem;
  }

  .header h1 {
    font-size: 2.2rem;
  }

  .estimate-display .time {
    font-size: 2.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .input-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .chart-container {
    height: 280px;
    padding: 0.75rem;
  }

  th, td {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Prevent double-tap zoom on buttons */
button {
  touch-action: manipulation;
}

input {
  touch-action: manipulation;
}
