/* ======================================================
   RI REGISTAR IMOVINE - JAVNI PRIKAZ
   ====================================================== */

.ri-wrap {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1e1e1e;
}

.ri-wrap .ri-title {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #1e1e1e !important;
  margin: 0 0 24px 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
  text-align: center !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

/* ======================================================
   FILTERI / KONTROLE
   ====================================================== */
.ri-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 16px 0;
}

.ri-control label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
  color: #333;
}

.ri-control select,
.ri-control input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd3d7;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #1e1e1e;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.ri-control select:focus,
.ri-control input:focus {
  outline: none;
  border-color: #2271b1;
  box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.ri-control-godina select {
  min-width: 120px;
}

.ri-control-reset {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.ri-btn-reset {
  white-space: nowrap;
  background: #6c757d;
  border-color: #6c757d;
  font-size: 13px;
  padding: 10px 14px;
}

.ri-btn-reset:hover {
  background: #565e64;
  border-color: #565e64;
}

.ri-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ri-search-row input {
  flex: 1;
  min-width: 0;
}

.ri-search-row .ri-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* ======================================================
   CUSTOM DROPDOWN
   ====================================================== */
.ri-dropdown {
  position: relative;
  width: 100%;
}

.ri-dropdown-toggle {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid #cfd3d7;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #1e1e1e;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  min-height: 42px;
}

.ri-dropdown-toggle:hover {
  border-color: #2271b1;
}

.ri-dropdown-toggle:focus {
  outline: none;
  border-color: #2271b1;
  box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.ri-dropdown-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ri-dropdown-arrow {
  position: absolute;
  right: 12px;
  font-size: 10px;
  color: #666;
  transition: transform 0.2s ease;
}

.ri-dropdown.open .ri-dropdown-arrow {
  transform: rotate(180deg);
}

.ri-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #cfd3d7;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ri-dropdown.open .ri-dropdown-menu {
  display: block;
}

.ri-dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #1e1e1e;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.4;
}

.ri-dropdown-item:last-child {
  border-bottom: none;
}

.ri-dropdown-item:hover {
  background: #f0f6ff;
}

.ri-dropdown-item.selected {
  background: #e6f0ff;
  font-weight: 600;
}

.ri-dropdown-item.ri-dd-placeholder {
  color: #666;
  font-style: italic;
}

.ri-dropdown-search-wrap {
  padding: 8px;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.ri-dropdown-search {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd3d7;
  border-radius: 4px;
  font-size: 13px;
  color: #1e1e1e;
  background: #fff;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease;
}

.ri-dropdown-search:focus {
  border-color: #2271b1;
  box-shadow: 0 0 0 1px rgba(34, 113, 177, 0.2);
}

.ri-dropdown-search::placeholder {
  color: #999;
}

/* ======================================================
   DUGMAD
   ====================================================== */
.ri-btn {
  padding: 10px 18px;
  border: 1px solid #2271b1;
  background: #2271b1;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s ease, transform 0.1s ease;
}

.ri-btn:hover {
  background: #135e96;
  border-color: #135e96;
  color: #fff;
}

.ri-btn:active {
  transform: translateY(1px);
}

/* ======================================================
   TABELA WRAP
   ====================================================== */
.ri-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ======================================================
   TABELA (DESKTOP)
   ====================================================== */
.ri-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
  table-layout: fixed;
}

.ri-table th,
.ri-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.ri-table thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  font-weight: 600;
  font-size: 12px;
  color: #333;
  z-index: 1;
  border-bottom: 2px solid #e5e5e5;
}

.ri-table tbody tr:hover td {
  background: #f0f6ff;
}

.ri-loading {
  text-align: center;
  padding: 24px;
  color: #666;
  font-style: italic;
}

/* ======================================================
   ŠIRINE KOLONA (10 kolona)
   1. Ime, 2. Prezime, 3. Javna funkcija, 4. Status,
   5. Institucija, 6. Nivo vlasti, 7. Datum imenovanja,
   8. Datum prijave, 9. Godišnji prihod, 10. Detalji
   ====================================================== */
.ri-table th:nth-child(1), .ri-table td:nth-child(1) { width: 80px; }
.ri-table th:nth-child(2), .ri-table td:nth-child(2) { width: 90px; }
.ri-table th:nth-child(3), .ri-table td:nth-child(3) { width: 150px; }
.ri-table th:nth-child(4), .ri-table td:nth-child(4) { width: 140px; }
.ri-table th:nth-child(5), .ri-table td:nth-child(5) { width: 170px; }
.ri-table th:nth-child(6), .ri-table td:nth-child(6) { width: 100px; }
.ri-table th:nth-child(7), .ri-table td:nth-child(7) { width: 110px; }
.ri-table th:nth-child(8), .ri-table td:nth-child(8) { width: 110px; }
.ri-table th:nth-child(9) { width: 100px; text-align: center; }
.ri-table td:nth-child(9) { width: 100px; text-align: right; white-space: nowrap; }
.ri-table th:nth-child(10), .ri-table td:nth-child(10) { width: 60px; }

