/* =========================================================
   atlaSignal — premium UI (single styles.css)
   ========================================================= */
:root{
  color-scheme: dark;

  --bg0:#07070a;
  --bg1:#0b0b12;

  --panel: rgba(18,18,28,.80);
  --panel2: rgba(22,22,34,.90);

  --stroke: rgba(255,255,255,.10);
  --stroke2: rgba(255,255,255,.06);

  --text:#f4f4fb;
  --muted: rgba(244,244,251,.72);
  --muted2: rgba(244,244,251,.52);

  --accent:#e50914;

  --shadow: 0 20px 80px rgba(0,0,0,.62);
  --shadow2: 0 10px 28px rgba(0,0,0,.42);

  --r12:12px;
  --r16:16px;
  --r20:20px;
  --r24:24px;

  --topbar-h: 70px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 18% -10%, rgba(229,9,20,.20), transparent 55%),
    radial-gradient(900px 600px at 90% 6%, rgba(80,76,255,.12), transparent 60%),
    radial-gradient(900px 650px at 50% 105%, rgba(255,255,255,.045), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

a{ color:inherit; text-decoration:none; }
.hidden{ display:none !important; }
.lock{ overflow:hidden; }

code{
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  color: rgba(244,244,251,.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .95em;
}

/* ================= TOPBAR ================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1200;
  min-height: var(--topbar-h);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;

  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(7,7,10,.94), rgba(7,7,10,.74));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke2);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.backBtn{
  width: 42px;
  height: 42px;
  display:grid;
  place-items:center;
  border-radius: var(--r12);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  box-shadow: var(--shadow2);
  font-weight: 900;
  cursor:pointer;
  user-select:none;
}
.backBtn:active{ transform: translateY(1px); }

.brandMark{
  width: 42px;
  height: 42px;
  border-radius: var(--r12);
  border: 1px solid rgba(229,9,20,.30);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.18), rgba(255,255,255,0) 55%),
    linear-gradient(135deg, rgba(229,9,20,.95), rgba(229,9,20,.35));
  box-shadow: 0 14px 34px rgba(229,9,20,.16);
  display:grid;
  place-items:center;
  overflow:hidden;
}

.brandMark svg{
  width: 30px;
  height: 30px;
  display:block;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.25));
}

.brandText{ min-width:0; }
.brandName{
  font-weight: 950;
  letter-spacing: .2px;
  font-size: 16px;
  line-height: 1.1;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.brandTag{
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

.iconBtn{
  width: 42px;
  height: 42px;
  border-radius: var(--r12);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  color: var(--text);
  display:grid;
  place-items:center;
  cursor:pointer;
  box-shadow: var(--shadow2);
  user-select:none;
}
.iconBtn:active{ transform: translateY(1px); }
.iconBtn.red{
  border-color: rgba(229,9,20,.35);
  background: rgba(229,9,20,.10);
}

/* legacy controls (ne koristimo) */
.controls{ display:none !important; }

/* ================= LAYOUT ================= */
.layout{
  width: min(1200px, calc(100% - 24px));
  margin: 14px auto 36px;

  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
}
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
}

.playerCard, .listCard, .homeCard{
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--stroke);
  border-radius: var(--r24);
  box-shadow: var(--shadow);
}

/* Player uvek vidljiv ispod topbara */
.playerCard{
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  align-self: start;
  overflow:hidden;
}
@media (max-width: 980px){
  .playerCard{ top: calc(var(--topbar-h) + 10px); }
}

/* ================= NOW PLAYING ================= */
.nowPlaying{
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--stroke2);
}
.npLeft{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}
.npLogo{
  width: 50px;
  height: 50px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  object-fit: contain;
}
.npLogoFallback{
  width: 50px;
  height: 50px;
  border-radius: var(--r16);
  flex: 0 0 50px;
  font-size: 13px;
}
.npName{
  font-weight: 950;
  font-size: 16px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.npMeta{
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

/* ================= MEDIA ================= */
.mediaWrap{ padding: 12px 12px 2px; }
.mediaWrap video,
.mediaWrap audio,
.ytWrap iframe{
  width:100%;
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: #000;
}
.ytWrap iframe{
  aspect-ratio: 16 / 9;
  display:block;
}
.hint{
  padding: 10px 14px 14px;
  color: var(--muted2);
  font-size: 13px;
}

/* ================= INPUTS (shared) ================= */
.input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline: none;
}
.input::placeholder{ color: var(--muted2); }
.input:focus{
  border-color: rgba(229,9,20,.55);
  box-shadow: 0 0 0 5px rgba(229,9,20,.14);
}

/* ================= LIST HEADER ================= */
.listHeader{
  padding: 14px;
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  border-bottom: 1px solid var(--stroke2);
}
.listTitle{
  font-size: 16px;
  font-weight: 950;
}
.count{ color: var(--muted); font-size: 13px; }

/* ================= GROUPING ================= */
#grid{
  padding: 12px;
}

/* group container */
.countryGroup{
  margin: 0 0 18px;
}

