@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* LIGHT MODE (DEFAULT) */
:root {
  --bg-color: #f8f8f6;
  --card-bg: #ffffff;
  --text-main: #111111;
  --text-muted: #666666;
  --border-color: #e5e5e0;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 10px;
}

/* DARK MODE (AUTO) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #f0f0f0;
    --text-muted: #a0a0a0;
    --border-color: #2c2c2c;
  }
  .brand-logo {
    filter: invert(1) brightness(2);
  }
}

/* BASE RESET */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/bg.jpg'); 
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  opacity: 0.15;
  filter: saturate(0.2);
}

/* HEADER */
.site-header { 
  padding: 24px 20px 16px; 
  text-align: center; 
}

.brand-logo {
  max-height: 110px;
  margin: -20px auto -20px auto;
  display: block;
}

.brand-text { 
  font-size: 1.8rem; 
  font-weight: 800; 
  letter-spacing: 2px; 
}

/* SEARCH */
.search-container { 
  padding: 0 16px 16px 16px; 
  max-width: 600px; 
  margin: 0 auto; 
}

.search-input {
  width: 100%; 
  padding: 12px 16px; 
  font-size: 1rem; 
  font-family: inherit;
  background-color: var(--card-bg); 
  color: var(--text-main);
  border: 1px solid var(--border-color); 
  border-radius: var(--radius); 
  outline: none;
}

.search-input:focus { 
  border-color: var(--text-muted); 
}

/* GRID */
.category-grid {
  display: grid; 
  grid-template-columns: repeat(2, 1fr); 
  gap: 12px;
  padding: 0 16px 40px 16px; 
  max-width: 600px; 
  margin: 0 auto;
}

@media (min-width: 640px) { 
  .category-grid { 
    grid-template-columns: repeat(3, 1fr); 
  } 
}

.category-card {
  position: relative; 
  height: 130px; 
  border-radius: var(--radius);
  overflow: hidden; 
  background-color: var(--card-bg);
  border: 1px solid var(--border-color); 
  cursor: pointer;
  display: flex; 
  align-items: flex-end; 
  padding: 12px;
  transition: transform 0.1s ease;
}

.category-card:active { 
  transform: scale(0.97); 
}

.category-bg {
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  object-fit: cover; 
  z-index: 0;
}

.category-card::before {
  content: ""; 
  position: absolute; 
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 20%, rgba(0,0,0,0.8) 100%); 
  z-index: 1;
}

.category-title {
  position: relative; 
  z-index: 2; 
  color: #fff; 
  font-size: 0.85rem;
  font-weight: 700; 
  letter-spacing: 0.5px;
}

/* PRODUCT VIEW & STICKY HEADER (LIQUID GLASS) */
.product-view { 
  max-width: 600px; 
  margin: 0 auto; 
  padding: 0 16px 40px 16px; 
}

/* PRODUCT VIEW & STICKY HEADER (TRUE LIQUID GLASS) */
.product-view { 
  max-width: 600px; 
  margin: 0 auto; 
  padding: 0 16px 40px 16px; 
}

/* STICKY HEADER (LIQUID GLASS + CENTERED TITLE) */
/* STICKY HEADER - CSS GRID РЕШЕНИЕ */
.sticky-header {
  position: -webkit-sticky; 
  position: sticky; 
  top: 0;
  z-index: 100; 
  padding: 16px; 
  margin-left: -16px; 
  margin-right: -16px;
  
  /* CSS Grid магијата што спречува преклопување */
  display: grid;
  grid-template-columns: 90px 1fr 90px; /* 90px лево, средина за наслов, 90px десно */
  align-items: center;
  min-height: 64px;
  
  /* SHMEK ЕФЕКТ */
  background: rgba(255, 255, 255, 0.15); 
  backdrop-filter: blur(16px) saturate(200%);
  -webkit-backdrop-filter: blur(16px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .sticky-header { 
    background: rgba(20, 20, 20, 0.25); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.12); 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
}

/* КОПЧЕ НАЗАД - КРУЖНА СТРЕЛКА */
.back-btn {
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: var(--card-bg); 
  border: 1px solid var(--border-color);
  color: var(--text-main); 
  cursor: pointer; 
  width: 42px; 
  height: 42px; 
  border-radius: 50%; /* Го прави копчето перфектен круг */
  padding: 0; 
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.back-btn:active {
  transform: scale(0.9);
  background: var(--border-color);
}

/* Прилагодување за Dark Mode */
@media (prefers-color-scheme: dark) {
  .back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  .back-btn:active {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* НАСЛОВ - ЗАКЛУЧЕН ВО СРЕДНАТА КОЛОНА */
.category-header-title { 
  font-size: 1.15rem; 
  font-weight: 700; 
  letter-spacing: 1px; 
  text-transform: uppercase;
  margin: 0;
  color: var(--text-main);
  text-align: center;
  
  /* Заштита од долги имиња */
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}
/* PRODUCT LIST - ПРЕМИУМ ИЗГЛЕД */
.product-item {
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 20px 8px; /* Мал простор од страните за да дише */
  border-bottom: 1px solid var(--border-color); 
  animation: fadeIn 0.3s ease forwards; 
  opacity: 0;
  border-radius: 12px; /* Заоблени агли за клик ефектот */
  transition: background-color 0.2s ease, transform 0.1s ease;
}

/* Ефект при допир (Интерактивност како вистинска апликација) */
.product-item:active {
  background-color: rgba(0, 0, 0, 0.03);
  transform: scale(0.98);
}
@media (prefers-color-scheme: dark) {
  .product-item:active { 
    background-color: rgba(255, 255, 255, 0.04); 
  }
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 6px; /* Малку поголем простор помеѓу името и описот */
  padding-right: 16px;
}

.product-name { 
  font-size: 1.15rem; 
  font-weight: 600; 
  color: var(--text-main);
  letter-spacing: 0.2px; 
  line-height: 1.2;
}

.product-desc {
  font-size: 0.85rem;
  font-weight: 400; /* Малку почитливо од претходно */
  color: var(--text-muted);
  line-height: 1.35;
  display: flex;
  gap: 6px;
}

/* Елегантна точка што автоматски се додава пред секој опис */
.product-desc::before {
  content: "•";
  opacity: 0.5;
}

/* Цена во форма на пилула (Pill Badge) */
.product-price { 
  font-size: 1rem; 
  font-weight: 700; 
  color: var(--text-main);
  white-space: nowrap; 
  padding: 6px 14px;
  border-radius: 20px; /* Го прави целосно заоблено */
  background: var(--bg-color); /* Контрастна позадина */
  border: 1px solid var(--border-color); 
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03); /* Многу мека, невидлива сенка */
}

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(5px); } 
  to { opacity: 1; transform: translateY(0); } 
}

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(5px); } 
  to { opacity: 1; transform: translateY(0); } 
}

.no-results { 
  text-align: center; 
  color: var(--text-muted); 
  margin-top: 20px; 
  font-size: 0.9rem; 
}

.site-footer { 
  text-align: center; 
  padding: 20px; 
  font-size: 0.8rem; 
  color: var(--text-muted); 
}

/* Центрирање на последната (11-та) картичка во гридот */
.category-card:last-child:nth-child(odd) {
  grid-column: 1 / -1; /* Зафаќа простор од двата краја */
  justify-self: center; /* Ја турка картичката точно во средина */
  width: calc(50% - 6px); /* Ја задржува истата ширина како сите други картички */
}

/* Прилагодување за компјутер/таблет каде што има 3 колони */
@media (min-width: 640px) {
  .category-card:last-child:nth-child(odd) {
    width: calc(33.333% - 8px);
  }
}