/* ===== GLOBALNE VARIJABLE ===== */
:root {
  --primary-bg: #f8f8f8;
  --text-color: #333;
  --light-text: #fff;
  --border-color: #e0e0e0;
  --accent-color: #eba14c;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --modal-bg: rgba(0, 0, 0, 0.9);
  --btn-radius: 20px;
  --transition-speed: 0.3s;
  --mobile-bp: 768px;
  --small-mobile-bp: 480px;
}

/* ===== GLAVNI STILOVI ===== */
body {
  font-family: "Montserrat", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  margin: 0;
  padding: 0;
  color: var(--text-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Forum", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

main {
  padding: 1.25rem;
  min-height: 100vh;
}

/* ===== NAVIGACIJA KATEGORIJA ===== */
.category-nav {
  background-color: var(--primary-bg);
  padding: 0.9375rem 0;
  position: sticky;
  top: 99px;
  z-index: 100;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border-color);
}

.category-nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.9375rem;
  flex-wrap: wrap;
}

.category-nav a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  padding: 0.5rem 0.9375rem;
  border-radius: var(--btn-radius);
  transition: all var(--transition-speed) ease;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.category-nav a:hover,
.category-nav a.active {
  background-color: var(--text-color);
  color: var(--light-text);
}

/* ===== NAZAD NA VRH DUGME ===== */
.back-to-top {
  position: fixed;
  bottom: 1.875rem;
  right: 1.875rem;
  width: 3.125rem;
  height: 3.125rem;
  border-radius: 50%;
  background-color: rgba(51, 51, 51, 0.8);
  color: var(--light-text);
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--text-color);
  transform: translateY(-0.1875rem);
}

/* ===== KATEGORIJA SEKCIJA ===== */
.category {
  display: flex;
  justify-content: space-between;
  margin: 1.25rem auto 3.125rem;
  padding-bottom: 2.5rem;
  height: 90vh;
  max-width: 75rem;
  width: 100%;
  overflow-y: hidden;
  border: 3px solid var(--accent-color);
  border-left: none;
  border-right: none;
  background-color: rgb(250, 250, 250);
}

.image-container {
  display: flex;
  width: 40%;
  height: 100%;
  align-items: center;
}

.image-container img {
  width: 100%;
  height: 110%;
  object-fit: cover;
}

.text-container {
  width: 60%;
  padding: 1.25rem;
}

.naslov {
  font-size: 2.125rem;
  margin-top: 0;
  text-align: center;
}

.desno {
  font-size: 2.125rem;
  text-align: center;
}

.opis {
  font-size: 1rem;
  line-height: 1.5;
  text-align: justify;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.625rem;
}

/* ===== THUMBNAIL SLIDER ===== */
.thumbnail-slider {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9375rem;
  margin-top: 1.25rem;
  overflow-y: auto;
  max-height: 70%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.625rem;
}

.thumbnail-slider::-webkit-scrollbar {
  display: none;
}

.thumbnail-slider img {
  width: 12.5rem;
  height: 9.375rem;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  border-radius: 0.25rem;
  box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
  background-color: #f0f0f0;
  background-image: linear-gradient(
      45deg,
      #e0e0e0 25%,
      transparent 25%,
      transparent 75%,
      #e0e0e0 75%,
      #e0e0e0
    ),
    linear-gradient(
      45deg,
      #e0e0e0 25%,
      transparent 25%,
      transparent 75%,
      #e0e0e0 75%,
      #e0e0e0
    );
  background-size: 1.25rem 1.25rem;
  background-position: 0 0, 0.625rem 0.625rem;
}

.thumbnail-slider img:hover {
  transform: scale(1.05);
  box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-bg);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal img {
  max-height: 90%;
  max-width: 90%;
  cursor: pointer;
  transition: transform var(--transition-speed);
}

.modal img:hover {
  transform: scale(1.02);
}

.modal span {
  position: absolute;
  top: 1.25rem;
  color: var(--light-text);
  font-size: 2.1875rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.modal span:hover {
  color: #ccc;
}

.modal span:first-child {
  right: 1.875rem;
}

.modal span:nth-child(2) {
  left: 1.875rem;
  font-size: 1.875rem;
}

/* ===== RESPONZIVNOST ===== */
@media (max-width: 1024px) {
  /* Tablet stilovi */
  .category {
    flex-direction: column;
    height: auto;
    margin-bottom: 2.5rem;
    border: none;
    background-color: transparent;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .image-container {
    display: none;
  }

  .text-container {
    width: 100%;
    padding: 0;
  }

  .naslov,
  .desno {
    font-size: 1.8rem;
    margin: 0 0 1rem 0;
    text-align: left;
    padding-left: 0.5rem;
    position: relative;
    color: var(--text-color);
    width: fit-content;
  }

  .naslov::after,
  .desno::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 60%;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 2px;
  }

  .opis {
    display: none;
  }

  .thumbnail-slider {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 0.8rem;
    overflow: visible;
    max-height: none;
    padding: 0;
    margin-top: 0;
  }

  .thumbnail-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease;
  }

  .thumbnail-slider img:hover {
    transform: scale(1.03);
  }
}

@media (max-width: 768px) {
  /* Mobilni stilovi */
  .category-nav {
    top: 80px;
    padding: 0.5rem 0;
  }

  .category-nav ul {
    gap: 0.5rem;
    padding: 0 0.5rem;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .category-nav ul::-webkit-scrollbar {
    display: none;
  }

  .category-nav a {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  .back-to-top {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.125rem;
    bottom: 1.25rem;
    right: 1.25rem;
  }

  .thumbnail-slider {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
  }
}

@media (max-width: 480px) {
  /* Mali mobilni uređaji */
  .thumbnail-slider {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(120px, auto);
  }

  .naslov,
  .desno {
    font-size: 1.5rem;
  }
}

/* Osiguraj minimalno 5 redova */
@media (min-height: 800px) {
  @media (max-width: 1024px) {
    .thumbnail-slider {
      min-height: calc(5 * (150px + 0.8rem));
    }
  }
}
