/* ------------------------------
   Базовые переменные и сброс
--------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
  transition: background-color 0.3s, color 0.2s, border-color 0.3s;
}

body {
  background: #f5f3f0;
  color: #1e1e1e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------
   ТЕМЫ (переключаются через классы на body)
--------------------------------- */
body.light {
  background: #f5f3f0;
  color: #1e1e1e;
}
body.light .card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
}
body.light .header {
  background: rgba(240, 235, 225, 0.85);
  backdrop-filter: blur(6px);
}
body.light .footer {
  background: rgba(220, 215, 205, 0.6);
}

body.dark {
  background: #1e1e1e;
  color: #e0e0e0;
}
body.dark .card {
  background: rgba(50, 50, 50, 0.7);
  backdrop-filter: blur(2px);
}
body.dark .header {
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(6px);
}
body.dark .footer {
  background: rgba(40, 40, 40, 0.6);
}
body.dark .vine-overlay {
  opacity: 0.3;
}

body.olive {
  background: #d9d2c0;
  color: #2e3b2b;
}
body.olive .card {
  background: rgba(200, 190, 170, 0.7);
}
body.olive .header {
  background: rgba(180, 170, 150, 0.8);
}
body.olive .footer {
  background: rgba(160, 150, 130, 0.6);
}

body.scandi {
  background: #eae7de;
  color: #2c2b28;
}
body.scandi .card {
  background: rgba(235, 230, 220, 0.7);
}
body.scandi .header {
  background: rgba(220, 215, 200, 0.8);
}
body.scandi .footer {
  background: rgba(200, 195, 180, 0.6);
}
body.scandi .header-inner {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M10 10 L90 10 L90 90 L10 90 Z" fill="none" stroke="%23b8a99a" stroke-width="0.5"/><circle cx="30" cy="30" r="2" fill="%23b8a99a"/><circle cx="70" cy="70" r="2" fill="%23b8a99a"/></svg>');
  background-repeat: repeat;
  background-size: 60px 60px;
}

body.loft {
  background: #c9c1b0;
  color: #1f1e1b;
}
body.loft .card {
  background: rgba(180, 170, 155, 0.7);
}
body.loft .header {
  background: rgba(160, 150, 135, 0.8);
}
body.loft .footer {
  background: rgba(140, 130, 115, 0.6);
}
body.loft .header-inner {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect x="0" y="0" width="30" height="30" fill="%23a0907a" opacity="0.15"/><rect x="30" y="30" width="30" height="30" fill="%23a0907a" opacity="0.15"/></svg>');
  background-repeat: repeat;
}

/* ------------------------------
   Хедер
--------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(4px);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1300px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  position: relative;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-title {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #2f5d3a, #4b7a4b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.qr-code {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: white;
  padding: 3px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s;
}
.qr-code:hover {
  transform: scale(1.04);
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.65;
  letter-spacing: 0.02em;
  font-weight: 300;
  color: inherit;
}

.header-right {
  display: flex;
  align-items: center;
}

.theme-toggle {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 30px;
  transition: background 0.2s, transform 0.15s;
}
.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: scale(1.08);
}

/* Обвивание лианой */
.vine-overlay {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 18px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 30" preserveAspectRatio="none"><path d="M0 15 Q100 0 200 15 T400 15 T600 15 T800 15 T1000 15 T1200 15" stroke="%233f7a4a" stroke-width="3" fill="none"/><path d="M0 20 Q150 5 300 20 T600 20 T900 20 T1200 20" stroke="%235a9a5a" stroke-width="2.5" fill="none" opacity="0.6"/><path d="M0 25 Q200 10 400 25 T800 25 T1200 25" stroke="%237ab87a" stroke-width="2" fill="none" opacity="0.35"/></svg>') repeat-x;
  background-size: 1200px 30px;
  opacity: 0.9;
  pointer-events: none;
  transition: opacity 0.4s;
  will-change: transform;
}

.header:hover .vine-overlay {
  animation: vineCrawl 8s linear infinite;
}

@keyframes vineCrawl {
  0% { background-position-x: 0; }
  100% { background-position-x: 1200px; }
}

/* ------------------------------
   Фильтры
--------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1300px;
  margin: 0 auto 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.8;
}

.filter-group label {
  text-transform: uppercase;
  font-size: 0.65rem;
  opacity: 0.6;
  letter-spacing: 0.04em;
}

.filter-group select {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 30px;
  padding: 0.35rem 1rem 0.35rem 1.2rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: inherit;
  outline: none;
  transition: 0.2s;
}
.filter-group select:hover {
  background: rgba(255, 255, 255, 0.7);
}

.btn-add {
  margin-left: auto;
  background: #3f7a4a;
  border: none;
  padding: 0.5rem 1.8rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(55, 110, 60, 0.2);
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-add:hover {
  background: #2d5f38;
  transform: scale(1.02);
}

/* ------------------------------
   Сетка карточек
--------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.8rem;
  padding: 1.5rem 2rem 2.5rem;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.card {
  border-radius: 24px;
  padding: 1.2rem 1.2rem 1.5rem;
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.15s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
}

.card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: 0.2s;
}
.card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 16px;
  aspect-ratio: 1 / 1;
  color: #aaa;
  font-size: 0.9rem;
  border: 1px dashed rgba(0, 0, 0, 0.08);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 0.2rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

.card-actions button {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 40px;
  padding: 0.2rem 0.9rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: 0.15s;
  color: inherit;
}
.card-actions button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.card-actions .photo-btn {
  border-color: #5f8b6b;
  color: #2f5d3a;
}
.card-actions .photo-btn:hover {
  background: rgba(60, 120, 70, 0.1);
}

.card-actions .delete-btn {
  border-color: #b35f5f;
  color: #a14141;
}
.card-actions .delete-btn:hover {
  background: rgba(180, 60, 60, 0.08);
}

/* ------------------------------
   Подвал
--------------------------------- */
.footer {
  margin-top: auto;
  padding: 1.2rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.6;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(2px);
}

/* ------------------------------
   Адаптив
--------------------------------- */
@media (max-width: 700px) {
  .header {
    padding: 0.8rem 1rem;
  }
  .brand-title {
    font-size: 1.3rem;
  }
  .qr-code {
    width: 36px;
    height: 36px;
  }
  .filters {
    padding: 1rem;
    gap: 0.8rem;
  }
  .btn-add {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
    padding: 1rem;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
