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

:root {
  --bg: #0f0f11;
  --surface: #18181c;
  --surface2: #1e1e24;
  --border: #2a2a32;
  --accent: #e8a95c;
  --accent2: #7b9e6b;
  --accent3: #6b8cbf;
  --danger: #c0524a;
  --text: #e8e6e0;
  --text2: #8a8680;
  --text3: #5a5650;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: 220px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  z-index: 100;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 12px 12px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
}

.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: rgba(232,169,92,0.12); color: var(--accent); }
.nav-link .icon { font-size: 16px; width: 20px; text-align: center; }
.nav-link .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-bottom {
  padding: 0 12px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text3);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
}
.logout-btn:hover { color: var(--danger); background: rgba(192,82,74,0.08); }

/* ── MAIN ── */
.main {
  margin-left: 220px;
  min-height: 100vh;
  padding: 32px 32px 48px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}

.page-header p {
  color: var(--text2);
  font-size: 13px;
  margin-top: 4px;
}

/* ── CARDS & GRID ── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card h3 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-card p {
  font-size: 12px;
  color: var(--text2);
  margin-top: 3px;
}

/* ── PRODUCT ITEM ── */
.item-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--surface2); }

.item-name { flex: 1; font-weight: 500; font-size: 14px; }
.item-location { font-size: 12px; color: var(--text2); }
.item-meta { font-size: 12px; color: var(--text3); }

.qty-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  min-width: 56px;
  text-align: center;
}

.qty-ok { background: rgba(123,158,107,0.15); color: #7b9e6b; }
.qty-low { background: rgba(232,169,92,0.15); color: var(--accent); }
.qty-empty { background: rgba(192,82,74,0.15); color: var(--danger); }

/* ── ADJUST BUTTONS ── */
.adjust-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-adj {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  line-height: 1;
}

.btn-adj:hover { border-color: var(--accent); color: var(--accent); }
.btn-adj.minus:hover { border-color: var(--danger); color: var(--danger); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #1a1000; }
.btn-primary:hover { background: #f0b86a; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: rgba(192,82,74,0.15); color: var(--danger); border: 1px solid rgba(192,82,74,0.2); }
.btn-danger:hover { background: rgba(192,82,74,0.25); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 7px; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
}

/* ── CATEGORY TAG ── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tag-dairy    { background: rgba(107,140,191,0.15); color: #6b8cbf; }
.tag-meat     { background: rgba(192,82,74,0.15);  color: #c0524a; }
.tag-vegetables { background: rgba(123,158,107,0.15); color: #7b9e6b; }
.tag-grains   { background: rgba(232,169,92,0.15); color: var(--accent); }
.tag-fruits   { background: rgba(180,130,70,0.15); color: #b48246; }
.tag-bakery   { background: rgba(170,120,80,0.15); color: #aa7850; }
.tag-oils     { background: rgba(200,180,90,0.15); color: #c8b45a; }
.tag-canned   { background: rgba(130,120,150,0.15); color: #827896; }
.tag-spices   { background: rgba(190,90,60,0.15); color: #be5a3c; }
.tag-other    { background: rgba(90,90,100,0.15); color: #5a5a64; }
.tag-laundry  { background: rgba(107,140,191,0.15); color: #6b8cbf; }
.tag-kitchen  { background: rgba(123,158,107,0.15); color: #7b9e6b; }
.tag-bathroom { background: rgba(107,160,180,0.15); color: #6ba0b4; }
.tag-toilet   { background: rgba(150,120,180,0.15); color: #9678b4; }
.tag-personal { background: rgba(180,110,140,0.15); color: #b46e8c; }
.tag-cleaning { background: rgba(90,110,130,0.15); color: #5a6e82; }

/* ── CHECKBOX TOGGLE ── */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text3);
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: rgba(123,158,107,0.3); border-color: var(--accent2); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--accent2); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 460px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin-bottom: 20px;
}

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}

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

.form-select option { background: var(--surface2); }
.form-textarea { resize: vertical; min-height: 80px; }

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

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── FILTERS BAR ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  transition: all 0.12s;
}

.filter-chip:hover, .filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,169,92,0.08);
}

.search-box {
  flex: 1;
  min-width: 180px;
  max-width: 260px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-box:focus { border-color: var(--accent); }

/* ── RECIPES ── */
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.recipe-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.recipe-card h4 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  margin-bottom: 6px;
}

