/* Korisnički prikaz: centriranje i broj kolona ovisno o broju obrazaca (ne utječe na admina) */
.obrasci-lista.obrasci-lista-1 {
  grid-template-columns: 1fr !important;
  justify-content: center;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.obrasci-lista.obrasci-lista-2 {
  grid-template-columns: repeat(2, 1fr) !important;
  justify-content: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.obrasci-lista.obrasci-lista-3 {
  grid-template-columns: repeat(3, 1fr) !important;
  justify-content: center;
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
}
.obrasci-section {
  min-height: 100vh;
  background: linear-gradient(180deg, #181c22 0%, #232526 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 0 60px 0;
}

.obrasci-container {
  max-width: 1500px;
  margin: 80px auto 0 auto;
  background: rgba(28, 30, 36, 0.98);
  border-radius: 22px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.25);
  padding: 2.5rem 1.5rem 2rem 1.5rem;
  color: #f3f3f3;
  position: relative;
  z-index: 2;
}

.obrasci-naslov {
  text-align: center;
  font-size: 2.2rem;
  color: #ffe066;
  margin-bottom: 2.2rem;
  letter-spacing: 2px;
  text-shadow: 0 2px 12px #000, 0 0 8px #1f1f1f;
  font-weight: 700;
}

@media (max-width: 700px) {
  .obrasci-naslov {
    font-size: 1.35rem;
    margin-bottom: 1.2rem;
  }
}
@media (max-width: 1000px) {
  .obrasci-naslov {
    font-size: 1.7rem;
  }
}

/* Token pristup stilovi */
.token-pristup-container {
  background: rgba(28, 30, 36, 0.98); /* identična kao .obrasci-container */
  /* border: 2px solid #ffe066; uklonjeno na zahtjev */
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.token-pristup-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.token-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.token-label {
  color: #ffe066;
  font-size: 1.2rem;
  font-weight: 600;
}

.token-input {
  background: #232526;
  color: #ffe066;
  border: 2px solid #ffe066cc;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-size: 1.2rem;
  text-align: center;
  letter-spacing: 2px;
  font-weight: 600;
  width: 280px;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

/* Smanji placeholder tekst u inputu za token */
.token-input::placeholder {
  font-size: 1.1rem;
  letter-spacing: 1px;
  text-transform: none;
  font-family: inherit;
}

.token-input:focus {
  outline: none;
  border-color: #ffe066;
  box-shadow: 0 0 0 4px rgba(255, 224, 102, 0.15);
  transform: translateY(-1px);
}

.token-submit-btn {
  background: linear-gradient(135deg, #ffe066 0%, #ffed80 100%);
  color: #232526;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 224, 102, 0.3);
}

.token-submit-btn:hover {
  background: linear-gradient(135deg, #ffed80 0%, #fff4a3 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 224, 102, 0.4);
}

.token-submit-btn:active {
  transform: translateY(-1px);
}

.token-submit-btn:active {
  transform: translateY(0);
}

.token-poruka {
  min-height: 0;
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 1rem;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  border: none;
  display: none; /* Sakrij dok nema poruke */
}

.token-poruka.error {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 0.8rem 1.5rem;
  display: block;
}

.token-poruka.success {
  color: #4dff7a;
  background: rgba(77, 255, 122, 0.1);
  border: 1px solid rgba(77, 255, 122, 0.3);
  padding: 0.8rem 1.5rem;
  display: block;
}

/* Admin pristup stilovi */
.admin-pristup-toggle {
  margin-top: 0.5rem;
}

.admin-toggle-btn {
  background: transparent;
  color: #ffe066cc;
  border: 1px solid #ffe066cc;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-toggle-btn:hover {
  color: #ffe066;
  border-color: #ffe066;
  background: rgba(255, 224, 102, 0.1);
}

.admin-pristup-form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ffe066cc;
  width: 100%;
}

.admin-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.admin-label {
  color: #ffe066;
  font-size: 1.1rem;
  font-weight: 500;
}

.admin-input {
  background: #232526;
  color: #ffe066;
  border: 2px solid #ffe066cc;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  width: 280px;
  text-align: center;
  transition: all 0.2s ease;
}

.admin-input:focus {
  outline: none;
  border-color: #ffe066;
  box-shadow: 0 0 0 4px rgba(255, 224, 102, 0.15);
  transform: translateY(-1px);
}

.admin-submit-btn {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.admin-submit-btn:hover {
  background: linear-gradient(135deg, #ff5252 0%, #f44336 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.admin-submit-btn:active {
  transform: translateY(-1px);
}

.obrasci-lista {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
  margin-top: 2rem;
  justify-content: center;
}

/* Centriraj jednu karticu (npr. kad korisnik vidi samo svoj obrazac) */
.obrasci-lista:only-child,
.obrasci-lista.single-obrazac {
  grid-template-columns: 1fr !important;
  justify-content: center;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* Centriraj karticu unutar grida */
.obrasci-lista.single-obrazac .obrasci-kartica {
  margin-left: auto;
  margin-right: auto;
}

/* Responsive grid: tablet = 2 stupca, mobitel = 1 stupac */
@media (max-width: 1100px) {
  .obrasci-lista {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .obrasci-lista {
    grid-template-columns: 1fr;
  }
}

.obrasci-kartica {
  background: #232526;
  border-radius: 18px;
  box-shadow: 0 4px 18px #0005;
  border: 2px solid transparent;
  padding: 1.3em 1.5em 1.1em 1.5em;
  color: #ffe066;
  position: relative;
  transition: box-shadow 0.18s, border 0.18s, transform 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.obrasci-kartica:hover {
  box-shadow: 0 10px 36px #ffe06644, 0 2px 12px #0007;
  border: 2px solid #ffe066;
  transform: scale(1.025);
}

.obrasci-kartica.proslo {
  opacity: 0.55;
  border: 2px solid #ff4d4d;
  color: #ffb3b3;
  background: #232526cc;
}

.obrasci-kartica .obrasci-datum {
  font-size: 1.08rem;
  font-weight: 600;
  color: #ffe066;
  margin-bottom: 0.15em;
  display: block;
  letter-spacing: 1px;
  text-align: center;
  width: 100%;
}

.obrasci-kartica .obrasci-imena {
  font-size: 1.18rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2em;
  display: block;
  letter-spacing: 0.5px;
  text-align: center;
  width: 100%;
}

.obrasci-kartica .obrasci-sala {
  font-size: 1.08rem;
  font-weight: 600;
  color: #ffe066;
  margin-bottom: 0.2em;
  display: block;
  text-align: center;
  width: 100%;
  letter-spacing: 0.5px;
}

.obrasci-kartica .obrasci-polje {
  margin-bottom: 0.3em;
  font-size: 1.01rem;
  color: #ffe066;
}

.obrasci-polje {
  margin-bottom: 0.5em;
}

.obrasci-polje .obrasci-label {
  font-weight: 600;
  color: #ffe066;
}

.obrasci-polje span:not(.obrasci-label),
.obrasci-polje .obrasci-polje-vrijednost {
  color: #fff;
}

.obrasci-polje-vrijednost {
  color: #fff;
  font-size: 1.08rem;
  font-weight: 600;
}

.obrasci-kartica .obrasci-label {
  font-weight: 600;
  color: #ffe066;
}

.obrasci-loading {
  color: #ffe066;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 500;
  opacity: 0.9;
  margin: 2rem 0;
  padding: 2rem;
  grid-column: 1 / -1; /* Stretches across all grid columns */
}

.obrasci-modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(24, 28, 34, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
}

.obrasci-modal-content {
  background: #232526;
  border-radius: 18px;
  box-shadow: 0 8px 32px #000a;
  border: 3px solid #ffe066;
  color: #ffe066;
  padding: 0; /* Ukloni padding da ga preuzme scroll container */
  max-width: 98vw;
  max-height: 90vh;
  overflow: hidden; /* Ukloni scroll s glavnog kontejnera */
  min-width: 320px;
  font-size: 1.08rem;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Test - dodaj crvenu pozadinu da vidimo da li se CSS učitava */
  /* border-left: 5px solid red; */
}

/* Scroll container - unutrašnji div koji se stvarno scroll-a */
.obrasci-scroll-container {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding: 2.2em 2.5em 1.5em 1.5em; /* Povećaj desni padding za odvajanje od scroll bar-a */
  scrollbar-gutter: auto !important; /* Ukloni rezervirani prostor za scroll bar */
  scrollbar-width: auto !important; /* Širi scroll bar za Firefox */
  scrollbar-color: #ffe066 rgba(35, 37, 38, 0.8) !important; /* Jasniji colors za Firefox */
  /* Poboljšana scroll stabilnost */
  overscroll-behavior: contain;
  /* Eksplicitno uklanjanje svih granica */
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  scroll-behavior: smooth;
  /* Dodatni fix za visinu */
  min-height: 0; /* Omogući flexbox shrinking */
  max-height: 100%; /* Ne prekorači parent */
  height: 100%; /* Zauzmi cijelu visinu parent-a */
  /* Dodaj focus outline za keyboard navigaciju */
  outline: none;
  /* Dodatni fix za scroll stabilnost */
  will-change: scroll-position;
  transform: translateZ(0); /* Force hardware acceleration */
  /* Sprječava "bouncing" na touch uređajima */
  -webkit-overflow-scrolling: touch;
  /* Bolja kontrola scroll-a */
  scroll-snap-type: y proximity;
  /* Dodatni margin s desne strane za scroll bar */
  margin-right: 8px; /* Povećaj razmak između sadržaja i scroll bar-a */
  /* Backup universal scroll styling */
  border-right: 2px solid rgba(255, 224, 102, 0.1); /* Visual border da vidimo granicu */
}

.obrasci-modal-content h2 {
  color: #ffe066;
  font-size: 1.25rem;
  margin-bottom: 1em;
  text-align: center;
}

.obrasci-modal-content .obrasci-polje {
  margin-bottom: 0.5em;
  color: #fff;
}

.obrasci-modal-content .obrasci-label {
  font-weight: 600;
  color: #ffe066;
}

/* Poboljšan scroll bar za WebKit preglednike (Chrome, Safari, Edge) */
.obrasci-modal-content::-webkit-scrollbar,
.obrasci-scroll-container::-webkit-scrollbar {
  width: 8px !important; /* Umjereno širok scroll bar */
  background: transparent !important; /* Ukloni pozadinu da nema liniju */
}

.obrasci-modal-content::-webkit-scrollbar-thumb,
.obrasci-scroll-container::-webkit-scrollbar-thumb {
  background: #ffe066 !important; /* Jasnija žuta boja */
  border-radius: 6px !important; /* Smanji border-radius */
  border: 1px solid #232526 !important; /* Tanji border */
  min-height: 25px !important; /* Smanji minimum visinu */
  transition: background 0.2s, border-color 0.2s;
}

.obrasci-modal-content::-webkit-scrollbar-thumb:hover,
.obrasci-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #fff !important; /* Bijela na hover za bolju vidljivost */
  border-color: #ffe066 !important; /* Žuti border na hover */
}

.obrasci-modal-content::-webkit-scrollbar-track,
.obrasci-scroll-container::-webkit-scrollbar-track {
  background: transparent !important; /* Potpuno transparentno bez linije */
  border-radius: 6px !important; /* Uskladi s thumb */
  margin: 8px 0 !important; /* Smanji margin */
  border: none !important; /* Ukloni sve bordere */
}

.obrasci-modal-content::-webkit-scrollbar-button,
.obrasci-scroll-container::-webkit-scrollbar-button {
  height: 14px !important; /* Manje strelice za umjeren look */
  width: 8px !important; /* Uskladi širinu s scroll bar-om */
  background: rgba(
    255,
    224,
    102,
    0.4
  ) !important; /* Malo jasniji za vidljivost */
  border-radius: 3px !important; /* Manji radius */
  transition: background 0.2s;
}

.obrasci-modal-content::-webkit-scrollbar-button:hover,
.obrasci-scroll-container::-webkit-scrollbar-button:hover {
  background: rgba(255, 224, 102, 0.8) !important; /* Jasniji hover */
}

/* Pojedinačno stiliziranje strelica */
.obrasci-modal-content::-webkit-scrollbar-button:single-button:vertical:decrement,
.obrasci-scroll-container::-webkit-scrollbar-button:single-button:vertical:decrement {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffe066'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.obrasci-modal-content::-webkit-scrollbar-button:single-button:vertical:increment,
.obrasci-scroll-container::-webkit-scrollbar-button:single-button:vertical:increment {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffe066'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.obrasci-modal-content::-webkit-scrollbar-corner,
.obrasci-scroll-container::-webkit-scrollbar-corner {
  background: transparent;
}

.obrasci-modal-close {
  position: absolute;
  top: 1.1em;
  right: 1.2em;
  font-size: 2.2rem;
  color: #ffe066;
  cursor: pointer;
  font-weight: 700;
  z-index: 2;
  text-shadow: 0 2px 12px #000, 0 0 8px #1f1f1f;
  transition: color 0.2s;
}

.obrasci-modal-close:hover {
  color: #fff;
}

.obrasci-modal-actions {
  display: flex;
  gap: 1em;
  margin-top: 1.5em;
  margin-bottom: 2em; /* Povećaj bottom margin */
  justify-content: center;
  padding: 1em 0 1.5em 0; /* Povećaj padding za bolje razmake */
  border-top: 1px solid #ffe06633; /* Vizualno odvojeni gumbovi */
  background: rgba(35, 37, 38, 0.9); /* Dodaj pozadinu da se gumbovi ističu */
  border-radius: 8px;
  position: relative; /* Osiguraj da je sekcija gumbova dobro pozicionirana */
}

.obrasci-modal-btn {
  background: #ffe066;
  color: #232526;
  border: none;
  border-radius: 8px;
  padding: 0.5em 1.3em;
  font-size: 1.04rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  margin-bottom: 0.5em;
  box-shadow: 0 2px 8px #0002;
}

.obrasci-modal-btn:hover {
  background: #fff;
  color: #232526;
}

.obrasci-link {
  color: #ffe066;
  word-break: break-all;
  font-size: 0.98em;
  display: block;
  margin-top: 0.1em;
}

.obrasci-ime-vrijednost {
  display: inline-block;
  color: #fff;
  border-radius: 8px;
  padding: 0.18em 0.7em;
  font-size: 1.08rem;
  font-weight: 600;
}

/* FINALNI OVERRIDE - Mora biti na kraju fajla! */
.obrasci-scroll-container::-webkit-scrollbar {
  width: 8px !important;
  background: transparent !important;
}

.obrasci-scroll-container::-webkit-scrollbar-thumb {
  background: #ffe066 !important;
  border-radius: 6px !important;
  border: 1px solid #232526 !important;
}

.obrasci-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #fff !important;
  box-shadow: 0 0 6px rgba(255, 224, 102, 0.5) !important;
}

.obrasci-scroll-container::-webkit-scrollbar-track {
  background: transparent !important;
  border-radius: 6px !important;
  border: none !important;
}

/* DODATNO ČIŠĆENJE - Uklanjanje svih mogućih linija */
.obrasci-scroll-container {
  border-right: none !important;
  margin-right: 0 !important;
  background-clip: padding-box !important;
}

.obrasci-scroll-container::before,
.obrasci-scroll-container::after {
  display: none !important;
}
