/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #ff6b9d;
  --primary-dark: #e05588;
  --secondary: #ffd6e7;
  --accent: #a8edea;
  --text: #333;
  --text-light: #666;
  --bg: #fff9fb;
  --card-bg: #ffffff;
  --shadow: 0 4px 20px rgba(255, 107, 157, 0.15);
  --radius: 16px;
  --reserved-color: #e8f5e9;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #ff6b9d, #ffa8cc, #a8edea);
  padding: 3rem 1rem;
  text-align: center;
  color: white;
}

.baby-icon { font-size: 4rem; margin-bottom: 1rem; }

header h1 {
  font-size: 2rem;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.subtitle { font-size: 1.1rem; opacity: 0.9; margin: 0.5rem 0; }
.due-date { font-size: 0.95rem; opacity: 0.8; }

/* ── Main ── */
main { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.filter-btn {
  padding: 0.5rem 1.2rem;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  color: white;
}

/* ── Stats ── */
.stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.stat-card span {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card label { font-size: 0.85rem; color: var(--text-light); }

/* ── Items Grid ── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.item-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.item-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(255,107,157,0.2); }
.item-card.fully-reserved { opacity: 0.7; background: var(--reserved-color); }

.item-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.item-image img { width: 100%; height: 100%; object-fit: cover; }

.item-body { padding: 1.2rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.item-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  font-weight: 600;
}

.item-name { font-size: 1.1rem; font-weight: 600; }
.item-description { font-size: 0.9rem; color: var(--text-light); flex: 1; }

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.item-price { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

.progress-bar {
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ffa8cc);
  border-radius: 3px;
  transition: width 0.3s;
}

.item-availability { font-size: 0.8rem; color: var(--text-light); }

.btn-reserve {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: opacity 0.2s;
  margin-top: 0.5rem;
}

.btn-reserve:hover { opacity: 0.9; }
.btn-reserve:disabled { background: #ccc; cursor: not-allowed; }

.item-link {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  margin-top: 0.5rem;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal.hidden { display: none; }

.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-light);
}

.modal h2 { margin-bottom: 1rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Buttons ── */
.btn-primary {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: opacity 0.2s;
  width: 100%;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  padding: 0.8rem 1.5rem;
  background: #f0f0f0;
  color: var(--text);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.form-actions { display: flex; gap: 1rem; }
.form-actions .btn-primary, .form-actions .btn-secondary { width: auto; flex: 1; }

/* ── Admin ── */
.admin-body { background: #f5f5f5; }

.admin-nav {
  background: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  flex-wrap: wrap;
}

.admin-nav h2 { font-size: 1.2rem; color: var(--primary); margin-right: auto; }

.nav-tabs { display: flex; gap: 0.5rem; }

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: #f0f0f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-btn.active { background: var(--primary); color: white; }

.btn-logout {
  padding: 0.5rem 1rem;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.tab-content { max-width: 1000px; margin: 2rem auto; padding: 0 1rem; }
.tab-content.hidden { display: none; }

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tab-header .btn-primary { width: auto; }

/* ── Admin Item Row ── */
.admin-item-row {
  background: white;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-item-row img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--secondary);
}

.admin-item-info { flex: 1; }
.admin-item-info h4 { font-size: 1rem; }
.admin-item-info p { font-size: 0.85rem; color: var(--text-light); }

.admin-item-actions { display: flex; gap: 0.5rem; }

.btn-edit, .btn-delete {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-edit { background: #e3f2fd; color: #1976d2; }
.btn-delete { background: #ffebee; color: #c62828; }

/* ── Reservation Table ── */
.reservations-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.reservations-table th {
  background: var(--primary);
  color: white;
  padding: 1rem;
  text-align: left;
  font-size: 0.9rem;
}

.reservations-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

/* ── Login ── */
.login-card {
  max-width: 400px;
  margin: 10vh auto;
  padding: 2rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card h1 { margin-bottom: 1.5rem; color: var(--primary); }

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 1rem 0;
}

.login-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1.2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}

/* ── Misc ── */
.loading { text-align: center; padding: 3rem; color: var(--text-light); font-size: 1.1rem; }
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
}
.hidden { display: none !important; }
.error { color: #c62828; font-size: 0.9rem; margin-top: 0.5rem; }

.modal-item-info {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

footer a { color: var(--text-light); text-decoration: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .stats { flex-direction: row; align-items: stretch; gap: 0.5rem; }
  .stat-card { flex: 1; min-width: 0; padding: 0.9rem 0.5rem; }
  .stat-card span { font-size: 1.5rem; }
  .stat-card label { font-size: 0.75rem; }
  .items-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .admin-item-row { flex-wrap: wrap; }
}
