/*
 * GLT Karatay – ortak arayüz katmanı: modallar ve bildirimler (tüm sayfalar)
 * Davranış: ui-kit.js. Tema dosyalarından SONRA yüklenir.
 *
 * Tek modal dili:
 *  - Örtü: koyu gece tonu, hafif bulanıklık
 *  - Kutu: 24px köşe, ekranın %90'ından uzunsa kendi içinde kayar
 *  - Kapat: 44px yuvarlak düğme, sağ üstte
 *  - Telefonda: alttan açılan sayfa (tam genişlik, üst köşeler yuvarlak)
 */

html.glt-modal-open, html.glt-modal-open body { overflow: hidden; }

/* ------------------------------------------------------------- overlays -- */
.admin-modal-overlay,
.profile-modal-overlay {
  background: rgba(7, 8, 15, 0.72) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.glt-popup-overlay, .glt-perm-modal, .lightbox { background: rgba(7, 8, 15, 0.86) !important; }

/* --------------------------------------------------------------- panels -- */
.admin-modal-content {
  border-radius: 24px;
  max-height: min(90vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 4vw, 40px);
}
.admin-modal-header h2, .admin-modal-header h3 {
  font-weight: 900; letter-spacing: -0.02em; line-height: 1.15;
}

/* Kapat düğmeleri: aynı boy, aynı yer, görünür odak */
.admin-modal-close, .glt-popup-close, .lightbox-close {
  width: 44px !important; height: 44px !important;
  top: 16px !important; right: 16px !important;
  border-radius: 50% !important;
  display: inline-flex !important; align-items: center; justify-content: center;
  z-index: 5;
}
.admin-modal-close svg, .glt-popup-close svg, .lightbox-close svg { width: 18px; height: 18px; }
.glt-popup-close:hover { transform: none !important; }
:is(.admin-modal-close, .glt-popup-close, .lightbox-close, .glt-perm-skip):focus-visible {
  outline: 2px solid #f2535a; outline-offset: 2px;
}

/* Duyuru pop-up'ı: daha sakin giriş, görsel tıklanabilir olduğunu göstersin */
.glt-popup-container { border-radius: 24px !important; transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1) !important; }
.glt-popup-content:hover img { transform: none !important; }

