:root {
  --primary: #d31018;
  --bg-card: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--text-dark);
  margin: 0;
  padding: 24px;
}

.news-container {
  max-width: 1200px;
  margin: 0 auto;
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.news-header h2 { margin: 0; font-size: 1.8rem; }

/* SKLOP ZA ISKALNIK IN GUMBE */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ISKALNO POLJE Z NEVTRALNO LUPO IN KRIŽCEM ZA IZBRIS */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 8px 32px 8px 36px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-dark);
  outline: none;
  width: 200px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(211, 16, 24, 0.15);
  width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  stroke: #64748b;
  pointer-events: none;
}

.search-clear-btn {
  display: none;
  position: absolute;
  right: 10px;
  background: #cbd5e1;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  padding: 0;
}

.search-clear-btn:hover {
  background: var(--primary);
}

.filter-buttons { display: flex; gap: 8px; }

.filter-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.filter-btn.active, .filter-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.card-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background-color: #f1f5f9;
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.card-category { color: var(--primary); font-weight: 600; }
.card-title { margin: 0 0 8px 0; font-size: 1.2rem; line-height: 1.4; color: #0f172a; }
.card-subtitle { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* MODALNO OKNO */
.article-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  padding: 40px 16px;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
}

.article-modal.active { display: flex; }

.modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 850px;
  height: auto;
  max-height: 88vh;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0 auto;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 24px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
}

.close-btn:hover { color: var(--primary); border-color: var(--primary); }

.modal-scrollable-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 28px 28px 16px 28px;
}

.modal-header { margin-bottom: 16px; padding-right: 36px; }
.modal-meta { color: #64748b; font-size: 0.85rem; margin-bottom: 6px; }
.modal-category { color: var(--primary); font-weight: 600; }
.modal-title { font-size: 1.7rem; margin: 0; line-height: 1.3; color: #0f172a; }

/* UVODNI BLOK (NASLOVNA SLIKA + PODNASLOV OB NJEJ) */
.article-lead-block {
  margin-top: 14px;
  margin-bottom: 12px;
}

.article-lead-text {
  font-size: 1.02rem;
  line-height: 1.6;
  color: #334155;
  font-weight: 500;
  text-align: justify;
}

.article-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0 20px 0;
  clear: both;
}

.article-content p {
  font-size: 0.98rem;
  line-height: 1.65;
  color: #334155;
  margin-bottom: 14px;
  text-align: justify;
}

.article-content strong,
.article-lead-text strong {
  font-weight: 700;
  color: #0f172a;
}

.modal-title-img-float {
  float: left;
  width: 38%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0 18px 12px 0 !important;
}

.img-left {
  float: left;
  width: 38%;
  max-height: 220px;
  object-fit: cover;
  margin: 4px 18px 12px 0 !important;
  border-radius: 6px;
}

.img-right {
  float: right;
  width: 38%;
  max-height: 220px;
  object-fit: cover;
  margin: 4px 0 12px 18px !important;
  border-radius: 6px;
}

.img-row-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 18px 0;
  flex-wrap: wrap;
}

.img-row-item {
  flex: 1 1 200px;
  max-width: 48%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 6px;
}

.modal-fixed-footer {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  flex: 0 0 auto;
  width: 100%;
}

.bottom-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.bottom-slider-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 2px 0;
  scrollbar-width: none;
}

.bottom-slider-track::-webkit-scrollbar { display: none; }

.slider-item img {
  width: 110px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  transition: transform 0.2s;
  border: 1px solid var(--border);
}

.slider-item img:hover { transform: scale(1.04); }

.slider-item-pdf {
  width: 110px;
  height: 72px;
  background: linear-gradient(145deg, #ffffff, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-dark);
  padding: 6px;
  box-sizing: border-box;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.slider-item-pdf:hover {
  transform: scale(1.04);
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(211, 16, 24, 0.15);
}

.slider-item-pdf .pdf-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 4px;
}

.slider-item-pdf .pdf-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b91c1c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-item-pdf .pdf-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95px;
}

.slider-item-pdf::after {
  content: "↗";
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 10px;
  color: var(--text-muted);
}

.slider-arrow {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.slider-arrow:hover { background: var(--primary); color: #ffffff; border-color: var(--primary); }

.clearfix::after {
  content: "";
  clear: both;
  display: table;
}

.clickable-img {
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}
.clickable-img:hover { opacity: 0.92; }

/* LIGHTBOX */
.lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  user-select: none;
}

.lightbox-modal.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.lightbox-content {
  max-width: 86vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.lightbox-counter {
  position: absolute;
  top: 24px;
  left: 28px;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 20px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #ffffff;
  font-size: 32px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10001;
}

.lightbox-close:hover { background: var(--primary); }

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #ffffff;
  font-size: 36px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10001;
}

.lightbox-arrow:hover { background: var(--primary); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 640px) {
  .article-modal { padding: 20px 10px; }
  .search-box input { width: 100%; }
  .modal-content { max-height: 92vh; }
  .modal-scrollable-body { padding: 20px 16px 10px 16px; }
  .modal-title-img-float {
    float: none;
    width: 100%;
    max-height: 200px;
    margin: 0 0 14px 0 !important;
  }
  .img-left, .img-right {
    float: none;
    width: 100%;
    max-width: 100%;
    max-height: 220px;
    margin: 10px 0 !important;
  }
  .img-row-item { max-width: 100%; }
  .slider-item img, .slider-item-pdf { width: 90px; height: 60px; }
  .lightbox-arrow { width: 40px; height: 40px; font-size: 28px; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
}

@media (max-height: 500px) {
  .modal-content { max-height: none; }
  .modal-scrollable-body { overflow-y: visible; }
}