/*
Theme Name: Dubrava Portal
Theme URI: https://dubrava.hr
Description: Custom WordPress theme for dubrava.hr news portal with dark/light mode
Version: 1.0.0
Author: Dubrava.hr
Author URI: https://dubrava.hr
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dubrava
Tags: news, magazine, dark-mode, responsive
*/

/* ── Variables — dark default ──────────────────────────────── */
:root {
  --blue:        #004c97;
  --blue-hover:  #003570;
  --blue-bright: #5babff;
  --accent:      #3e96fd;

  --bg:          #1c1c1c;
  --bg2:         #222;
  --bg3:         #2a2a2a;
  --bg4:         #323232;
  --border:      #383838;
  --text:        #e4e4e4;
  --text-muted:  #999;
  --text-dim:    #777;
  --card-bg:     #262626;
  --radius:      6px;
  --gap:         18px;
}

body.light {
  --bg:       #f2f4f7;
  --bg2:      #ffffff;
  --bg3:      #ffffff;
  --bg4:      #eef0f3;
  --border:   #dde1e8;
  --text:     #1a1a2e;
  --text-muted: #666;
  --text-dim:   #888;
  --card-bg:  #ffffff;
  --blue-bright: #1a5fa8;
  --accent:      #1a5fa8;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 16px; line-height: 1.6; transition: background 0.3s, color 0.3s; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--blue-bright); }
img { display: block; width: 100%; }

/* ── Mode toggle ────────────────────────────────────────────── */
.mode-toggle {
  position: fixed; top: 12px; right: 16px; z-index: 999;
  background: var(--bg4); border: 1px solid var(--border);
  color: var(--text); font-family: 'Oswald', sans-serif;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 14px; border-radius: 20px; cursor: pointer;
  transition: all 0.2s;
}
.mode-toggle:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Section title ─────────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
  margin-bottom: 18px;
  padding-bottom: 0;
  gap: 12px;
}
.section-title .label {
  font-family: 'Oswald', sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--blue-bright);
  border-bottom: 3px solid var(--blue-bright);
  padding-bottom: 10px;
  margin-bottom: -2px;
  display: inline-block;
  line-height: 1;
}
.section-title .more {
  font-family: 'Oswald', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 12px;
}
.section-title .more:hover { color: var(--blue-bright); }

/* ── Page structure ─────────────────────────────────────────── */
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 24px 20px 0; }

/* Rows 1 & 2 — full width */
.section-gap { margin-bottom: 32px; }

/* Row 3 — feed + sidebar grid */
.row3-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  margin-bottom: 32px;
  align-items: start;
}

/* ── ROW 1: Hero + Istaknuto ───────────────────────────────── */
.row1 {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: var(--gap);
}

