:root {
  --primary: #d35400;
  --primary-hover: #e67e22;
  --bg: #faf9f7;
  --card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e8e6e1;
  --tag-bg: #fef3e2;
  --tag-text: #b45309;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Login */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card);
  padding: 48px 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.login-card h1 {
  font-size: 28px;
  margin-bottom: 4px;
  color: var(--text);
}

.login-card p {
  color: var(--text-light);
  margin-bottom: 28px;
  font-size: 15px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus {
  border-color: var(--primary);
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover { background: var(--primary-hover); }

.error { color: var(--danger); font-size: 14px; margin-top: 8px; }

/* Header */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.header-row h1 {
  font-size: 22px;
  font-weight: 700;
}

.header-row h1 a { color: var(--text); }

.search-row {
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus { border-color: var(--primary); background: white; }

/* Tags */
.tags-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.tag-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.tag-pill:hover { background: #fde6c4; }
.tag-pill.active { border-color: var(--primary); background: #fde6c4; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a93226; color: white; }
.btn-small { padding: 6px 14px; font-size: 13px; }

/* Main content */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Recipe grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.recipe-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.recipe-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.recipe-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--border);
}

.recipe-card-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #fef3e2, #fde6c4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.recipe-card-body {
  padding: 14px 16px;
}

.recipe-card-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}

.recipe-card-meta {
  color: var(--text-light);
  font-size: 13px;
  display: flex;
  gap: 12px;
}

.recipe-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.recipe-card-tags .tag-pill { font-size: 11px; padding: 2px 8px; }

/* Recipe detail */
.recipe-detail { max-width: 700px; margin: 0 auto; }

.recipe-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 16px;
}

.recipe-back:hover { color: var(--primary); }

.recipe-hero {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.recipe-header h2 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.recipe-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.recipe-description {
  color: var(--text-light);
  margin-bottom: 16px;
  font-size: 15px;
}

.recipe-info {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  color: var(--text-light);
  font-size: 14px;
}

.recipe-info span strong { color: var(--text); }

.recipe-tags-detail {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.recipe-section {
  margin-bottom: 28px;
}

.recipe-section h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.recipe-section ul {
  list-style: none;
  padding: 0;
}

.recipe-section ul li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.recipe-section ul li:last-child { border-bottom: none; }

.recipe-section ol {
  padding-left: 24px;
}

.recipe-section ol li {
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.5;
}

/* Form */
.recipe-form {
  max-width: 600px;
  margin: 0 auto;
}

.recipe-form h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

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

.form-group textarea { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.image-preview {
  margin-top: 8px;
}

.image-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; margin-bottom: 20px; }

/* Delete modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--text-light); margin-bottom: 20px; font-size: 15px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Responsive */
@media (max-width: 600px) {
  header { padding: 12px 16px 8px; }
  .header-row h1 { font-size: 18px; }
  main { padding: 16px; }
  .recipe-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .recipe-header { flex-direction: column; }
  .recipe-header h2 { font-size: 22px; }
  .recipe-info { flex-wrap: wrap; gap: 12px; }
}
