/* ===========================
   GOOGLE FONTS - MONTSERRAT
=========================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

body {
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
  font-weight: 600;
}

/* Dodajte ovo za bolju podršku dijakritičkih znakova */
@supports (font-variation-settings: normal) {
  body {
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  }
}

/* Bolja podrška za dijakritičke znakove */
body, input, textarea, select, button {
  text-rendering: optimizeLegibility;
  -webkit-font-feature-settings: "liga", "dlig";
  font-feature-settings: "liga", "dlig";
}

/* Font smoothing za bolji prikaz */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   RESET & BASE
=========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #e8f0fe;
  color: #333;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===========================
   CONTAINER - 1140px width
=========================== */

.container {
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 0 15px;
  box-sizing: border-box;
}

/* ===========================
   HEADER / TOPBAR - BIJELI
=========================== */

#menu {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  position: relative;
}

.logo-wrap {
  flex: 1;
}

.logo {
  height: 45px;
  max-width: 100%;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: scale(1.02);
}

/* ===========================
   DESKTOP MENU
=========================== */

.desktop-menu {
  flex: 3;
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.desktop-menu .menu-item {
  position: relative;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
  color: #555;
  transition: all 0.2s;
  font-size: 14px;
  border-radius: 4px;
}

.desktop-menu .menu-item:hover {
  background: #f8fafc;
  color: #141a8c;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 240px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 6px 0;
  list-style: none;
  display: none;
  z-index: 1000;
  border-radius: 6px;
  overflow: visible; /* KLJUČNO: Ovaj je bio problem */
  border: 1px solid #e2e8f0;
}

.menu-item:hover .dropdown {
  display: block;
}

.dropdown > li {
  padding: 4.2px 12px; /* 30% manji line-height (6px -> 4.2px) */
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  color: #555;
  font-weight: 400;
  font-size: 13px;
  white-space: nowrap; /* Spriječava prelamanje teksta */
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown > li:hover {
  background: #f0f4ff;
  color: #141a8c;
  padding-left: 14px;
}

/* KLJUČNO: Podmeniji se otvaraju desno */
.dropdown .has-sub > ul {
  position: absolute;
  top: 0;
  left: 100%;
  background: white;
  min-width: 200px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 6px 0;
  list-style: none;
  display: none;
  border-radius: 6px;
  overflow: visible; /* KLJUČNO: Ovaj je bio problem */
  border: 1px solid #e2e8f0;
}

/* ISPRAVLJENO: Hover se primjenjuje na <li> a ne <span> */
.dropdown > li.has-sub:hover > ul {
  display: block;
}

.dropdown .has-sub > ul > li {
  padding: 4.2px 12px; /* 30% manji line-height */
  font-size: 13px;
  white-space: nowrap; /* Spriječava prelamanje teksta */
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown .has-sub > ul > li:hover {
  padding-left: 14px;
}

/* KLJUČNO: Treći nivo menija - ISPRAVLJENO */
.dropdown .has-sub > ul > .has-sub:hover > ul {
  display: block;
}

.dropdown .has-sub > ul .has-sub > ul {
  position: absolute;
  top: 0;
  left: 100%;
  background: white;
  min-width: 200px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 6px 0;
  list-style: none;
  display: none;
  border-radius: 6px;
  overflow: visible; /* KLJUČNO: Ovaj je bio problem */
  border: 1px solid #e2e8f0;
}

.dropdown .has-sub > ul .has-sub > ul > li {
  padding: 4.2px 12px; /* 30% manji line-height */
  font-size: 13px;
  white-space: nowrap; /* Spriječava prelamanje teksta */
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown .has-sub > ul .has-sub > ul > li:hover {
  padding-left: 14px;
}

/* DIVIDERS */
.dropdown .divider {
  border-top: 1px solid #e2e8f0;
  margin: 4px 0;
  padding: 0;
  height: 0;
}

/* ===========================
   USER MENU
=========================== */

.user-menu {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  position: relative;
  align-items: center;
}

.user-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #141a8c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  border: 1px solid #e2e8f0;
}

.user-icon:hover {
  background: #e2e8f0;
  transform: scale(1.05);
}

.user-icon svg {
  width: 24px;
  height: 24px;
  margin: 0;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  min-width: 160px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 8px 0;
  list-style: none;
  display: none;
  z-index: 1000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: #555;
  transition: all 0.15s;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap; /* Spriječava prelamanje teksta */
}

.user-dropdown a:hover {
  background: #f0f4ff;
  color: #141a8c;
  padding-left: 18px;
}

/* ===========================
   HAMBURGER BUTTON (Mobile)
=========================== */

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  position: absolute;
  right: 5px;
  top: 15px;
  z-index: 100;
  color: #141a8c;
  transition: all 0.2s;
}

.hamburger:hover {
  transform: scale(1.1);
}

/* ===========================
   MOBILE SLIDE MENU
=========================== */

.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 320px;
  height: 100%;
  background: white;
  z-index: 2000;
  transition: right 0.3s ease;
  box-shadow: -2px 0 8px rgba(0,0,0,0.08);
  overflow-y: auto;
  padding: 20px;
  border-left: 1px solid #e2e8f0;
}

.mobile-menu.open {
  right: 0;
}

.mobile-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 15px;
}

.mobile-menu-header button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #141a8c;
  line-height: 1;
  transition: all 0.2s;
}