/* Hero */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg3);
  display: block;
  color: inherit;
}
.hero-img { height: 440px; object-fit: cover; transition: transform 0.5s ease; }
.hero:hover .hero-img { transform: scale(1.025); }
.hero-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 90px 24px 24px;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.55) 50%, transparent 100%);
}
.hero-cat {
  display: inline-block; background: var(--blue); color: #fff;
  font-family: 'Oswald', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  padding: 3px 10px; border-radius: 3px; margin-bottom: 9px;
}
.hero-title {
  font-family: 'Oswald', sans-serif; font-size: 36px; font-weight: 700;
  color: #fff; line-height: 1.2; margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
.hero:hover .hero-title { color: var(--blue-bright); }
.hero-excerpt { font-size: 16px; color: rgba(255,255,255,.75); line-height: 1.5; margin-bottom: 8px; }
.hero-date { font-size: 13px; color: rgba(255,255,255,.6);  }

/* Istaknuto panel */
.istaknuto-panel { display: flex; flex-direction: column; }

.ist-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.ist-card:first-of-type { padding-top: 0; }
.ist-card:last-of-type { border-bottom: none; padding-bottom: 0; }
.ist-thumb { width: 100px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.ist-body { flex: 1; min-width: 0; }
.ist-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; gap: 6px; }
.ist-cat {
  font-family: 'Oswald', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--blue-bright);
}
.ist-date { font-size: 11px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }
.ist-title {
  font-family: 'Oswald', sans-serif; font-size: 15px; font-weight: 500;
  line-height: 1.3; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ist-card:hover .ist-title { color: var(--blue-bright); }

/* ── ROW 2: 4 category columns ─────────────────────────────── */
.row2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

.cat-col {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 14px;
  border: 1px solid var(--border);
}

.cat-article {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.cat-article:first-of-type { padding-top: 0; }
.cat-article:last-of-type { border-bottom: none; padding-bottom: 0; }
.cat-left { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; }
.cat-thumb { width: 90px; height: 68px; object-fit: cover; border-radius: 3px; display: block; }
.cat-date { font-size: 11px; color: var(--text-dim); text-align: center; white-space: nowrap; }
.cat-body { flex: 1; min-width: 0; }
.cat-title {
  font-family: 'Oswald', sans-serif; font-size: 15px; font-weight: 500;
  line-height: 1.3; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 3px;
}
.cat-article:hover .cat-title { color: var(--blue-bright); }
.cat-snippet {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── ROW 3: Najnovije feed ──────────────────────────────────── */
.feed-article {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.feed-article:first-of-type { padding-top: 0; }
.feed-thumb { width: 200px; height: 140px; object-fit: cover; border-radius: 5px; flex-shrink: 0; }
.feed-body { flex: 1; min-width: 0; }
.feed-cat {
  font-family: 'Oswald', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--blue-bright);
  margin-bottom: 4px; display: block;
}
.feed-title {
  font-family: 'Oswald', sans-serif; font-size: 19px; font-weight: 600;
  line-height: 1.25; color: var(--text); margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-article:hover .feed-title { color: var(--blue-bright); }
.feed-snippet {
  font-size: 14px; color: var(--text-muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-date { font-size: 13px; color: var(--text-dim);  margin-top: 5px; display: block; }

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebar-block {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-block-title {
  font-family: 'Oswald', sans-serif; font-size: 21px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--blue-bright);
  border-bottom: 3px solid var(--blue-bright);
  padding: 14px 16px 11px;
  display: inline-block;
  margin-bottom: 0;
  line-height: 1;
}
.sidebar-block-header {
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
  margin-bottom: 0;
}

/* ── Transport accordion ────────────────────────────────────── */
.acc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s; user-select: none;
}
.acc-header:hover { background: var(--bg4); }
.acc-label {
  font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--text); display: flex; align-items: center; gap: 8px;
}
.acc-label svg { vertical-align: middle; flex-shrink: 0; }
.acc-icon { font-size: 10px; color: var(--blue-bright); transition: transform 0.3s ease; }
.acc-icon.open { transform: rotate(180deg); }
.acc-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg2);
}
.acc-body.open { max-height: 2000px; }

/* Bus & tram — whole row is the link */
.line-list { padding: 4px 0; }
.line-item {
  display: flex; align-items: center; gap: 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text-muted);
  transition: background 0.15s;
}
.line-item:last-child { border-bottom: none; }
.line-item:hover { background: var(--bg4); color: var(--text); }
.line-num {
  font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--blue-bright); min-width: 57px; flex-shrink: 0;
  text-align: center; padding: 8px 0;
  border-right: 1px solid var(--border);
  transition: color 0.2s;
}
.line-name { font-size: 12px; padding: 7px 10px; flex: 1; line-height: 1.3; transition: padding-left 0.2s; }
.line-item:hover .line-name { padding-left: 14px; }
.line-item:hover .line-num { color: #fff; }

/* Section label inside bus list */
.line-group {
  font-family: 'Oswald', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 14px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  display: block;
}
body.light .line-group { background: var(--bg4); }

/* Night line styling */
.line-item.night .line-num { color: #7b9fd4; }
.line-item.night .line-name { font-style: italic; }

/* ── Vlakovi — exact live site CSS, adapted for dark/light ─── */
.route-container { display: table; width: 100%; border-collapse: collapse; padding: 6px 10px; box-sizing: border-box; }
.route-row { display: table-row; border-bottom: 1px solid var(--border); }
.route-cell { display: table-cell; border: 0; vertical-align: middle; padding: 0; }
.route-cell-left  { text-align: left; }
.route-cell-center { text-align: center; font-size: 12px; color: var(--text-muted); }
.route-cell-right { text-align: right; }
.route-cell-arrow {
  text-align: center; font-size: 22px; font-weight: bold; width: 36px; padding: 0;
  color: var(--text-dim);
}
.cell-link {
  display: block; padding: 7px 6px;
  text-decoration: none; color: var(--accent);
  box-sizing: border-box; font-size: 14px;
  font-weight: 500;
}
.cell-link:hover { background-color: var(--bg4); color: var(--blue-bright); border-radius: 3px; }
.route-divider { border: none; border-top: 1px solid var(--border); margin: 2px 10px; }

/* Arrow pulse animation */
@keyframes arrowPulse {
  0%   { transform: translateX(0);    opacity: 1; }
  40%  { transform: translateX(10px); opacity: 0; }
  41%  { transform: translateX(-4px);  opacity: 0; }
  70%  { transform: translateX(0);    opacity: 1; }
  100% { transform: translateX(0);    opacity: 1; }
}
.route-cell-left:hover + .route-cell-arrow {
  animation: arrowPulse 1.1s ease-in-out infinite;
  color: var(--blue-bright);
}
.route-cell-right:hover {
  --right-hovered: 1;
}
.route-row:has(.route-cell-right:hover) .route-cell-center + .route-cell-arrow {
  animation: arrowPulse 1.1s ease-in-out infinite;
  color: var(--blue-bright);
}

/* ── Kalendar (Google Calendar) ─────────────────────────────── */
.cal-loading {
  padding: 16px; text-align: center; font-size: 12px; color: var(--text-muted);
  font-family: 'Oswald', sans-serif; letter-spacing: 1px;
}
.cal-error { padding: 12px 16px; font-size: 12px; color: #e06c6c; }

.cal-event {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: background 0.15s;
}
.cal-event:last-of-type { border-bottom: none; }
.cal-event:hover { background: var(--bg4); }

.cal-date-box {
  background: var(--blue); border-radius: 5px;
  width: 40px; flex-shrink: 0; text-align: center; padding: 5px 0;
}
.cal-day { font-family: 'Oswald', sans-serif; font-size: 20px; font-weight: 700; color: #fff; line-height: 1; display: block; }
.cal-mon { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,.7); display: block; }

.cal-body { flex: 1; min-width: 0; }
.cal-name { font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3; display: block; }
.cal-event:hover .cal-name { color: var(--blue-bright); }
.cal-time { font-size: 12px; color: var(--text-dim);  margin-top: 2px; display: block; }

/* ── Month label inside calendar ────────────────────────────── */
.cal-month-sep {
  font-family: 'Oswald', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 14px 4px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
body.light .cal-month-sep { background: var(--bg4); }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {

  .page-wrap { padding: 12px 12px 0; }

  /* Row 1: stack hero + istaknuto vertically */
  .row1 { grid-template-columns: 1fr; }
  .hero-img { height: 240px; }
  .hero-title { font-size: 24px; }
  .hero-excerpt { display: none; }

  /* Istaknuto: title moves above hero on mobile, cards stack normally */
  .row1 { display: flex; flex-direction: column; }
  .hero { order: 1; }
  .istaknuto-panel { order: 2; flex-direction: column; overflow: visible; gap: 0; padding-bottom: 0; }
  .ist-card {
    flex-direction: row; min-width: unset; max-width: unset;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 10px 0;
  }
  .ist-card:last-of-type { border-bottom: none; }
  .ist-thumb { width: 80px; height: 56px; flex-shrink: 0; }
  .ist-title { font-size: 14px; }

  /* Row 2: 2 columns on tablet, 1 on small */
  .row2 { grid-template-columns: repeat(2, 1fr); }

  /* Row 3: stack feed + sidebar */
  .row3-wrap { grid-template-columns: 1fr; }

  /* Feed: smaller thumbs */
  .feed-thumb { width: 110px; height: 80px; }
  .feed-title { font-size: 16px; }
  .feed-snippet { display: none; }

  /* Section titles smaller */
  .section-title .label { font-size: 17px; }

  /* Mode toggle repositioned */
  .mode-toggle { top: 8px; right: 8px; font-size: 10px; padding: 5px 10px; }
}

@media (max-width: 480px) {
  /* Row 2: single column on small phones */
  .row2 { grid-template-columns: 1fr; }

  .hero-img { height: 200px; }
  .hero-title { font-size: 20px; }

  /* Feed: even smaller */
  .feed-thumb { width: 90px; height: 68px; }
  .feed-title { font-size: 15px; }
}
