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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

header {
  background: #2c7be5;
  color: white;
  padding: 20px 16px;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 4px;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  color: #333;
  background: #fafafa;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #2c7be5;
  background: white;
}

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #333;
  padding: 8px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: all 0.2s;
}

.radio-label input[type="radio"] {
  accent-color: #2c7be5;
}

.radio-label:has(input:checked) {
  border-color: #2c7be5;
  background: #eef4fd;
  color: #2c7be5;
  font-weight: 600;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #2c7be5;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1a65c8;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.list-header h2 {
  margin-bottom: 0;
}

#count {
  font-size: 0.85rem;
  color: #888;
  font-weight: 400;
}

.btn-small {
  padding: 6px 12px;
  background: #f0f0f0;
  color: #666;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-small:hover {
  background: #e0e0e0;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  padding: 24px 0;
}

.food-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.food-item {
  border: 2px solid #e8ecf0;
  border-radius: 10px;
  padding: 14px;
  background: #fafbfc;
  transition: border-color 0.3s;
}

.food-item.safe {
  border-color: #28a745;
}

.food-item.warning {
  border-color: #ffc107;
  background: #fffdf0;
}

.food-item.danger {
  border-color: #fd7e14;
  background: #fff8f5;
}

.food-item.expired {
  border-color: #dc3545;
  background: #fff5f5;
  opacity: 0.85;
}

.food-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.food-name {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
}

.food-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-room {
  background: #fff3cd;
  color: #856404;
}

.badge-cold {
  background: #cff4fc;
  color: #055160;
}

.food-meta {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

.time-remaining {
  margin-top: 10px;
  font-size: 1.1rem;
  font-weight: 700;
}

.time-remaining .label {
  font-size: 0.8rem;
  font-weight: 400;
  color: #888;
  display: block;
  margin-bottom: 2px;
}

.time-remaining.safe { color: #28a745; }
.time-remaining.warning { color: #d39e00; }
.time-remaining.danger { color: #e07000; }
.time-remaining.expired { color: #dc3545; }

.progress-bar {
  margin-top: 8px;
  height: 6px;
  background: #e8ecf0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s linear;
}

.progress-fill.safe { background: #28a745; }
.progress-fill.warning { background: #ffc107; }
.progress-fill.danger { background: #fd7e14; }
.progress-fill.expired { background: #dc3545; }

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-delete {
  padding: 6px 14px;
  background: white;
  color: #dc3545;
  border: 1px solid #dc3545;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete:hover {
  background: #dc3545;
  color: white;
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.3rem;
  }

  .radio-group {
    flex-direction: column;
    gap: 8px;
  }

  .radio-label {
    width: 100%;
  }
}