.ri-right { text-align: right !important; }

/* ======================================================
   INFO/DETALJI DUGME
   ====================================================== */
.ri-info-col {
  width: 60px;
  text-align: center;
}

.ri-info-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #2271b1;
  background: #2271b1;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s ease, transform 0.1s ease;
}

.ri-info-btn:hover {
  background: #135e96;
  border-color: #135e96;
}

.ri-info-btn:active {
  transform: scale(0.95);
}

/* ======================================================
   SORT IKONE
   ====================================================== */
.ri-sort {
  cursor: pointer;
  user-select: none;
}

.ri-sort::before {
  content: "⇅";
  font-size: 11px;
  color: #999;
  margin-right: 4px;
}

.ri-sort.asc::before, .ri-sort.desc::before {
  color: #2271b1;
}

.ri-sort.asc::after { content: " ▲"; font-size: 10px; color: #2271b1; }
.ri-sort.desc::after { content: " ▼"; font-size: 10px; color: #2271b1; }

/* ======================================================
   FOOTER / PAGINACIJA
   ====================================================== */
.ri-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  gap: 12px;
}

.ri-meta {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  color: #555;
  font-size: 13px;
}

.ri-pagination {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ri-page {
  border: 1px solid #2271b1;
  background: #2271b1;
  color: #fff !important;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ri-page:hover, .ri-page:focus {
  background: #1f6fb2;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transform: translateY(-1px);
  outline: none !important;
}

.ri-page.active {
  background: #0a4b78;
  border-color: #0a4b78;
}

.ri-page.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ======================================================
   MOBILNI LABELS
   ====================================================== */
.ri-m-label { display: none; }
.ri-m-val { display: inline; }

/* ======================================================
   MODAL
   ====================================================== */
.ri-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.ri-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.ri-modal-dialog {
  position: relative;
  width: 600px;
  max-width: 100%;
  margin: 20px auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.ri-modal-large {
  width: 95vw;
  max-width: 1400px;
}

.ri-modal-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.ri-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e1e1e;
}

.ri-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.ri-modal-close:hover {
  background: #e5e5e5;
  color: #333;
}

.ri-modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.ri-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  background: #f8f9fa;
}

/* ======================================================
   DETALJI - ZAGLAVLJE
   ====================================================== */
.ri-detail-header {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.ri-detail-header h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #333;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 10px;
}

.ri-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ri-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ri-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  font-weight: 600;
}

.ri-detail-value {
  font-size: 14px;
  color: #1e1e1e;
}

.ri-detail-value.highlight {
  color: #0a6f0a;
  font-weight: 600;
}

/* ======================================================
   TABOVI ZA ČLANOVE DOMAĆINSTVA
   ====================================================== */
.ri-tabs {
  margin-bottom: 20px;
}

.ri-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 0;
  margin-bottom: 20px;
}

.ri-tab-btn {
  padding: 10px 16px;
  border: 1px solid #e5e5e5;
  border-bottom: none;
  background: #f8f9fa;
  color: #666;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.ri-tab-btn:hover {
  background: #fff;
  color: #333;
}

.ri-tab-btn.active {
  background: #fff;
  color: #2271b1;
  border-color: #e5e5e5;
  border-bottom: 2px solid #fff;
}

.ri-tab-content {
  display: none;
}

.ri-tab-content.active {
  display: block;
}

/* ======================================================
   TABELE IMOVINE U MODALU
   ====================================================== */
.ri-asset-section {
  margin-bottom: 24px;
}

.ri-asset-section h5 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #333;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

/* Wrapper za horizontalni scroll */
.ri-asset-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ri-asset-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 13px;
}

.ri-asset-table th,
.ri-asset-table td {
  padding: 8px 10px;
  border: 1px solid #e5e5e5;
  text-align: left;
  white-space: nowrap;
}

.ri-asset-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 12px;
  color: #555;
}

.ri-asset-table tr:hover td {
  background: #f0f6ff;
}

/* Desno poravnanje za iznose */
.ri-asset-table .ri-col-right,
.ri-col-right {
  text-align: right !important;
}

/* UKUPNO red (tfoot) */
.ri-asset-table tfoot {
  background: #e8f4fc;
}

.ri-asset-table tfoot td {
  border-top: 2px solid #2271b1;
  font-weight: 600;
  color: #1e1e1e;
}

.ri-asset-table tfoot tr:hover td {
  background: #e8f4fc;
}

.ri-asset-empty {
  color: #999;
  font-style: italic;
  padding: 12px;
  text-align: center;
  background: #f8f9fa;
  border-radius: 6px;
}

/* Loading spinner */
.ri-loading-spinner {
  text-align: center;
  padding: 40px;
  color: #666;
}

/* ======================================================
   UPOREDNI PRIKAZ (COMPARE)
   ====================================================== */
.ri-compare-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 0 0 15px 0;
  background: linear-gradient(135deg, #f0f6fc, #e8f0fe);
  border: 1px solid #b8d4f0;
  border-radius: 8px;
  font-size: 14px;
  color: #1d2327;
}

