:root {
  --primary: #0052cc;
  --primary-hover: #003d99;
  --bg-color: #f4f7fa;
  --surface: #ffffff;
  --text-main: #172b4d;
  --text-muted: #5e6c84;
  --border: #dfe1e6;
  --radius: 8px;
  --shadow: 0 4px 6px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

/* Zaključavanje visine na desktopu da bi pretraga bila fiksna, a samo tabela skrolovala */
body { background: var(--bg-color); color: var(--text-main); height: 100vh; overflow: hidden; }

/* Layout struktura */
#app-container { display: flex; flex-direction: column; height: 100vh; }

.topbar { 
  background: var(--primary); color: white; padding: 1rem 2rem; 
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 1000; flex-shrink: 0; 
  display: flex; justify-content: space-between; align-items: center;
}
.logo { font-size: 1.5rem; font-weight: 700; }
.logo span { font-weight: 400; opacity: 0.8; }

/* Analiza dugme u hederu */
.analysis-btn {
  background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.4);
  color: white; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; transition: all 0.2s ease; display: flex; align-items: center; gap: 8px;
}
.analysis-btn:hover { background: rgba(255, 255, 255, 0.25); border-color: rgba(255, 255, 255, 0.8); }
.badge { background: #f44336; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; }

/* Fiksni Layout za Desktop */
.layout { 
  display: grid; grid-template-columns: 360px 1fr; gap: 2rem; padding: 1rem; 
  max-width: 1800px; margin: 0 auto; width: 100%; height: calc(100vh - 72px); overflow: hidden; 
}

/* Sidebar & ATC Tree */
.sidebar { 
  background: var(--surface); padding: 0.5rem; border-radius: var(--radius); 
  box-shadow: var(--shadow); height: 100%; overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar h3 { margin-bottom: 1rem;  margin-left: 1.5rem; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px;}

.atc-tree details { margin-left: 0.1rem; margin-top: 0.2rem; }
.atc-tree summary { 
  display: flex; align-items: flex-start; gap: 8px; padding: 8px; 
  border-radius: 6px; cursor: pointer; transition: all 0.2s; list-style: none; /* Sakrivanje default strelice */
}
.atc-tree summary::-webkit-details-marker { display: none; }
.atc-tree summary:hover { background: #eef2f5; }

/* Custom ATC Strelice */
.atc-arrow { display: inline-block; transition: transform 0.2s; font-size: 0.75rem; color: var(--text-muted); padding-top: 3px; width: 12px;}
.atc-arrow-empty { display: inline-block; width: 12px; }
details[open] > summary .atc-arrow { transform: rotate(90deg); color: var(--primary); }

/* Root bold */
.atc-root .atc-node-text { font-weight: 700; font-size: 0.95rem; }
.atc-node-text { flex: 1; line-height: 1.4; font-size: 0.9rem; }
.atc-badge { flex-shrink: 0; background: #dfe1e6; color: #42526e; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }

/* ATC Highlights */
.atc-active { background: #e0f0ff !important; border-left: 4px solid var(--primary); }
.atc-active .atc-node-text { color: var(--primary); font-weight: 700; }
.atc-active .atc-badge { background: var(--primary); color: white; }

.atc-path { background: rgba(0, 82, 204, 0.05); }
.atc-path .atc-node-text { color: var(--primary); font-weight: 600; }

.atc-node {
  /* ... tvoji postojeći stilovi ... */
  user-select: none; /* Sprečava plavo markiranje teksta pri kliktanju */
  -webkit-user-select: none; /* Za Safari */
  -moz-user-select: none; /* Za Firefox */
  -ms-user-select: none; /* Za IE/Edge */
}

/* Takođe je dobra praksa isključiti selekciju i na strelicama i bedževima */
.atc-arrow, .atc-badge, .nav-item {
  user-select: none;
  -webkit-user-select: none;
}

/* Main Content */
.content { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; flex-shrink: 0;}
.breadcrumb span { cursor: pointer; color: var(--primary); font-weight: 500; }
.breadcrumb span:hover { text-decoration: underline; }

/* Stil za Reset/Home dugme u breadcrumb-u */
.breadcrumb-root-btn {
  background: #fff1f0; /* Blago crvenkasta pozadina koja sugeriše "brisanje" */
  border: 1px solid #ffa39e;
  padding: 4px 10px;
  border-radius: 6px;
  color: #cf1322; /* Crvena boja teksta za akciju poništavanja */
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  text-transform: uppercase; /* Profesionalniji "UI" izgled */
  letter-spacing: 0.5px;
}

.breadcrumb-root-btn:hover {
  background: #cf1322;
  color: white;
  border-color: #cf1322;
  box-shadow: 0 2px 8px rgba(207, 19, 34, 0.2);
}

.breadcrumb-root-btn i {
  font-size: 0.9rem;
}

/* Prilagođavanje separatora putanje */
.breadcrumb-separator {
  color: var(--text-muted);
  margin: 0 8px;
  font-weight: 400;
  opacity: 0.6;
}

.search-panel { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-shrink: 0; }
.input-group { flex: 1; position: relative; }
.input-group label { display: block; font-size: 0.85rem; margin-bottom: 0.4rem; color: var(--text-muted); }
.input-group input { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; outline: none; transition: border 0.2s; }
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1); }

/* Autocomplete Dropdown */
/* Autocomplete Dropdown - ISPRAVKA Z-INDEX */
.autocomplete-dropdown { 
  position: absolute; top: 100%; left: 0; right: 0; background: white; 
  border-radius: var(--radius); box-shadow: 0 10px 20px rgba(0,0,0,0.1); 
  z-index: 110; /* POVEĆAN Z-INDEX */
  max-height: 250px; overflow-y: auto; display: none; 
}
.autocomplete-item { padding: 0.7rem 1rem; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.autocomplete-item:hover { background: var(--bg-color); color: var(--primary); }

/* Table i Scroll */
.table-container { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); flex: 1; overflow-y: auto; position: relative; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th { 
  position: sticky; top: 0; z-index: 10; background: #fafbfc; color: var(--text-muted); 
  font-weight: 600; padding: 1rem; font-size: 0.85rem; box-shadow: 0 2px 0 var(--border);
}
td { padding: 1rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
tbody tr { cursor: pointer; transition: background 0.2s; }
tbody tr:hover { background: #f0f5ff; }

/* Zadržan Highlight red u tabeli */
.selected-row { background-color: #e0f0ff !important; border-left: 4px solid var(--primary); }
.selected-row td:first-child { color: var(--primary); }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; padding-bottom: 1rem; flex-wrap: wrap; flex-shrink: 0;}
.pagination button { padding: 0.5rem 1rem; border: 1px solid var(--border); background: white; border-radius: 4px; cursor: pointer; color: var(--text-main); transition: 0.2s;}
.pagination button:hover { background: var(--bg-color); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }



/* Modali generično */
.modal { 
  display: none; 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: rgba(9, 30, 66, 0.6); 
  z-index: 100;
  backdrop-filter: blur(4px); 
  align-items: center; 
  justify-content: center; 
}

@keyframes slideIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* --- SPLIT VIEW ZA MODAL (Ispravljeno) --- */
/* --- GLAVNI OKVIR MODALA --- */

/* Osnovni kontejner za sve modale (auto-visina) */
.modal-content { 
  background: white; 
  padding: 1.5rem; 
  width: 95%; 
  max-width: 500px; /* Podrazumevana širina za male modale */
  border-radius: var(--radius); 
  box-shadow: 0 20px 40px rgba(0,0,0,0.2); 
  animation: slideIn 0.3s ease-out;
  position: relative;
  max-height: 80vh; /* Ne dozvoljava da modal izađe van ekrana */
  display: flex;
  flex-direction: column;
  height: auto; /* Modal raste onoliko koliko ima sadržaja */
}

/* POSEBNA KLASA ZA VELIKI MODAL (Drug Details sa dve kolone) */
.modal-large {
  max-width: 1100px;
  height: 80vh; /* Samo ovaj modal ima fiksnu visinu */
}

/* Skrol za listu unutar Analysis modala */
#analysisListContainer {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 5px;
  min-height: 100px; /* Minimalna visina da ne izgleda prazno */
}
#analysisListContainer::-webkit-scrollbar { width: 5px; }
#analysisListContainer::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Skrol za unutrašnjost malih modala (ako zatreba) */
#regimeModalBody {
  overflow-y: auto;
}

/* HEADER - Rešeno preklapanje dugmića */
/* HEADER - Rešeno preklapanje dugmića */
.modal-header {
  flex-shrink: 0;
  margin-bottom: 1rem;
  padding-right: 4rem;
  position: relative;
}





.close-btn { 
  position: absolute; 
  top: 1.2rem; 
  right: 1.5rem; 
  font-size: 2rem; 
  background: none; 
  border: none; 
  cursor: pointer; 
  color: var(--text-muted); 
  line-height: 1;
  z-index: 500;
}
.close-btn:hover { color: red; }


#modalBody {
  height: 100%;
  display: flex;
  flex-direction: column;
}


/* Dugmići */
.pdf-links { display: flex; gap: 1rem; flex-wrap: wrap;}
.pdf-btn { border: none; padding: 0.7rem 1.2rem; background: #eef2f5; color: var(--primary); border-radius: 4px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 0.9rem; }
.pdf-btn:hover { background: var(--primary); color: white; }
.add-to-list-btn { background: #fff; border: 1px solid var(--primary); margin-left: auto;}
.add-to-list-btn:hover { background: var(--primary); color: white; }

/* PDF Modal posebni stilovi */
/* PDF Modal - ISPRAVKA */
.pdf-modal {
  z-index: 200;
  top: 30px;
}


.pdf-modal-content { 
  width: 95%;
  height: 85vh;
  padding: 0;
  display: flex;
  flex-direction: column; 
  background: #323639;
  max-width: none;
  border-radius: var(--radius);
  overflow: hidden; 
  margin: auto; /* <-- DODAJTE SAMO OVU LINIJU */
}

.pdf-header { background: #202224; padding: 0.5rem 1rem; display: flex; justify-content: flex-end; }
.close-pdf-btn { background: #f44336; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: 0.2s; }
.close-pdf-btn:hover { background: #d32f2f; }
#pdfIframe { flex: 1; width: 100%; border: none; }

/* Clear X Dugmići */
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper input { width: 100%; padding-right: 35px; } 
.clear-btn { position: absolute; right: 10px; cursor: pointer; color: #999; font-size: 1.2rem; display: none; padding: 5px; line-height: 1; }
.clear-btn:hover { color: #d32f2f; }

/* Auth Views */
.login-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #f0f5ff, #ffffff);
  padding: 1rem; /* Smanjen padding na kontejneru */
  overflow-y: auto; /* Dozvoljava skrol ako je ekran nizak (npr. kad izađe tastatura) */
}
.login-view .logo { font-size: 2.5rem; font-weight: 700; margin-bottom: 2rem; color: var(--primary); }
.login-view .logo span { font-weight: 400; opacity: 0.8; }
.profile-section { display: none; padding: 2rem; grid-column: 1 / -1; height: 100%; overflow-y: auto;}
#desktopAuthStatus a { color: white; text-decoration: none; padding: 6px 14px; border-radius: 6px; transition: all 0.2s ease-in-out; border: 1px solid rgba(255, 255, 255, 0.4); margin-left: 8px; font-size: 0.9rem; }
#desktopAuthStatus a:hover { background-color: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.8); }


.auth-card {
  background: white;
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(9, 30, 66, 0.08), 0 0 1px rgba(9, 30, 66, 0.31);
  text-align: center;
}

.login-logo {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

.auth-header h2 {
  color: #0A2540;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: #6B778C;
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ebecf0;
}

.auth-footer p {
  font-size: 0.75rem;
  color: #8993A4;
  letter-spacing: 0.3px;
  content: "RxLyse Pro AI © 2026 | Precizna farmakologija";
}

/* Stilovi za inpute unutar login forme */
#authContainer .input-group {
  text-align: left;
  margin-bottom: 1.2rem;
}

#authContainer label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #42526E;
  margin-bottom: 0.5rem;
  display: block;
}

#authContainer input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #dfe1e6;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
}

#authContainer input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

/* Bottom Nav */
.bottom-nav { display: none; }


/* SPLIT VIEW ZA MODAL (Leva i Desna kolona) */
/* TELO MODALA (DVE KOLONE) */
.modal-body-split {
  display: flex;
  gap: 1.5rem;
  flex: 1; /* Zauzima sav preostali prostor iznad futera */
  min-height: 0; /* KRITIČNO: Dozvoljava kolonama da aktiviraju sopstveni scroll */
}

/* Leva kolona (Info o leku) */
/* LEVA KOLONA (Info o leku) */
.main-details {
  flex: 6;
  overflow-y: auto;
  padding-right: 10px;
}
.main-details::-webkit-scrollbar { width: 6px; }
.main-details::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
/* DESNA KOLONA (Paralele) */

.parallels-sidebar {
  flex: 4;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.parallels-header {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  color: var(--text-main);
  background: #eef2f5;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.parallels-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.parallels-list::-webkit-scrollbar { width: 6px; }
.parallels-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
/* Kartica za pojedinačnu paralelu */
/* Kartica paralele *//* Kartica paralele */
.parallel-card {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 0.8rem;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.2s;
  cursor: pointer;
}
.parallel-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 82, 204, 0.15);
}
.parallel-name {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.parallel-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* FOOTER - Uvek vidljiv */
.modal-footer {
  flex-shrink: 0;
  padding-top: 1rem; 
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}
/* Stil za ATC kod u tabeli */
.atc-code-badge {
  background: #eef2f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

/* Režim izdavanja Bedž */
.rezim-badge {
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: help;
  display: inline-block;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: transform 0.1s;
}

.rezim-badge:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Stilovi za Regime Info Modal (i ostale manje modale) */
.regime-info-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.regime-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f2f5;
}

.regime-info-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.regime-info-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  line-height: 1.2;
}

.regime-info-description {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  border-left: 4px solid #cbd5e1;
}

/* Stil za telo sekundarnog modala (bez kolona) */
/* Poseban raspored za sekundarni modal */
#modalBodySecondary {
  display: flex;
  flex-direction: column;
  height: 100%; /* Zauzima celu visinu .modal-content */
  min-height: 0;
}

/* Skrolujuća zona za detalje paralele */
.secondary-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
  margin-bottom: 1rem;
}

.secondary-scroll-area::-webkit-scrollbar { width: 6px; }
.secondary-scroll-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Highlight za selektovanu paralelu */
.parallel-card.selected-parallel {
  background-color: #e0f0ff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(0, 82, 204, 0.2);
}

/* Stil za checkbox u modalu */
#hideIntroCheckbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Poboljšanje Header navigacije */
.top-nav-link {
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.3);
  transition: 0.2s;
  margin-right: 8px;
}
.top-nav-link:hover {
  background: rgba(255,255,255,0.1);
  border-color: white;
}

/* Stil za zvezdicu u tabeli */
.fav-star {
  cursor: pointer;
  font-size: 1.2rem;
  color: #ccc; /* Sivo kad nije favorit */
  transition: all 0.2s ease;
  user-select: none;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

.fav-star.active {
  color: #ffc107; /* Zlatno žuta za favorite */
  transform: scale(1.1);
}

.fav-star:hover {
  transform: scale(1.2);
}

/* Dugme za filter favorita u breadcrumb-u */
.fav-filter-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
  margin-left: auto; /* Pomera ga na desnu stranu breadcrumb trake */
}

.fav-filter-btn.active {
  background: #fff9e6;
  border-color: #ffc107;
  color: #b45309;
}


/* SPECIFIČAN STIL ZA INTRO MODAL */
.modal-intro-special {
    max-width: 950px !important;
    height: 80vh; /* Zauzima 90% visine ekrana */
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Resetujemo padding da bi heder i futer išli do ivica */
    overflow: hidden;
}

.modal-intro-special .modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 0;
}

.modal-intro-special .modal-scroll-area {
    flex: 1; /* Uzima sav preostali prostor */
    overflow-y: auto; /* Aktivira skrol bar */
    padding: 2rem;
    background: #ffffff;
}

.modal-intro-special .modal-footer {
    padding: 1rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #eee;
    margin-top: 0;
}



/* Kontejner za tabove - VIDLJIV SAMO NA MOBILNOM */
.modal-tabs {
  display: none; /* Sakriveno na desktopu */
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-size: 0.9rem;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Drawer dugme u hederu (po defaultu sakriveno na desktopu) */
.header-drawer-btn { 
  display: none; 
  background: none; 
  border: none; 
  color: white; 
  cursor: pointer; 
  padding-right: 12px; 
  margin-right: 8px; 
  border-right: 1px solid rgba(255,255,255,0.3); 
  align-items: center;
}

/* ==========================================
   TOTALNA MOBILNA OPTIMIZACIJA (Ispod 992px)
   ========================================== */

/* Stilovi vidljivi SAMO na mobilnom (izvan media query-ja zbog preglednosti) */
.mobile-atc-toggle { display: none; }
.close-atc-btn { display: none; }
.toggle-filters-btn { display: none; } /* Sakriveno dugme filtera na desktopu */


/* DUGME BACK TO TOP (Inicijalno sakriveno) */
.back-to-top-btn {
  display: none; /* JS kontroliše kada se pojavljuje */
  position: fixed;
  bottom: 85px; /* Iznad futera */
  right: 20px;
  background: var(--primary);
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  z-index: 900;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.back-to-top-btn:hover { background: var(--primary-hover); transform: scale(1.05); }


/* Na svim ekranima: sakrij Back to Top kad je modal otvoren */
body.modal-active .back-to-top-btn {
  display: none !important;
}



.empty-favorites-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Vertikalno centriranje */
  text-align: center;
  padding: 3rem 1.5rem;
  background: white;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  margin: 1rem;
  /* Prilagođavanje visini ekrana minus heder/futer */
  min-height: 400px; 
  height: 60vh; 
}

.empty-favorites-icon {
  font-size: 3rem;
  color: #dfe1e6;
  margin-bottom: 1rem;
  display: block;
}

.empty-favorites-text h3 {
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.empty-favorites-text p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

.return-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.return-btn:hover {
  background: var(--primary-hover);
}



/* Logo Styling */
.logo-wrapper {
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
  user-select: none;
}

.logo-wrapper:hover {
  transform: translateY(-1px);
}

.logo-svg {
  display: block;
  height: 32px; /* Fiksna visina za heder */
  width: auto;
}

/* Stil za uokviren logo klijenta u hederu (White-labeling kapsula) */
.branded-logo-framed {
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 4px 14px; /* Standardni padding */
  /* IZBRISAO SI border-radius ODAVDE */
}

.branded-logo-framed:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}



/* Bedževi unutar tabele */
.table-badge-rfzo {
  color: white;
  font-weight: 800;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 22px;
  text-align: center;
}

.table-badge-rezim {
  color: white;
  font-weight: 700;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 4px;
  min-width: 22px;
  text-align: center;
}

.table-badge-none {
  color: #ccc;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border: 1px solid #eee;
  border-radius: 4px;
}

/* --- ONEMOGUĆAVANJE SELEKCIJE TEKSTA (APP-LIKE FEEL) --- */

/* Blokiramo selekciju u svim glavnim kontejnerima, uključujući i tabelu */
.topbar, 
.sidebar, 
.search-panel, 
.table-container, 
.bottom-nav,
.breadcrumb {
  user-select: none !important;
  -webkit-user-select: none !important; /* Za Safari/Chrome na iOS */
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

/* Ostavljamo selekciju ISKLJUČIVO u input poljima kako bi korisnik mogao da edituje tekst koji kuca */
input, 
textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Posebno za redove u tabeli da bi klik delovao kao na dugme */
#resultsBody tr {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent; /* Uklanja sivi blic na Androidu/iOS pri kliku */
}

/* Onemogućavanje selekcije na svim interaktivnim elementima */
button, 
.nav-item, 
.rezim-badge, 
.atc-badge, 
.fav-star,
.atc-node {
  user-select: none !important;
  -webkit-user-select: none !important;
}

@media (max-width: 992px) {


    .auth-card {
    padding: 2rem 1.2rem; /* Značajno smanjen bočni padding */
    border-radius: 12px;
    box-shadow: none; /* Uklanjamo senku na mobilnom za čistiji izgled */
    border: 1px solid #ebecf0;
  }
  
  .auth-header h2 {
    font-size: 1.3rem; /* Manji naslov */
  }

  /* Dugmići jedan ispod drugog na mobilnom */
  .auth-button-group {
    flex-direction: column !important;
    gap: 0.8rem !important;
  }
  
    td:before {
    /* Ovo osigurava da labels u karticama prate promenu naziva kolone */
    content: attr(data-label);
  }
  /* Prikaz Drawer ikone u hederu */
  .header-drawer-btn { display: flex; }

  /* --- 1. GLOBALNI LAYOUT I TOPBAR --- */
  /* POTPUNO OTKLJUČAVANJE SKROLA NA MOBILNOM */
  html, body { height: auto !important; overflow: auto !important; position: relative !important; }
  #app-container { height: auto !important; min-height: 100vh; display: block !important; }

  /* Guranje layouta ispod fiksnog hedera */
  .layout { 
    display: block !important; 
    margin-top: 60px !important; 
    margin-bottom: 90px !important; /* Mesto za futer */
    padding: 0.5rem;
    height: auto !important; 
    overflow: visible !important;
  }

  .content, .table-container { overflow: visible !important; height: auto !important; }

  /* 1. FIKSNI HEDER */
  .topbar { 
    position: fixed !important; top: 0; left: 0; width: 100%; 
    z-index: 1000; padding: 0.8rem; box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
  }

  #desktopAuthStatus { display: none; }
  .logo { font-size: 1.05rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
  .analysis-btn { padding: 6px 8px !important; font-size: 0.8rem !important; white-space: nowrap; }
  
  /* --- 2. SAKRIVANJE SUVIŠNIH DUGMIĆA --- */
  .mobile-atc-toggle, .fav-filter-btn, .breadcrumb-separator { display: none !important; }

  /* --- 3. ATC DRAWER (FIOKA) --- */
  .sidebar {
    position: fixed; top: 0; left: -100%; 
    width: 85%; max-width: 350px; 
    height: calc(100vh - 75px) !important; /* Prostor za futer */
    padding: 0 !important; padding-bottom: 20px !important;
    background: white; z-index: 2000; transition: left 0.3s ease-in-out;
    box-shadow: 5px 0 25px rgba(0,0,0,0.2) !important;
    border-radius: 0 !important;
    display: flex !important; flex-direction: column !important; overflow: hidden !important;
  }

  .sidebar.drawer-open { left: 0; }

  .sidebar-header-mobile { 
    padding: 1.2rem; background: white; border-bottom: 1px solid var(--border); 
    display: flex; justify-content: space-between; align-items: center; z-index: 10; flex-shrink: 0;
  }
  
  #atcTreeContainer { padding: 1.2rem; flex: 1; overflow-y: auto; }

  .drawer-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1999;
  }
  .drawer-overlay.show { display: block; }

  /* --- 4. TABELA U KARTICE --- */
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  
  tr { background: white; margin-bottom: 1rem; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 0.5rem; border: 1px solid var(--border); }
  td { border: none; padding: 0.6rem 0.5rem 0.6rem 40% !important; position: relative; font-size: 0.9rem; text-align: right; min-height: 35px;}
  td:before { position: absolute; left: 10px; width: 35%; white-space: nowrap; content: attr(data-label); font-weight: 700; color: var(--text-muted); text-align: left; font-size: 0.75rem; text-transform: uppercase; }
  td:first-child { background: #f8fafc; border-radius: 8px; text-align: left; padding-left: 10px !important; margin-bottom: 5px;}
  td:first-child:before { display: none; }

  /* --- 5. PRETRAGA I FILTERI --- */
  .search-panel { display: block; } 
  .input-group { margin-bottom: 0.8rem; }
  .input-group input { padding: 0.8rem 1rem; font-size: 16px; }
  .toggle-filters-btn { 
    display: block; width: 100%; padding: 10px; background: #f0f7ff; 
    border: 1px solid #cce3ff; border-radius: 8px; color: var(--primary); 
    font-weight: 600; margin-bottom: 0.8rem; cursor: pointer; 
  }
  .search-filters-extra { display: none !important; }
  .search-filters-extra.show { display: block !important; }

  /* --- 6. NATIVNI FUTER (PWA Stil) --- */
  .bottom-nav {
    display: flex !important; 
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #e2e8f0; box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    z-index: 3000 !important; /* Pobeđuje ATC fioku */
    justify-content: space-around; 
    padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  }
  .nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: none; border: none; font-size: 0.7rem; color: var(--text-muted); cursor: pointer; padding: 0.2rem; flex: 1; gap: 4px; transition: all 0.2s;
  }
  .nav-icon { font-size: 1.35rem; filter: grayscale(100%) opacity(0.6); transition: 0.2s; }
  .nav-item.active { color: var(--primary); font-weight: 700; }
  .nav-item.active .nav-icon { filter: grayscale(0) opacity(1); transform: scale(1.15); }

  /* --- 7. SVI MODALI (FULL SCREEN LOGIKA) --- */
  .modal { align-items: flex-end; z-index: 9999 !important;}
  
  .modal-content, .modal-large, .modal-intro-special {
    width: 100% !important; height: 100vh !important; max-height: 100vh !important;
    border-radius: 0 !important; margin: 0 !important; padding: 0 !important; top: 0 !important;
    display: flex !important; flex-direction: column !important;
    animation: slideUpMobile 0.3s ease-out;
  }
  @keyframes slideUpMobile { from { transform: translateY(100%); } to { transform: translateY(0); } }

  .modal-header { padding: 1.5rem 4.5rem 1rem 1.5rem !important; margin-bottom: 0; border-bottom: 1px solid var(--border); position: relative; }
  .close-btn { top: 1.2rem; right: 1rem; }
  .rezim-badge { margin-top: 5px; display: inline-block; } 

  /* TABOVI U MODALU */
  .modal-tabs { display: flex !important; border-bottom: 1px solid var(--border); flex-shrink: 0; background: #fafbfc; }
  .tab-btn { flex: 1; padding: 15px 5px; font-size: 0.9rem; border: none; background: none; color: var(--text-muted); border-bottom: 3px solid transparent; cursor: pointer;}
  .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; background: white;}

  /* SKROLUJUĆA ZONA U MODALU */
  #modalBody { flex: 1 !important; display: flex !important; flex-direction: column !important; min-height: 0 !important; }
  .modal-body-split { flex-direction: column; flex: 1; min-height: 0; }
  
  
  /* Skrol svojstva se primenjuju na sve ove elemente */
  .main-details, .parallels-sidebar, .modal-scroll-area { 
    flex: 1 !important; 
    overflow-y: auto !important; 
    -webkit-overflow-scrolling: touch; 
    padding: 1.5rem; 
  }
  
  /* Sakrivamo SAMO tabove u glavnom modalu dok ne postanu aktivni */
  .main-details, .parallels-sidebar { 
    display: none; 
  }
  
  .main-details.active-tab, .parallels-sidebar.active-tab { 
    display: flex !important; 
    flex-direction: column !important; 
  }

  /* Osiguravamo da modal-scroll-area (Analiza i Vodič) uvek bude vidljiva na mobilnom */
  .modal-scroll-area {
    display: flex !important;
    flex-direction: column !important;
  }

  .parallels-header { display: none; }
  .parallels-sidebar { border: none; background: white; padding-top: 0.5rem;}

  /* FIKSNI FOOTER U MODALU */
  .modal-footer { padding: 1rem 1.5rem; background: white; box-shadow: 0 -4px 10px rgba(0,0,0,0.05); }
  .modal-footer.pdf-links { flex-direction: column; gap: 10px; }
  .modal-footer .pdf-btn, .modal-footer .add-to-list-btn { width: 100%; margin: 0 !important; justify-content: center;}

  /* Kada je modal aktivan, sakrij Heder i Futer pozadine */
  body.modal-active .topbar,
  body.modal-active .bottom-nav {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .header-seo-text {
    display: none;
  }
}