.recipe-meta { font-size: 12px; color: var(--text2); display: flex; gap: 12px; margin-top: 10px; }
.recipe-avail { font-size: 12px; margin-top: 8px; }

/* ── TASKS ── */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface2); }
.task-row.done .task-title { text-decoration: line-through; color: var(--text3); }

.task-check {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.task-check.checked { background: var(--accent2); border-color: var(--accent2); }
.task-check.checked::after { content: '✓'; font-size: 12px; color: #fff; font-weight: 700; }

.priority-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.priority-high { background: var(--danger); }
.priority-normal { background: var(--accent); }
.priority-low { background: var(--text3); }

/* ── ALERTS ── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-warning { background: rgba(232,169,92,0.12); border: 1px solid rgba(232,169,92,0.25); color: var(--accent); }
.alert-danger  { background: rgba(192,82,74,0.12);  border: 1px solid rgba(192,82,74,0.25);  color: var(--danger); }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 360px;
  box-shadow: var(--shadow);
}

.login-box h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 4px;
}

.login-box .sub {
  text-align: center;
  color: var(--text3);
  font-size: 12px;
  margin-bottom: 28px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.error-msg {
  background: rgba(192,82,74,0.12);
  border: 1px solid rgba(192,82,74,0.25);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

.toast-ok { border-left: 3px solid var(--accent2); }
.toast-err { border-left: 3px solid var(--danger); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-logo, .nav-section-title, .nav-link span:not(.icon), .logout-btn span { display: none; }
  .nav-link { justify-content: center; }
  .main { margin-left: 60px; padding: 20px 16px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── RECIPE DETAIL ── */
.recipe-emoji {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}

.recipe-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.recipe-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
}

.step-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.step-row:last-child { border-bottom: none; }

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(232,169,92,0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.6;
  padding-top: 3px;
}

/* ── TASKS & SHOPPING (item-row variant) ── */
.task-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  transition: background 0.12s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--surface2); }
.task-item.done { opacity: 0.55; }

.task-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: transparent;
  transition: all 0.15s;
  user-select: none;
}

.task-check.checked {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

.task-check:hover { border-color: var(--accent); }

.strike { text-decoration: line-through; color: var(--text3); }

/* ── PRIORITY BADGES ── */
.priority-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.priority-high   { background: rgba(192,82,74,0.15);  color: var(--danger); }
.priority-normal { background: rgba(232,169,92,0.12); color: var(--accent); }
.priority-low    { background: rgba(90,90,100,0.15);  color: var(--text3); }

/* ── INGREDIENT ROW (recipe modal) ── */
.ingredient-row {
  margin-bottom: 8px;
}

/* ── MODAL WIDE (для рецептов) ── */
.modal-wide {
  width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ── GRID recipe cards fix ── */
#recipes-grid .recipe-card {
  display: flex;
  flex-direction: column;
}

/* ── CLEANING ── */
.clean-row {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.clean-row:last-child { border-bottom: none; }
.clean-row:hover { background: var(--surface2); }
.clean-row.overdue { background: rgba(192,82,74,0.04); }

.clean-zone-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.zone-Кухня         { background: #e8a95c; }
.zone-Ванная        { background: #6ba0b4; }
.zone-Туалет        { background: #9678b4; }
.zone-Гостиная      { background: #7b9e6b; }
.zone-Спальня       { background: #b46e8c; }
.zone-Коридор       { background: #8a8680; }
.zone-Балкон        { background: #6b8cbf; }
.zone-Весь_дом      { background: #aaaaaa; }

/* Бейджи частоты */
.freq-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.freq-daily    { background: rgba(192,82,74,0.15);  color: var(--danger); }
.freq-weekly   { background: rgba(232,169,92,0.15); color: var(--accent); }
.freq-biweekly { background: rgba(123,158,107,0.15); color: var(--accent2); }
.freq-monthly  { background: rgba(107,140,191,0.15); color: var(--accent3); }
.freq-seasonal { background: rgba(150,120,180,0.15); color: #9678b4; }

/* ── ALERT OK ── */
.alert-ok { background: rgba(123,158,107,0.12); border: 1px solid rgba(123,158,107,0.25); color: var(--accent2); }