.ri-compare-icon {
  font-size: 20px;
}

.ri-compare-btn {
  background: #2271b1;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.ri-compare-btn:hover {
  background: #135e96;
}

.ri-compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.ri-compare-header h3 {
  margin: 0;
  font-size: 16px;
  color: #1d2327;
}

.ri-compare-back {
  background: none;
  border: 1px solid #ccc;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #2271b1;
}

.ri-compare-back:hover {
  background: #f0f6fc;
}

.ri-compare-selector {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e5e5e5;
}

.ri-compare-selector label {
  font-weight: 600;
  font-size: 13px;
  display: block;
  margin-bottom: 10px;
}

.ri-compare-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ri-compare-option {
  font-weight: 400 !important;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
}

.ri-compare-option:hover {
  background: #e8f4fc;
}

.ri-compare-load {
  background: #2271b1;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.ri-compare-load:hover {
  background: #135e96;
}

.ri-compare-section {
  margin-bottom: 20px;
}

.ri-compare-section h4 {
  font-size: 14px;
  color: #2271b1;
  margin: 0 0 10px 0;
  padding: 8px 12px;
  background: #f0f6fc;
  border-left: 4px solid #2271b1;
  border-radius: 0 4px 4px 0;
}

.ri-compare-table-wrap {
  overflow-x: auto;
}

.ri-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ri-compare-table th {
  background: #f8f9fa;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid #ddd;
  font-weight: 600;
  color: #1d2327;
}

.ri-compare-table td {
  padding: 8px 12px;
  border: 1px solid #ddd;
}

.ri-compare-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.ri-compare-field-label {
  font-weight: 600;
  color: #50575e;
  background: #f8f9fa !important;
}

.ri-compare-diff {
  background: #fff8e1 !important;
  font-weight: 600;
}

.ri-compare-error {
  text-align: center;
  color: #d63638;
  padding: 20px;
}

/* ======================================================
   RESPONSIVE - TABLET
   ====================================================== */
@media (max-width: 1024px) {
  .ri-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .ri-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ======================================================
   RESPONSIVE - MOBILNI (CARD LAYOUT)
   ====================================================== */
@media (max-width: 768px) {
  .ri-wrap .ri-title {
    font-size: 20px !important;
    margin: 0 0 20px 0 !important;
  }

  .ri-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .ri-control.ri-search {
    grid-column: span 2;
  }

  .ri-meta {
    justify-content: center;
    text-align: center;
  }

  /* Tabela postaje card layout */
  .ri-table {
    min-width: 0;
    table-layout: auto;
  }

  .ri-table thead {
    display: none;
  }

  .ri-table tbody tr {
    display: block;
    margin: 12px 0;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }

  .ri-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f1f1;
    text-align: left;
    width: auto !important;
  }

  .ri-table tbody td:last-child {
    border-bottom: none;
  }

  .ri-m-label {
    display: block;
    flex-shrink: 0;
    min-width: 40%;
    max-width: 45%;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .ri-m-val {
    display: block;
    flex: 1;
    text-align: left;
    color: #1e1e1e;
    word-break: break-word;
  }

  .ri-table tbody td.ri-right .ri-m-val {
    font-weight: 600;
    color: #0a6f0a;
  }

  .ri-info-col {
    text-align: left;
    background: #f8f9fa;
  }
  
  .ri-info-col .ri-m-label { display: none; }
  .ri-info-col .ri-m-val { text-align: center; width: 100%; }
  .ri-info-col .ri-info-btn { width: 100%; height: 40px; font-size: 14px; }

  /* Modal */
  .ri-modal { padding: 10px; }
  .ri-modal-dialog { margin: 10px auto; }
  .ri-modal-body { max-height: 60vh; }

  .ri-tabs-nav {
    flex-direction: column;
    gap: 4px;
  }

  .ri-tab-btn {
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    margin-bottom: 0;
  }

  .ri-asset-table {
    font-size: 12px;
  }

  .ri-asset-table th,
  .ri-asset-table td {
    padding: 6px 8px;
  }
}

/* ======================================================
   RESPONSIVE - MALI MOBITELI
   ====================================================== */
@media (max-width: 480px) {
  .ri-controls {
    grid-template-columns: 1fr;
  }

  .ri-control.ri-search {
    grid-column: span 1;
  }

  .ri-table tbody td {
    flex-direction: column;
    gap: 4px;
  }

  .ri-m-label {
    min-width: 100%;
    max-width: 100%;
  }
}

/* ======================================================
   PRINT STYLES
   ====================================================== */
@media print {
  .ri-controls,
  .ri-pagination,
  .ri-info-col,
  .ri-modal {
    display: none !important;
  }
  
  .ri-table-wrap {
    overflow: visible;
    border: none;
    box-shadow: none;
  }
  
  .ri-table {
    min-width: 0;
  }
  
  .ri-table th,
  .ri-table td {
    border: 1px solid #ccc;
    padding: 8px;
  }
}