/* header: naziv zemlje + badge */
.countryHeader{
  margin: 4px 2px 10px;
  padding: 10px 12px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight: 950;
  letter-spacing: .2px;
}
.countryHeader span{
  display:inline-grid;
  place-items:center;
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(229,9,20,.28);
  background: rgba(229,9,20,.10);
  color: rgba(244,244,251,.92);
  font-size: 12px;
  font-weight: 950;
}

/* grid unutar grupe */
.groupGrid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 2px;
}
@media (max-width: 520px){
  .groupGrid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* ================= CARD ================= */
.card{
  border-radius: var(--r20);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  box-shadow: 0 10px 24px rgba(0,0,0,.34);
  padding: 12px;

  display:flex;
  gap: 12px;
  align-items:flex-start;

  cursor:pointer;
  user-select:none;

  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.card:hover{
  transform: translateY(-3px);
  border-color: rgba(229,9,20,.40);
  box-shadow: 0 18px 44px rgba(0,0,0,.52), 0 0 0 6px rgba(229,9,20,.08);
  background: rgba(255,255,255,.05);
}
.card:active{
  transform: translateY(-1px);
}
.card:focus-visible{
  outline: none;
  box-shadow: 0 18px 44px rgba(0,0,0,.52), 0 0 0 6px rgba(229,9,20,.16);
  border-color: rgba(229,9,20,.55);
}

/* logo unutar kartice */
.cLogo{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  object-fit: contain;
  flex: 0 0 48px;
}

/* fallback badge ako nema logo */
.logoFallback{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(229,9,20,.28);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.14), rgba(255,255,255,0) 55%),
    rgba(229,9,20,.10);
  flex: 0 0 48px;
  display:grid;
  place-items:center;
  color: rgba(244,244,251,.92);
  font-weight: 950;
  font-size: 13px;
  letter-spacing: .6px;
}

/* tekst */
.cName{
  font-weight: 950;
  font-size: 14px;
  line-height: 1.15;
  margin-top: 1px;
}
.cMeta{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

/* ================= FOOTER NOTE ================= */
.footerNote{
  padding: 12px 14px 14px;
  color: var(--muted2);
  font-size: 13px;
  border-top: 1px solid var(--stroke2);
}

/* ================= NOTICE (errors) ================= */
.notice{
  padding: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}
.noticeTitle{
  font-weight: 950;
  margin-bottom: 8px;
}
.noticeBody{
  opacity: .9;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ================= INDEX HOME ================= */
.homeWrap{
  width: min(980px, calc(100% - 24px));
  margin: 18px auto 26px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}
@media (max-width: 720px){
  .homeWrap{ grid-template-columns: 1fr; }
}
.homeCard{
  padding: 18px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.homeCard:hover{
  transform: translateY(-4px);
  border-color: rgba(229,9,20,.40);
  box-shadow: 0 18px 60px rgba(0,0,0,.62), 0 0 0 6px rgba(229,9,20,.08);
}
.homeIcon{
  width: 52px;
  height: 52px;
  display:grid;
  place-items:center;
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  box-shadow: var(--shadow2);
  font-size: 22px;
}
.homeTitle{
  margin-top: 14px;
  font-size: 20px;
  font-weight: 950;
}
.homeSub{
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.footerSimple{
  width: min(980px, calc(100% - 24px));
  margin: 0 auto 38px;
  color: var(--muted2);
  font-size: 13px;
}

/* ================= CENTER MODALS (NOT bottom sheet) ================= */
.overlay{
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(10px);
  display:grid;
  place-items:center;
  padding: 16px;
}
.modalCard{
  width: min(720px, 100%);
  border-radius: var(--r24);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(22,22,34,.92), rgba(18,18,28,.88));
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modalTop{
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom: 1px solid var(--stroke2);
}
.modalTitle{
  font-weight: 950;
  letter-spacing:.2px;
}
.closeBtn{
  width: 42px;
  height: 42px;
  border-radius: var(--r12);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}
.modalBody{
  padding: 14px;
  display:grid;
  gap: 12px;
}

.searchInput{
  width:100%;
  padding: 14px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline:none;
}
.searchInput::placeholder{ color: var(--muted2); }
.searchInput:focus{
  border-color: rgba(229,9,20,.55);
  box-shadow: 0 0 0 5px rgba(229,9,20,.14);
}

.row{ display:grid; gap: 8px; }
.label{ font-size: 13px; color: var(--muted); }

.selectNative{ display:none !important; }

.selectFake{
  width:100%;
  padding: 12px 14px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke);
  background: rgba(10,10,16,.92);
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  cursor:pointer;
}
.selectFake:focus-visible{
  outline:none;
  border-color: rgba(229,9,20,.55);
  box-shadow: 0 0 0 5px rgba(229,9,20,.14);
}
.chev{
  opacity:.85;
  font-weight: 950;
}

.pickList{
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: rgba(8,8,12,.96);
  max-height: 260px;
  overflow:auto;
}
.pickItem{
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor:pointer;
  color: rgba(244,244,251,.90);
}
.pickItem:last-child{ border-bottom:none; }
.pickItem:hover{ background: rgba(255,255,255,.06); }
.pickItem.on{
  background: rgba(229,9,20,.10);
  border-bottom-color: rgba(229,9,20,.14);
}

.seg{ display:flex; gap: 10px; }
.seg button{
  flex:1;
  padding: 12px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight: 950;
}
.seg button.on{
  border-color: rgba(229,9,20,.65);
  box-shadow: 0 0 0 6px rgba(229,9,20,.10);
}

.actions2{ display:flex; gap: 10px; margin-top: 4px; }
.btn{
  flex:1;
  padding: 12px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight: 950;
}
.btnPrimary{
  background: linear-gradient(135deg, rgba(229,9,20,.95), rgba(229,9,20,.52));
  border-color: rgba(229,9,20,.55);
}
.btnDanger{
  background: rgba(229,9,20,.12);
  border-color: rgba(229,9,20,.35);
}

/* ================= NEWS FEED THUMB ================= */
.feedThumb{
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 10px;
  display:block;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
}

/* ================= NEWS ARTICLE (single item) ================= */
.articleCard{
  display:block;
  padding: 14px;
}

.articleHero{
  border-radius: var(--r20);
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.03);
  overflow:hidden;
  margin-bottom: 12px;
}

/* HERO image MUST be contained */
.articleHero img{
  display:block;
  width:100%;
  max-width:100%;
  height:auto;
  max-height: 280px;
  object-fit: contain;
}

/* Ako nema slike – lep placeholder */
.articleHero.placeholder{
  display:grid;
  place-items:center;
  height: 160px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.12), rgba(255,255,255,0) 55%),
    rgba(229,9,20,.10);
  border-color: rgba(229,9,20,.28);
}
.articleHero .phBadge{
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  display:grid;
  place-items:center;
  font-weight: 950;
  letter-spacing: .6px;
}

