/* ═══════════════════════════════════════
   NAVIGATION
═══════════════════════════════════════ */
#nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text) !important;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent) !important; }
.nav-brand-icon { font-size: 1.3rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
}

.nav-link {
  color: var(--text-muted) !important;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: var(--t);
}
.nav-link:hover { color: var(--text) !important; background: var(--bg); }
.nav-link.active { color: var(--accent) !important; background: var(--accent-dim); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-username {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
}
.role-owner { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(230,57,70,0.25); }
.role-guest  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  transition: var(--t);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(230,57,70,0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-sm  { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.875rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input,
.form-textarea,
.form-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-dim); font-weight: 400; }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236B7280' d='M8 10.5L3 5.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
  cursor: pointer;
}
.form-select option { background: var(--surface); color: var(--text); }

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 500;
}

/* File input */
.file-input-wrapper { position: relative; }
.file-input-wrapper input[type="file"] {
  position: absolute; inset: 0; opacity: 0;
  width: 100%; height: 100%; cursor: pointer;
}
.file-input-label {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.9rem;
  transition: var(--t); cursor: pointer;
}
.file-input-label:hover { border-color: var(--accent); color: var(--accent); }

/* Tag input */
.tag-input-container {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 2.75rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.tag-input-container:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.tag-input-container input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.9rem; font-weight: 500;
  flex: 1; min-width: 120px;
}
.tag-input-container input::placeholder { color: var(--text-dim); font-weight: 400; }

.tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(230,57,70,0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.78rem; font-weight: 700;
  cursor: default;
}
.tag-remove { cursor: pointer; opacity: 0.55; font-weight: 700; transition: opacity var(--t-fast); }
.tag-remove:hover { opacity: 1; }

/* Tag filter chips */
.tag-chip {
  display: inline-flex; align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem; font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  cursor: pointer; transition: var(--t);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.tag-chip:hover, .tag-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(230,57,70,0.25);
}

/* ═══════════════════════════════════════
   RECIPE CARDS
═══════════════════════════════════════ */
.recipe-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.recipe-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(230,57,70,0.15);
}

.recipe-card-photo {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg);
}
.recipe-card-photo img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--t-slow);
}
.recipe-card:hover .recipe-card-photo img { transform: scale(1.05); }

.recipe-card-body {
  padding: 1.25rem 1.25rem 1.5rem;
  flex: 1; display: flex; flex-direction: column; gap: 0.55rem;
}

.recipe-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.recipe-card-title {
  font-size: 1.1rem; font-weight: 800;
  color: var(--text); line-height: 1.3;
}

.recipe-card-desc {
  font-size: 0.85rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  flex: 1; font-weight: 400;
}

.recipe-card-meta {
  display: flex; align-items: center; gap: 1rem;
  margin-top: auto; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.meta-item {
  font-size: 0.8rem; color: var(--text-dim);
  display: flex; align-items: center; gap: 0.3rem;
  font-weight: 500;
}

/* Difficulty badge */
.difficulty-badge {
  position: absolute; top: 0.75rem; right: 0.75rem;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 0.25rem 0.65rem; border-radius: 99px;
  backdrop-filter: blur(8px);
}
.diff-easy   { background: rgba(22,163,74,0.9);   color: #fff; }
.diff-medium { background: rgba(234,179,8,0.92);  color: #1a1a1a; }
.diff-hard   { background: rgba(220,38,38,0.9);   color: #fff; }

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem; padding: 5rem 2rem; text-align: center;
}
.empty-state-icon { font-size: 3.5rem; opacity: 0.3; }
.empty-state h3   { color: var(--text-muted); }
.empty-state p    { font-size: 0.9rem; max-width: 320px; }

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════ */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 9999;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: 380px;
  opacity: 0; transform: translateY(1rem);
  transition: opacity var(--t), transform var(--t);
  pointer-events: none;
  border: 1px solid var(--border);
  background: var(--surface);
}
.toast-show { opacity: 1; transform: translateY(0); }

.toast-success { color: var(--success); }
.toast-success .toast-icon { background: var(--success-dim); }
.toast-error   { color: var(--danger); }
.toast-error .toast-icon   { background: var(--danger-dim); }
.toast-info    { color: var(--accent); }
.toast-info .toast-icon    { background: var(--info-dim); }

.toast-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  opacity: 0; transition: opacity var(--t);
}
.modal-overlay.modal-show { opacity: 1; }
.modal-overlay.modal-show .modal { transform: scale(1); opacity: 1; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95); opacity: 0;
  transition: transform var(--t), opacity var(--t);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.modal h3 { color: var(--text); }
.modal p   { color: var(--text-muted); font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }

/* ═══════════════════════════════════════
   TABLE
═══════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg); border-bottom: 1px solid var(--border); }
thead th {
  padding: 0.85rem 1.25rem;
  text-align: left; font-size: 0.73rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--t-fast); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td {
  padding: 1rem 1.25rem;
  font-size: 0.9rem; color: var(--text-muted); vertical-align: middle;
}
tbody td:first-child { color: var(--text); font-weight: 600; }
.table-empty { text-align: center; padding: 3rem !important; color: var(--text-dim) !important; }

/* ═══════════════════════════════════════
   INGREDIENT / STEP ROWS
═══════════════════════════════════════ */
.dynamic-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.dynamic-row .row-number {
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 0.75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 0.6rem;
}
.dynamic-row .btn-remove {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--danger-dim); color: var(--danger);
  border: none; font-size: 1rem; display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; margin-top: 0.5rem; transition: background var(--t-fast);
}
.dynamic-row .btn-remove:hover { background: rgba(220,38,38,0.18); }

/* ═══════════════════════════════════════
   PHOTO PREVIEW
═══════════════════════════════════════ */
.photo-preview {
  position: relative; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16/9; background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-placeholder {
  color: var(--text-dim); font-size: 0.85rem;
  text-align: center; padding: 2rem;
}
.photo-preview-placeholder span { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }

/* Tab group */
.tab-group {
  display: flex; gap: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px;
}
.tab-btn {
  flex: 1; padding: 0.45rem 1rem;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  transition: var(--t); border: none; background: none; cursor: pointer;
}
.tab-btn.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