.mobile-menu-header button:hover {
  transform: scale(1.1);
}

.mobile-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-item {
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
  cursor: pointer;
}

.mobile-menu-item > span {
  display: block;
  color: #555;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 0;
  transition: all 0.15s;
}

.mobile-menu-item > span:hover {
  color: #141a8c;
  padding-left: 2px;
}

.mobile-submenu {
  display: none;
  margin-top: 8px;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.mobile-submenu.open {
  display: block;
}

.mobile-submenu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-submenu ul > li {
  padding: 4.2px 0; /* 30% manji line-height */
  font-size: 13px;
  color: #666;
  white-space: nowrap; /* Spriječava prelamanje teksta */
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-submenu ul > li:hover {
  color: #141a8c;
  padding-left: 2px;
}

/* MOBILE SUBMENIJI */
.mobile-submenu .has-sub > ul {
  display: none;
  margin-top: 4px;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.mobile-submenu .has-sub > ul.open {
  display: block;
}

/* MOBILE TREĆI NIVO */
.mobile-submenu .has-sub > ul .has-sub > ul {
  display: none;
  margin-top: 4px;
  padding-left: 16px;
  border-left: 1px solid #e2e8f0;
}

.mobile-submenu .has-sub > ul .has-sub > ul.open {
  display: block;
}

/* DIVIDERS - mobile */
.mobile-submenu .divider {
  border-top: 1px solid #e2e8f0;
  margin: 8px 0;
  padding: 0;
  height: 0;
}

/* ===========================
   MAIN CONTENT
=========================== */

#app {
  min-height: calc(100vh - 70px);
  padding: 30px 0;
}

.main-layout {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  text-align: center;
}

.main-layout.watermark {
  position: relative;
  overflow: hidden;
}

.main-layout.watermark::before {
  content: "OSBiH";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 120px;
  color: rgba(20, 26, 140, 0.02);
  font-weight: bold;
  z-index: 0;
}

.main-layout h1 {
  position: relative;
  z-index: 1;
  color: #141a8c;
  font-size: 32px;
  margin-bottom: 20px;
}

.main-layout p {
  position: relative;
  z-index: 1;
  color: #141a8c;
  opacity: 0.7;
}

/* ===========================
   LOGIN PAGE
=========================== */

.logged-out {
  background: #e8f0fe;
  min-height: 100vh;
}

.logged-out .container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-box {
  background: white;
  padding: 35px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  text-align: center;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.login-box .logo-container {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-box .logo-container img {
  height: 45px;
  border-radius: 4px;
}

.login-box h2 {
  color: #555;
  margin-bottom: 25px;
  font-size: 24px;
  font-weight: 600;
}

.login-box input {
  width: 100%;
  padding: 10px 15px;
  margin: 10px 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
  transition: all 0.2s;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-box input:focus {
  outline: none;
  border-color: #141a8c;
  box-shadow: 0 0 0 2px rgba(20,26,140,0.1);
}

.login-box button {
  width: 100%;
  padding: 10px;
  background: #141a8c;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  margin-top: 15px;
  transition: all 0.2s;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 2px 6px rgba(20,26,140,0.15);
}

.login-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(20,26,140,0.2);
}

/* ===========================
   PROFILE PAGE
=========================== */

.profile-page {
  max-width: 900px;
  margin: 0 auto;
}

.profile-card {
  background: white;
  padding: 35px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border: 1px solid #e2e8f0;
}

.profile-card h2 {
  color: #141a8c;
  margin-bottom: 25px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
}

.profile-section {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #e2e8f0;
}

.profile-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.profile-section h3 {
  color: #555;
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.profile-section h3::before {
  content: "•";
  color: #141a8c;
  font-size: 24px;
  margin-right: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid label {
  display: block;
  margin-bottom: 7px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
}

.form-grid input {
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
  transition: all 0.2s;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.form-grid input:focus {
  outline: none;
  border-color: #141a8c;
  box-shadow: 0 0 0 2px rgba(20,26,140,0.1);
}

.profile-section input[type="password"] {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-sizing: border-box;
  transition: all 0.2s;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.primary-btn {
  background: #141a8c;
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 2px 6px rgba(20,26,140,0.15);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(20,26,140,0.2);
}

/* ===========================
   2FA SWITCH
=========================== */

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e2e8f0;
  transition: .4s;
  border-radius: 13px;
  border: 1px solid #cbd5e1;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
}

input:checked + .slider {
  background-color: #141a8c;
  border-color: #141a8c;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* ===========================
   ALERTS
=========================== */

.alert {
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ===========================
   RESPONSIVE BREAKPOINTS
=========================== */

@media (max-width: 991px) {
  .hamburger {
    display: block;
  }
  
  .desktop-menu,
  .user-menu {
    display: none;
  }
  
  .topbar {
    padding: 10px 0;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-layout {
    padding: 30px 20px;
  }
  
  .main-layout h1 {
    font-size: 24px;
  }
  
  .profile-card {
    padding: 25px;
  }
  
  .login-box {
    padding: 30px 20px;
  }
  
  .login-box h2 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .mobile-menu {
    width: 90%;
  }
  
  .login-box {
    padding: 25px 15px;
    margin: 10px;
  }
  
  .login-box h2 {
    font-size: 22px;
  }
  
  .main-layout h1 {
    font-size: 20px;
  }
}