/* Bildirim izni penceresi: marka rengi (önceden Discord mavisi) */
html .glt-perm-card {
  background: #12141d; border-radius: 24px; padding: clamp(28px, 5vw, 40px);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
}
html .glt-perm-icon { background: rgba(226, 31, 38, 0.14); color: #f2535a; }
html .glt-perm-card h2 { font-weight: 900; letter-spacing: -0.02em; }
html .glt-perm-btn { background: #e21f26; border-radius: 999px; min-height: 48px; }
html .glt-perm-btn:hover { background: #c4181f; transform: none; }
html .glt-perm-skip { min-height: 44px; padding: 0 16px; color: #b4b6c0; }
html .glt-perm-skip:hover { color: #fff; }

/* ----------------------------------------------------- phone: bottom sheet */
@media (max-width: 600px) {
  .admin-modal { align-items: flex-end !important; }
  .admin-modal-content {
    width: 100% !important; max-width: none !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 92vh;
    padding: 28px 20px calc(24px + env(safe-area-inset-bottom)) !important;
    transform: translateY(24px);
  }
  .admin-modal.active .admin-modal-content { transform: none; }
  .admin-modal-content::before {
    content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: currentColor; opacity: 0.2; margin: -12px auto 16px;
  }
  .glt-perm-modal { align-items: flex-end !important; }
  html .glt-perm-card { width: 100%; max-width: none; border-radius: 24px 24px 0 0; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}

/* --------------------------------------------------------------- notes -- */
.glt-notes {
  position: fixed; z-index: 1000000;
  left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.glt-note {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 10px 14px 18px; border-radius: 16px;
  background: #12141d; color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid #a6a8b3;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25), 0 18px 40px -12px rgba(0, 0, 0, 0.5);
  font-family: 'Montserrat', system-ui, sans-serif; font-size: 0.92rem; font-weight: 600; line-height: 1.45;
  animation: glt-note-in 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
.glt-note p { flex: 1; margin: 6px 0 0; white-space: pre-line; }
.glt-note--success { border-left-color: #4ade80; }
.glt-note--error { border-left-color: #f2535a; }
.glt-note__close {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: #b4b6c0; cursor: pointer;
}
.glt-note__close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.glt-note.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity 180ms, transform 180ms; }
@keyframes glt-note-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.glt-note__title { display: block; font-weight: 800; color: #fff; margin-bottom: 2px; }
.glt-note__link { color: inherit; text-decoration: none; display: block; }
.glt-note__link:hover .glt-note__title, .glt-note__link:focus-visible .glt-note__title { text-decoration: underline; }

/* ------------------------------------------- okunmamış bildirim sayısı -- */
/* Üst menüdeki profil düğmesinde (app_prod_v2.js → gltSetUnread) */
.glt-cta-new[data-unread] { position: relative; }
.glt-cta-new[data-unread]::after {
  content: attr(data-unread);
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: #e21f26; color: #fff; border: 2px solid var(--bg, #fff);
  font-size: 0.68rem; font-weight: 800; line-height: 16px; text-align: center;
}

/* ------------------------------------------------- seviye temaları -- */
/* Mor (5+), altın (8+), efsane (10+) seviyede üyenin kendi ekranında vurgu rengi değişir.
   Üye profilinden kapatabilir. data-level-tier: app_prod_v2.js → gltApplyLevelTheme */
html[data-level-tier="purple"] { --level-a: #a855f7; --level-b: #6366f1; }
html[data-level-tier="gold"] { --level-a: #eab308; --level-b: #f97316; }
html[data-level-tier="legend"] { --level-a: #22d3ee; --level-b: #a855f7; }
html[data-level-tier] .glt-cta-new {
  box-shadow: 0 0 0 2px var(--level-a), 0 0 22px -4px var(--level-a);
}
html[data-level-tier] .xp-bar-fill { background: linear-gradient(90deg, var(--level-a), var(--level-b)); }
html[data-level-tier] ::selection { background: var(--level-a); color: #fff; }
html[data-level-tier] .gh-btn--accent, html[data-level-tier] .btn-primary {
  background-image: linear-gradient(120deg, transparent 40%, color-mix(in srgb, var(--level-a) 35%, transparent));
}
@media (prefers-reduced-motion: no-preference) {
  html[data-level-tier="legend"] .glt-cta-new { animation: glt-legend 6s linear infinite; }
  @keyframes glt-legend {
    0%, 100% { box-shadow: 0 0 0 2px #22d3ee, 0 0 22px -4px #22d3ee; }
    50% { box-shadow: 0 0 0 2px #a855f7, 0 0 22px -4px #a855f7; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .glt-note { animation: none; }
  .admin-modal, .admin-modal-content, .glt-popup-overlay, .glt-popup-container, .glt-perm-card { transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------- modal form fields -- */
/* Görünür etiketli alan (yer tutucu etiketin yerini tutmaz) */
.glt-field { text-align: left; margin-bottom: 16px; }
.glt-field label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 700; color: var(--text-soft); }
.glt-field input, .glt-field select, .glt-field textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font: inherit; font-weight: 600;
}
[data-theme="light"] .glt-field :is(input, select, textarea) { border-color: rgba(0, 0, 0, 0.16); }
.glt-field textarea { padding: 12px 14px; min-height: 110px; }
.glt-field :is(input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }

/* ------------------------------------------- onay ve soru pencereleri -- */
/* ui-kit.js → gltConfirm / gltPrompt / gltAsk. Bildirimlerle aynı koyu yüzey, her temada. */
dialog.glt-ask {
  --bg: #0b0d14; --border: rgba(255, 255, 255, 0.16); --text: #f5f5f7; --text-soft: #b4b6c0; --accent: #f2535a;
  width: min(440px, calc(100vw - 32px)); max-height: min(90vh, 640px);
  margin: auto; padding: 0; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 24px;
  background: #12141d; color: var(--text);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
  font-family: 'Montserrat', system-ui, sans-serif;
}
dialog.glt-ask::backdrop { background: rgba(7, 8, 15, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog.glt-ask[open] { animation: glt-note-in 200ms cubic-bezier(0.23, 1, 0.32, 1); }
.glt-ask__form { padding: clamp(24px, 5vw, 32px); }
.glt-ask__title { margin: 0 0 8px; font-size: 1.25rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.2; color: #fff; }
.glt-ask__msg { margin: 0 0 20px; color: var(--text-soft); font-size: 0.95rem; font-weight: 600; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.glt-ask__title + .glt-field { margin-top: 16px; }
html[data-theme="light"] .glt-ask .glt-field :is(input, select, textarea) { border-color: var(--border); }
.glt-ask__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.glt-ask__btn {
  min-height: 48px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 0.92rem;
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.glt-ask__btn:hover { background: rgba(255, 255, 255, 0.06); }
.glt-ask__btn--ok { background: #e21f26; border-color: #e21f26; color: #fff; }
.glt-ask__btn--ok:hover { background: #c4181f; border-color: #c4181f; }
.glt-ask__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
  dialog.glt-ask { margin: auto auto 0; width: 100%; max-width: none; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .glt-ask__form { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .glt-ask__actions .glt-ask__btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { dialog.glt-ask[open] { animation: none; } }
