/* UzakDestek — viewer arayuzu
 *
 * NOT: Secici (selector) adlari bilerek tamamen ASCII'dir. iOS Safari
 * Turkce karakterli sinif adlarini guvenilir sekilde uygulamiyor.
 * Kullaniciya gorunen METIN Turkce; sinif adlari degil.
 */

:root {
  --zemin:        #0f1216;
  --zemin-2:      #171b21;
  --zemin-3:      #1f242c;
  --cizgi:        #2a313b;
  --metin:        #e6eaf0;
  --metin-soluk:  #8b96a5;
  --vurgu:        #3b82f6;
  --vurgu-koyu:   #2563eb;
  --yesil:        #22c55e;
  --kirmizi:      #ef4444;
  --sari:         #f59e0b;
  --yuvarlak:     10px;
  --ust-yukseklik: 52px;
  /* Telefonda centik/ev cubugu guvenli alani */
  --guvenli-ust:  env(safe-area-inset-top, 0px);
  --guvenli-alt:  env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  background: var(--zemin);
  color: var(--metin);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

.ekran { display: block; height: 100%; overflow-y: auto; }
.ekran[hidden] { display: none !important; }
.ekran-orta { display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ---------------- Ortak bilesenler ---------------- */

.logo { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.logo span { color: var(--vurgu); }
.logo-kucuk { font-size: 17px; }

.alt-yazi { color: var(--metin-soluk); font-size: 13px; margin-bottom: 18px; }

.kart {
  background: var(--zemin-2);
  border: 1px solid var(--cizgi);
  border-radius: var(--yuvarlak);
  padding: 22px;
}
.kart h2 { font-size: 15px; margin-bottom: 4px; }
.kart-giris { width: 100%; max-width: 360px; }

.alan { display: block; margin-bottom: 14px; }
.alan > span {
  display: block; font-size: 12px; color: var(--metin-soluk);
  margin-bottom: 5px; font-weight: 500;
}
.alan input, .secim {
  width: 100%;
  background: var(--zemin-3);
  border: 1px solid var(--cizgi);
  border-radius: 8px;
  color: var(--metin);
  padding: 10px 12px;
  /* 16px altinda iOS otomatik yakinlastirma yapar — 16px sabit. */
  font-size: 16px;
  font-family: inherit;
}
.alan input:focus, .secim:focus {
  outline: none; border-color: var(--vurgu);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}

.dugme {
  border: 1px solid var(--cizgi);
  background: var(--zemin-3);
  color: var(--metin);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  /* Dokunmatikte cift dokunma yakinlastirmasini engelle */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.dugme:active { transform: translateY(1px); }
.dugme:disabled { opacity: .5; cursor: not-allowed; }
.dugme-ana {
  width: 100%;
  background: var(--vurgu); border-color: var(--vurgu);
  color: #fff; font-weight: 600; padding: 12px;
}
.dugme-ana:hover { background: var(--vurgu-koyu); }
.dugme-sade {
  background: transparent; border-color: transparent;
  color: var(--metin-soluk); padding: 8px 10px; font-size: 16px;
  min-width: 38px;
}
.dugme-sade:hover { background: var(--zemin-3); color: var(--metin); }

.uyari {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
  border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-top: 12px;
}

/* ---------------- Ust cubuk ---------------- */

.ust-cubuk {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  height: calc(var(--ust-yukseklik) + var(--guvenli-ust));
  padding: var(--guvenli-ust) 14px 0;
  background: rgba(15,18,22,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cizgi);
}
.ust-sag { display: flex; gap: 2px; }

.arac-cubugu {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; flex-wrap: wrap;
}
.arac-cubugu input[type="search"] {
  flex: 1 1 200px; min-width: 0;
  background: var(--zemin-2); border: 1px solid var(--cizgi);
  border-radius: 8px; color: var(--metin); padding: 9px 12px; font-size: 16px;
}
.onay { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--metin-soluk); white-space: nowrap; }
.onay input { width: 16px; height: 16px; accent-color: var(--vurgu); }

/* ---------------- Cihaz listesi ---------------- */

.cihaz-listesi {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  padding: 0 14px calc(24px + var(--guvenli-alt));
}
.grup-basligi {
  grid-column: 1 / -1;
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--metin-soluk); font-weight: 600;
  margin-top: 10px; padding-left: 2px;
}
.cihaz {
  display: flex; align-items: center; gap: 12px;
  background: var(--zemin-2);
  border: 1px solid var(--cizgi);
  border-radius: var(--yuvarlak);
  padding: 13px 14px;
  cursor: pointer;
  text-align: left; width: 100%;
  font-family: inherit; color: inherit;
  touch-action: manipulation;
}
.cihaz:hover { border-color: var(--vurgu); background: var(--zemin-3); }
.cihaz[data-cevrimici="0"] { opacity: .5; }
.cihaz[data-cevrimici="0"]:hover { border-color: var(--cizgi); }

.nokta { width: 9px; height: 9px; border-radius: 50%; background: var(--metin-soluk); flex: none; }
.nokta[data-acik="1"] { background: var(--yesil); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

.cihaz-bilgi { min-width: 0; flex: 1; }
.cihaz-ad {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cihaz-alt {
  font-size: 12px; color: var(--metin-soluk);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kilit { font-size: 13px; color: var(--metin-soluk); flex: none; }

.bos-mesaj { text-align: center; color: var(--metin-soluk); padding: 40px 20px; font-size: 14px; }

/* ---------------- Oturum ekrani ---------------- */

.ekran-oturum { position: relative; overflow: hidden; background: #000; }

.sahne {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  /* Tarayicinin kendi kaydirma/yakinlastirma jestlerini kapat —
     tum dokunmatik olaylari biz yorumluyoruz. */
  touch-action: none;
}
#o-video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: block;
  transform-origin: 0 0;
  /* Uzak masaustu keskin gorunsun */
  image-rendering: -webkit-optimize-contrast;
}
.sahne[data-imlec="gizli"] { cursor: none; }

.imlec-katman { position: absolute; inset: 0; pointer-events: none; }

.katman {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,18,22,.94);
  padding: 24px;
}
.katman[hidden] { display: none; }
.katman-ic { text-align: center; max-width: 380px; width: 100%; }
.katman-ic > p { margin-top: 14px; font-size: 15px; }
.katman-alt { color: var(--metin-soluk); font-size: 13px; margin-top: 6px !important; }

.spinner {
  width: 34px; height: 34px; margin: 0 auto;
  border: 3px solid var(--cizgi); border-top-color: var(--vurgu);
  border-radius: 50%; animation: don .8s linear infinite;
}
@keyframes don { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.parola-kutu { margin-top: 22px; text-align: left; }

.parmak-kutu { margin-top: 20px; text-align: left; }
.parmak-baslik { font-weight: 600; margin-bottom: 6px; }
.parmak-aciklama { font-size: 13px; color: var(--metin-soluk); margin-bottom: 12px; }
.parmak-izi {
  display: block; text-align: center;
  background: var(--zemin-3); border: 1px solid var(--cizgi);
  border-radius: 8px; padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px; letter-spacing: 1px; color: var(--sari);
  word-break: break-all;
}
.parmak-dugmeler { display: flex; gap: 8px; margin-top: 14px; }
.parmak-dugmeler .dugme { flex: 1; }

/* Oturum ust bilgi seridi */
.oturum-bilgi {
  position: absolute; top: 0; left: 0; right: 0; z-index: 25;
  display: flex; align-items: center; gap: 8px;
  height: calc(44px + var(--guvenli-ust));
  padding: var(--guvenli-ust) 8px 0;
  background: linear-gradient(rgba(0,0,0,.75), rgba(0,0,0,0));
  /* Video uzerinde durur ama tiklamayi engellemesin */
  pointer-events: none;
}
.oturum-bilgi > * { pointer-events: auto; }
.oturum-bilgi[hidden] { display: none; }
.oturum-ad {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 34vw;
}
.oturum-sag { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.rozet {
  font-size: 10px; padding: 2px 7px; border-radius: 20px;
  background: rgba(255,255,255,.12); color: #cbd5e1;
  white-space: nowrap; font-weight: 600; letter-spacing: .3px;
}
.rozet[data-tur="p2p"] { background: rgba(34,197,94,.25); color: #86efac; }
.rozet[data-tur="relay"] { background: rgba(245,158,11,.25); color: #fcd34d; }
.secim { width: auto; padding: 5px 8px; font-size: 12px; }

/* Sanal tus cubugu (mobil) */
.tus-cubugu {
  position: absolute; left: 0; right: 0; z-index: 26;
  bottom: 0; padding: 6px 6px calc(6px + var(--guvenli-alt));
  background: rgba(15,18,22,.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--cizgi);
}
.tus-cubugu[hidden] { display: none; }
.tus-satir { display: flex; gap: 4px; margin-bottom: 4px; }
.tus-satir:last-child { margin-bottom: 0; }
.tus-satir-f { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tus {
  flex: 1; min-width: 40px;
  background: var(--zemin-3); border: 1px solid var(--cizgi);
  color: var(--metin); border-radius: 7px;
  padding: 10px 4px; font-size: 12px; font-family: inherit;
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.tus:active, .tus[data-basili="1"] { background: var(--vurgu); border-color: var(--vurgu); color: #fff; }
.tus-genis { flex: 2.2; }

.gizli-giris {
  position: absolute; opacity: 0; pointer-events: none;
  width: 1px; height: 1px; bottom: 0; left: 0;
  border: 0; background: transparent;
}

/* Yan panel (dosya transferi) */
.yan-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 28;
  width: min(360px, 100%);
  background: var(--zemin-2);
  border-left: 1px solid var(--cizgi);
  display: flex; flex-direction: column;
  padding-top: var(--guvenli-ust);
}
.yan-panel[hidden] { display: none; }
.yan-panel-ust {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--cizgi);
}
.yan-panel-ic { padding: 14px; overflow-y: auto; flex: 1; }
.dosya-birak {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--cizgi); border-radius: var(--yuvarlak);
  padding: 28px 16px; color: var(--metin-soluk); font-size: 13px;
  cursor: pointer;
}
.dosya-birak[data-uzerinde="1"] { border-color: var(--vurgu); background: rgba(59,130,246,.08); }
.yan-not { font-size: 12px; color: var(--metin-soluk); margin: 10px 0 14px; }
.yan-not code { background: var(--zemin-3); padding: 1px 5px; border-radius: 4px; }

.transfer-listesi { list-style: none; display: grid; gap: 8px; }
.transfer {
  background: var(--zemin-3); border: 1px solid var(--cizgi);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.transfer-ad { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.cubuk { height: 4px; background: var(--zemin); border-radius: 3px; overflow: hidden; }
.cubuk i { display: block; height: 100%; background: var(--vurgu); width: 0; transition: width .2s; }
.transfer[data-durum="tamam"] .cubuk i { background: var(--yesil); }
.transfer[data-durum="hata"] .cubuk i { background: var(--kirmizi); }

/* Yonetim */
.yonetim-ic {
  display: grid; gap: 14px; padding: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding-bottom: calc(24px + var(--guvenli-alt));
}
.jeton-sonuc {
  margin-top: 12px; padding: 12px;
  background: var(--zemin-3); border: 1px solid var(--vurgu); border-radius: 8px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px; word-break: break-all; user-select: all;
}
.denetim-liste { max-height: 420px; overflow-y: auto; font-size: 12px; }
.denetim-satir {
  display: flex; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--cizgi); color: var(--metin-soluk);
}
.denetim-satir:last-child { border-bottom: 0; }
.denetim-zaman { flex: none; font-variant-numeric: tabular-nums; }
.denetim-olay { flex: none; font-weight: 600; color: var(--metin); }

/* Bildirim */
.bildirim {
  position: fixed; z-index: 100;
  left: 50%; transform: translateX(-50%);
  bottom: calc(24px + var(--guvenli-alt));
  background: var(--zemin-3); border: 1px solid var(--cizgi);
  color: var(--metin); padding: 11px 18px; border-radius: 24px;
  font-size: 13px; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
.bildirim[hidden] { display: none; }
.bildirim[data-tur="hata"] { border-color: var(--kirmizi); color: #fca5a5; }
.bildirim[data-tur="basari"] { border-color: var(--yesil); color: #86efac; }

/* Dar ekran duzenlemeleri */
@media (max-width: 560px) {
  .cihaz-listesi { grid-template-columns: 1fr; }
  .oturum-ad { max-width: 28vw; }
  .rozet { display: none; }
  .rozet[data-tur] { display: inline-block; }
}