/* Tipografija */
.articleTitle{
  font-weight: 950;
  font-size: 18px;
  line-height: 1.2;
  margin: 8px 0 10px;
}

.articleMeta{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke2);
  background: rgba(255,255,255,.04);
  color: rgba(244,244,251,.88);
  font-size: 12px;
  font-weight: 800;
}

.articleBody{
  color: rgba(244,244,251,.90);
  font-size: 14px;
  line-height: 1.65;
}

/* Ogranicenje HTML elemenata u content-u */
.articleBody img,
.articleBody video,
.articleBody iframe{
  max-width:100% !important;
  height:auto !important;
  border-radius: var(--r16);
}

.articleBody p{
  margin: 0 0 12px;
}

/* Dugmad ispod */
.articleActions{
  display:flex;
  gap: 10px;
  margin-top: 12px;
}

/* "Ghost" link */
.ghostLink{
  text-align:center;
  opacity: .92;
}

/* ====== KLJUC: Article view neka bude full-width ====== */
body.articleView .layout{
  grid-template-columns: 1fr;
}

body.articleView .listCard{
  display:none;
}

body.articleView .playerCard{
  position: relative;
  top: auto;
}

/* ================= MOBILE ================= */
@media (max-width: 520px){
  .topbar{ padding: 10px 12px; }
  .layout{ width: calc(100% - 16px); }
  .homeWrap{ width: calc(100% - 16px); }
  .footerSimple{ width: calc(100% - 16px); }

  .articleHero img{ max-height: 220px; }

  .articleTitle{ font-size: 17px; }
}

/* ================= TELETEXT VIEWER ================= */

.ttControls{
  padding: 6px 2px 10px;
  display: grid;
  gap: 10px;
}

.ttRow{
  display:flex;
  gap: 10px;
  align-items:center;
}

.ttRow .input{
  flex: 1;
}

.ttRow2{
  flex-wrap: wrap;
}

.ttBtn{
  padding: 10px 12px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
  font-weight: 950;
  min-width: 44px;
}

.ttBtn:active{ transform: translateY(1px); }

.ttWrap{
  margin-top: 10px;
  border-radius: var(--r20);
  border: 1px solid var(--stroke2);
  background: rgba(0,0,0,.35);
  overflow: hidden;
  position: relative;
}

.ttFrame{
  width: 100%;
  height: 560px;
  border: 0;
  display: block;
  background: #000;
}

@media (max-width: 520px){
  .ttFrame{
    height: 72vh;
  }
}

.ttWrap.ttFull{
  position: fixed;
  inset: 0;
  z-index: 2000;
  margin: 0;
  border-radius: 0;
}

.ttWrap.ttFull .ttFrame{
  height: 100vh;
}

.ttCloseBtn{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border-radius: var(--r12);
  border: 1px solid var(--stroke2);
  background: rgba(0,0,0,.55);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow2);
}

.ttCloseBtn:active{ transform: translateY(1px); }

.ttToast{
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--r16);
  border: 1px solid var(--stroke2);
  background: rgba(0,0,0,.35);
  color: rgba(244,244,251,.92);
  font-weight: 800;
  font-size: 13px;
}
