/* ==========
   Basic / Variables
   ========== */
:root,
:root.theme-light{
  --maxw: 100%;
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-soft:#eee;
  --primary: #2563eb;
  --primary-600:#2563eb;
  --primary-700:#1d4ed8;
  --danger: #b91c1c;
  --danger-soft:#fca5a5;
  --ghost: transparent;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 6px 16px rgba(0,0,0,.08);
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 2px solid #93c5fd;

  --sheet-progress: 0;

  --header-h: 66px;
  --map-h: calc(100vh - var(--header-h) - 16px);
  --panel-h: var(--map-h);

  --desc-h: 120px;
  --desc-max-h: 220px;

  --tbl-font: clamp(13px, 1.05vw, 15px);
  --tbl-head: clamp(13.5px, 1.1vw, 16px);

  --legend-font: clamp(10px, 2.8vw, 13px);
  --legend-w: clamp(160px, 36%, 320px);
  --legend-maxh: clamp(120px, 38vh, 44vh);
}

/* Dark Theme */
:root.theme-dark{
  --maxw: 100%;
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --border-soft: #334155;
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --danger: #dc2626;
  --danger-soft: #ef4444;
  --ghost: transparent;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 6px 16px rgba(0,0,0,.4);
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 2px solid #60a5fa;

  --sheet-progress: 0;

  --header-h: 66px;
  --map-h: calc(100vh - var(--header-h) - 16px);
  --panel-h: var(--map-h);

  --desc-h: 120px;
  --desc-max-h: 220px;

  --tbl-font: clamp(13px, 1.05vw, 15px);
  --tbl-head: clamp(13.5px, 1.1vw, 16px);

  --legend-font: clamp(10px, 2.8vw, 13px);
  --legend-w: clamp(160px, 36%, 320px);
  --legend-maxh: clamp(120px, 38vh, 44vh);
}

*,
*::before,
*::after{ box-sizing: border-box; }

html{ 
  -webkit-text-size-adjust:100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* ==========
   Home Screen: Full Screen Map (Responsive)
   ========== */
body:not(.role-user):not(.role-supervisor):not(.role-admin) #map,
body.login-fullmap #map,
body.public-fullmap #map{
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  z-index: 0;
  border-radius: 0;
  border: none;
}

body:not(.role-user):not(.role-supervisor):not(.role-admin),
body.login-fullmap,
body.public-fullmap{
  overflow: hidden !important;
  height: 100vh;
}

/* Harita Blur Efekti (Desktop) */
#map.blur-background {
  filter: blur(4px);
  transition: filter 0.3s ease;
}

/* ==========
   Header - Responsive Logo ve Giriş Butonu
   ========== */
header{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: saturate(180%) blur(8px);
  padding-top: env(safe-area-inset-top);
  box-shadow: var(--shadow-sm);
}

:root.theme-dark header{
  background: rgba(15, 23, 42, 0.95);
  border-bottom-color: var(--border);
}

.wrap{
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(8px, 1.5vw, 12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vw, 16px);
  flex-wrap: nowrap; 
  min-height: 48px;
}

.brand{ 
  display:flex; 
  align-items:center; 
  gap: clamp(6px, 1.2vw, 12px);
  flex: 0 1 auto;
  min-width:0;
}

.brand img{ 
  height: clamp(32px, 6vw, 48px);
  width: clamp(32px, 6vw, 48px);
  object-fit:contain; 
  border-radius:6px;
  transition: all 0.3s ease;
}

.brand h1{ 
  font-size: clamp(14px, 2.8vw, 20px);
  margin:0; 
  white-space:nowrap; 
  overflow:hidden; 
  text-overflow:ellipsis;
  font-weight: 700;
  transition: font-size 0.3s ease;
}

.auth{ 
  display:flex; 
  align-items:center; 
  gap: clamp(6px, 1.2vw, 10px);
  flex: 0 0 auto;
  flex-wrap: nowrap; 
}

.auth .btn{ 
  background:#fff !important; 
  color:#111827 !important; 
  border-color: var(--border);
  padding: clamp(6px, 1vw, 10px) clamp(10px, 2vw, 16px);
  font-size: clamp(12px, 2vw, 15px);
  white-space: nowrap;
}

#whoami{ 
  display:inline-block; 
  max-width: min(45vw, 320px);
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
  font-size: clamp(12px, 2vw, 14px);
}

/* Header modu rozeti: rol yazısı yerine role-bazlı logo gösterilir. */
.user-mode-badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}
.user-mode-badge.hidden{ display: none; }

/* Rol logosu (asıl gösterilen görsel) */
.user-mode-logo{
  display: inline-block;
  height: clamp(34px, 6.5vw, 44px);
  width: auto;
  max-width: 160px;
  object-fit: contain;
  border-radius: 8px;
  vertical-align: middle;
}

/* Metin yedeği: yalnızca logo yüklenemezse görünür (pill görünümü) */
.user-mode-fallback{
  display: none;
  align-items: center;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1;
  font-size: clamp(10px, 1.8vw, 12px);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  letter-spacing: .2px;
  color: #fff;
}
.user-mode-badge.is-opener .user-mode-fallback{
  background: var(--primary);
  border-color: var(--primary);
}
.user-mode-badge.is-solver .user-mode-fallback{
  background: var(--danger);
  border-color: var(--danger);
}

@media (max-width: 768px){
  .wrap{ 
    flex-wrap: nowrap !important;
    padding: 6px 8px;
    gap: 6px;
  }
  
  .brand{
    flex: 1 1 auto;
    min-width: 0;
  }
  
  .brand h1{
    font-size: 14px;
  }
  
  .auth{ 
    flex: 0 0 auto;
    gap: 4px;
  }
  
  .auth .btn{
    font-size: 12px;
    padding: 6px 8px;
  }
  
  #whoami{
    display: none; 
  }
  
  #btn-use-location{
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
  }

  /* DiDe başlığı her zaman görünsün */
  .brand h1{ min-width: 42px; }

  /* Login/Logout butonu YATAY olarak dar ve responsive; içindeki yazı gerekirse
     DİKEY olarak alt satıra sarar (buton yatayda büyümez). Böylece DiDe/logo kapanmaz. */
  #btn-logout, #btn-open-login{
    width: clamp(38px, 11vw, 52px);
    min-width: clamp(38px, 11vw, 52px);
    max-width: clamp(38px, 11vw, 52px);
    min-height: 30px;
    padding: 3px 2px;
    font-size: clamp(9px, 2.3vw, 11px);
    line-height: 1.08;
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

@media (max-width: 576px){
  .wrap{ 
    padding: 6px 8px;
  }
}

/* ==========
   Giriş/Kayıt Kartları - Modal Overlay (Bootstrap)
   ========== */
#login-card,
#register-card,
#forgot-card{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10500;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: clamp(16px, 3vw, 28px);
  width: min(90vw, 480px);
  max-height: 85vh;
  overflow-y: auto;
}

.card-back-btn{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 14px !important;
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text) !important;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  margin-right: 8px;
  vertical-align: middle;
}

.card-back-btn:hover{
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary);
}

.card-back-btn img{
  filter: none !important;
  width: 20px;
  height: 20px;
}

.header-back-btn{
  display: none !important;
}

/* Auth card back button (inside login/register/forgot) */
.auth-back-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 8px !important;
  background: var(--surface, #fff) !important;
  border: 1px solid var(--border, #e5e7eb) !important;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  margin-bottom: 12px;
}
.auth-back-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary) !important;
}
.auth-back-btn img {
  filter: none !important;
  width: 20px;
  height: 20px;
}

:root.theme-dark .card-back-btn img,
:root.theme-dark .header-back-btn img{
  filter: none !important;
  opacity: 1 !important;
}
/* Mobil: Tam ekran modal */
@media (max-width: 576px){
  #login-card,
  #register-card,
  #forgot-card{
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
    padding: clamp(60px, 10vh, 80px) clamp(16px, 4vw, 24px) clamp(20px, 4vh, 32px);
  }
}
/* Dark Mode - Login/Register/Forgot Cards */
:root.theme-dark #login-card,
:root.theme-dark #register-card,
:root.theme-dark #forgot-card{
  background: var(--surface);
  color: var(--text);
}

:root.theme-dark #login-card h2,
:root.theme-dark #register-card h2,
:root.theme-dark #forgot-card h2{
  color: var(--text);
}

:root.theme-dark #login-card label,
:root.theme-dark #register-card label,
:root.theme-dark #forgot-card label{
  color: var(--text);
}

:root.theme-dark #login-card a,
:root.theme-dark #register-card a,
:root.theme-dark #forgot-card a{
  color: var(--primary);
}

:root.theme-dark #login-card .muted,
:root.theme-dark #register-card .muted,
:root.theme-dark #forgot-card .muted{
  color: var(--muted);
}
/* ==========
   Kullanıcı Girişi: Tam Ekran Harita + Olay Formu Modal
   ========== */
body.role-user #map{
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  z-index: 0;
  border-radius: 0;
  border: none;
}

body.role-user{
  overflow: hidden !important;
  height: 100vh;
}

body.role-user #olay-card{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10500;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: clamp(16px, 3vw, 28px);
  width: min(92vw, 520px);
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden; 
}

body.role-user #olay-card.hidden{
  display: none !important;
}

/* Mobil: Form tam ekran */
@media (max-width: 576px){
  body.role-user #olay-card{
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
    padding: clamp(60px, 10vh, 80px) clamp(16px, 4vw, 24px) clamp(20px, 4vh, 32px);
  }
}

/* Konumumu Kullan Butonu - Responsive Konumlandırma */
.map-floating-left{
  position: fixed;
  top: calc(var(--header-h) + clamp(12px, 2vh, 20px));
  left: clamp(12px, 2vw, 20px);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 12px);
}

.map-floating-left .btn{
  font-size: clamp(12px, 2vw, 14px);
  padding: clamp(8px, 1.5vw, 12px) clamp(12px, 2vw, 16px);
  white-space: nowrap;
}

@media (max-width: 768px){
  .map-floating-left{
    top: auto;
    bottom: clamp(16px, 3vh, 24px);
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: clamp(8px, 2vw, 12px);
  }
}
/* Dark Mode - Event Form Card */
:root.theme-dark #olay-card{
  background: var(--surface);
  color: var(--text);
}

:root.theme-dark #olay-card h2{
  color: var(--text);
}

:root.theme-dark #olay-card label{
  color: var(--text);
}

:root.theme-dark #olay-card .muted{
  color: var(--muted);
}
/* ==========
   Butonlar
   ========== */
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: clamp(6px, 1.2vw, 10px) clamp(10px, 2vw, 14px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .06s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  color: var(--text);
  font-size: clamp(13px, 2vw, 15px);
}

.btn:hover{ box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{ outline: var(--focus); outline-offset: 2px; }
.btn.primary{ background: var(--primary); color:#fff; border-color: var(--primary); }
.btn.primary:hover{ background: var(--primary-700); border-color: var(--primary-700); }
.btn.ghost{ background: var(--ghost); border-color: var(--border); }
.btn.danger{ background:#fff; border:1.5px solid var(--danger-soft); color: var(--danger); box-shadow:none; }
.btn[disabled]{ opacity:.6; cursor:not-allowed; box-shadow:none; }
.btn.sm{ padding: 6px 10px; font-size: 12px; border-radius: 8px; line-height: 1; }

#submit-btn.updating {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

#submit-btn.updating:hover {
  background: var(--primary-700) !important;
  border-color: var(--primary-700) !important;
}

/* Icon Butonlar */
.icon-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(36px, 7vw, 44px);
  min-height: clamp(36px, 7vw, 44px);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover{ 
  box-shadow: var(--shadow-md); 
  transform: translateY(-1px);
}

.icon-btn img,
.icon-btn svg{ 
  width: clamp(18px, 4vw, 24px);
  height: clamp(18px, 4vw, 24px);
  display:block;
}

/* Sesle Yazma - Mikrofon Animasyonu */
.icon-btn.mic-blink{
  animation: micBlink 1.2s ease-in-out infinite;
}

@keyframes micBlink{
  0%{ box-shadow: 0 0 0 0 rgba(185,28,28,.6); }
  50%{ box-shadow: 0 0 0 12px rgba(185,28,28,0); }
  100%{ box-shadow: 0 0 0 0 rgba(185,28,28,0); }
}
:root.theme-dark .icon-btn img,
:root.theme-dark .icon-btn svg,
:root.theme-dark .icon-btn svg *,
:root.theme-dark .card-back-btn img,
:root.theme-dark .card-back-btn svg,
:root.theme-dark .card-back-btn svg *,
:root.theme-dark .header-back-btn img,
:root.theme-dark .header-back-btn svg,
:root.theme-dark .header-back-btn svg *,
:root.theme-dark #btn-use-location img,
:root.theme-dark #btn-use-location svg,
:root.theme-dark #btn-use-location svg *,
:root.theme-dark #btn-add-photo img,
:root.theme-dark #btn-add-photo svg,
:root.theme-dark #btn-add-photo svg *,
:root.theme-dark #btn-add-video img,
:root.theme-dark #btn-add-video svg,
:root.theme-dark #btn-add-video svg *,
:root.theme-dark #btn-stt img,
:root.theme-dark #btn-stt svg,
:root.theme-dark #btn-stt svg *,
:root.theme-dark .media-loc-btn img,
:root.theme-dark .media-loc-btn svg,
:root.theme-dark .media-loc-btn svg *,
:root.theme-dark .stt-btn img,
:root.theme-dark .stt-btn svg,
:root.theme-dark .stt-btn svg *,
:root.theme-dark .back-btn img,
:root.theme-dark .back-btn svg,
:root.theme-dark .back-btn svg *,
:root.theme-dark button img,
:root.theme-dark button svg,
:root.theme-dark button svg *{
  filter: none !important;
  opacity: 1 !important;
}

:root.theme-dark .icon-btn svg path,
:root.theme-dark .icon-btn svg,
:root.theme-dark .card-back-btn svg path,
:root.theme-dark .card-back-btn svg,
:root.theme-dark .header-back-btn svg path,
:root.theme-dark .header-back-btn svg,
:root.theme-dark #btn-use-location svg path,
:root.theme-dark #btn-use-location svg,
:root.theme-dark #btn-add-photo svg path,
:root.theme-dark #btn-add-photo svg,
:root.theme-dark #btn-add-video svg path,
:root.theme-dark #btn-add-video svg,
:root.theme-dark #btn-stt svg path,
:root.theme-dark #btn-stt svg,
:root.theme-dark .back-btn svg path,
:root.theme-dark .back-btn svg,
:root.theme-dark button svg path,
:root.theme-dark button svg{
  fill: #111827 !important;
  color: #111827 !important;
}

:root.theme-dark .icon-btn,
:root.theme-dark .card-back-btn,
:root.theme-dark .header-back-btn,
:root.theme-dark #btn-use-location,
:root.theme-dark #btn-add-photo,
:root.theme-dark #btn-add-video,
:root.theme-dark #btn-stt,
:root.theme-dark .back-btn{
  background: #ffffff !important;
  border-color: var(--border) !important;
}
/* ==========
   Layout - Supervisor Admin Modu
   ========== */
body.supervisor-mode-admin{ 
  --bg: var(--surface);
  overflow: auto !important;
  height: auto !important;
}

body.supervisor-mode-admin main{
  display:block;
  margin:0;
  padding:0;
  max-width: 100%;
}

body.supervisor-mode-admin #map{ 
  display:none !important;
}

body.supervisor-mode-admin .stack{
  height:auto;
  max-height:none;
  padding-right:0;
}

body.supervisor-mode-admin #admin-card{
  min-height: calc(100vh - var(--header-h));
  height: auto;
  background: var(--surface);
  overflow: visible;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body.supervisor-mode-admin main{
  margin-top: var(--header-h) !important;
  padding-top: 0 !important;
}

body.supervisor-mode-admin .panel .panel-body,
body.supervisor-mode-admin .panel .table-wrap,
body.supervisor-mode-admin .panel > div[style*="overflow:auto"]{
  overflow: visible !important;
  max-height: none !important;
}

/* ==========
   Supervisor Form Modu
   ========== */
body.supervisor-readonly-map,
body.supervisor-mode-form{
  overflow: hidden !important;
  height: 100vh !important;
}

body.supervisor-readonly-map main,
body.supervisor-mode-form main{
  display: block !important;
  margin: 0;
  padding: 0;
  height: calc(100vh - var(--header-h));
  overflow: hidden !important;
}

body.supervisor-readonly-map #map,
body.supervisor-mode-form #map{
  position: fixed !important;
  top: var(--header-h);
  left: 0;
  width: 100vw !important;
  height: calc(100vh - var(--header-h)) !important;
  min-height: calc(100vh - var(--header-h)) !important;
  z-index: 1;
  border-radius: 0;
  border: none;
}

body.supervisor-readonly-map #admin-card,
body.supervisor-readonly-map #olay-card,
body.supervisor-mode-form #admin-card,
body.supervisor-mode-form #olay-card{
  display: none !important;
}

/* ==========
   Olay Tablosu + Alt Harita (Supervisor/Admin)
   ========== */
.events-map-wrap{
  position: relative;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#events-map{
  height: clamp(280px, 40vh, 560px);
  min-height: 240px;
  width: 100%;
}

/* Responsive: Tablet */
@media (max-width: 992px){
  #events-map{
    height: clamp(240px, 35vh, 480px);
  }
}

/* Responsive: Mobil */
@media (max-width: 576px){
  #events-map{
    height: clamp(220px, 32vh, 420px);
  }
}

/* Events & Regions table: scrollable wrapper */
#events-table-wrap, .events-map-wrap {
  max-height: 60vh;
  overflow-y: auto;
}

/* Regions map */
#regions-map {
  height: clamp(280px, 40vh, 560px);
  min-height: 240px;
  width: 100%;
}
@media (max-width: 992px) {
  #regions-map { height: clamp(240px, 35vh, 480px); }
}
@media (max-width: 576px) {
  #regions-map { height: clamp(220px, 32vh, 420px); }
}

/* Row selection highlight */
.table-row-selected {
  background: var(--primary-light, #dbeafe) !important;
  outline: 2px solid var(--primary, #3b82f6);
  outline-offset: -2px;
}
:root.theme-dark .table-row-selected {
  background: rgba(59,130,246,.25) !important;
}

/* Clickable table rows */
#event-tbody tr,
#region-tbody tr {
  cursor: pointer;
  transition: background .15s;
}
#event-tbody tr:hover,
#region-tbody tr:hover {
  background: var(--hover, #f1f5f9);
}

/* ==========
   Harita
   ========== */
#map{
  height: var(--map-h);
  min-height: 420px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  z-index: 1;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: filter .18s linear, opacity .18s linear;
}

@media (max-width: 1099.98px){
  #map{ 
    height: clamp(360px, 60vh, 640px);
    width: 100%;
  }
}

.map-wrap{
  position: relative;
  width: 100%;
  height: 100%;
}

body.sheet-open #map{
  filter: blur(calc(var(--sheet-progress) * 2.5px)) saturate(calc(1 - .25*var(--sheet-progress)));
  opacity: calc(1 - .1*var(--sheet-progress));
}

.leaflet-control, .leaflet-top, .leaflet-bottom, .leaflet-pane { z-index: 500 !important; }
.leaflet-popup-content{ margin:10px 12px; max-width:320px; max-height:200px; overflow:auto; }
.map-pin{ filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }

.leaflet-top.leaflet-right .leaflet-bar a[title*="GeoJSON"] {
  display: none !important;
}
/* Dark Mode - Leaflet Popups */
:root.theme-dark .leaflet-popup-content-wrapper{
  background: var(--surface);
  color: var(--text);
}

:root.theme-dark .leaflet-popup-content{
  color: var(--text);
}

:root.theme-dark .leaflet-popup-tip{
  background: var(--surface);
}

:root.theme-dark .popup-body{
  color: var(--text);
}

:root.theme-dark .popup-meta{
  color: var(--muted);
}

:root.theme-dark .badge.mine{
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

:root.theme-dark .badge.other{
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}
/* ==========
   Form Elemanları
   ========== */
label{ 
  display:block; 
  margin:10px 0 6px; 
  font-weight:600;
  font-size: clamp(13px, 2vw, 15px);
}

textarea,
select,
input[type="text"],
input[type="email"],
input[type="password"]{
  width: 100%;
  padding: clamp(8px, 1.5vw, 12px);
  font-size: clamp(14px, 2.5vw, 16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #000;
  -webkit-text-fill-color: #000;
  color-scheme: light;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

:root.theme-dark textarea,
:root.theme-dark select,
:root.theme-dark input[type="text"],
:root.theme-dark input[type="email"],
:root.theme-dark input[type="password"]{
  background: var(--surface);
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  border-color: var(--border);
  color-scheme: dark;
}

:root.theme-dark textarea::placeholder,
:root.theme-dark input::placeholder{
  color: var(--muted);
  opacity: 0.7;
}


#event_type,
select#event_type{
  height: auto !important;
  max-height: 120px !important; 
  overflow-y: auto !important;
  display: block !important;
  padding: clamp(6px, 1.2vw, 10px);
}

#event_type::-webkit-scrollbar{ 
  width: 8px; 
}

#event_type::-webkit-scrollbar-thumb{ 
  background:#d1d5db; 
  border-radius:6px; 
  border:1px solid #fff; 
}


@media (max-width: 576px){
  #event_type,
  select#event_type{
    max-height: 100px !important;
  }
  
  #event_type::-webkit-scrollbar{ 
    width: 6px;
  }
}

#aciklama{
  height: var(--desc-h);
  max-height: var(--desc-max-h);
  overflow: auto;
  resize: none;
  scrollbar-width: thin;
}

#aciklama::-webkit-scrollbar{ width: 10px; height: 10px; }
#aciklama::-webkit-scrollbar-thumb{ background:#d1d5db; border-radius:8px; border:2px solid #fff; }

textarea::placeholder, input::placeholder{ color: #6b7280; opacity: .6; }
::-webkit-input-placeholder{ color:#6b7280; opacity:.6; }
:-ms-input-placeholder{ color:#6b7280; opacity:.6; }

textarea:focus,
select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus{
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147,197,253,.35);
  background: #fff;
  -webkit-text-fill-color: #000;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus{
  -webkit-text-fill-color: #000 !important;
  caret-color: #000;
  box-shadow: 0 0 0px 1000px #fff inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.input-wrap{ position: relative; }
.input-wrap input{ padding-right: 40px; }
.eye-btn{
  position:absolute; 
  right:8px; 
  top:50%; 
  transform:translateY(-50%);
  border:none; 
  background:transparent; 
  cursor:pointer; 
  font-size:18px; 
  line-height:1; 
  opacity:.7;
}
.eye-btn:hover{ opacity:1; }

.row{ 
  display:grid; 
  grid-template-columns: 1fr 1fr; 
  gap: clamp(8px, 1.5vw, 12px);
}

@media (max-width: 576px){ 
  .row{ grid-template-columns: 1fr; } 
}

.muted{ 
  color: var(--muted); 
  font-size: clamp(11px, 2vw, 13px);
}

.info{
  font-size: clamp(11px, 2vw, 13px);
  color:#374151; 
  background:#f3f4f6; 
  border:1px solid #e5e7eb;
  padding:6px 8px; 
  border-radius: var(--radius-sm);
}

.pill{ 
  display:inline-block; 
  padding:2px 8px; 
  border-radius:999px; 
  background:#eef2ff; 
  color:#3730a3; 
  font-size:clamp(10px, 1.8vw, 12px);
  font-weight:700;
}

.badge{ 
  display:inline-block; 
  font-size:clamp(10px, 1.8vw, 12px);
  padding:2px 6px; 
  border-radius:6px; 
  background:#eef2ff; 
  color:#1f2937;
}

.badge.mine{ background:#def7ec; color:#10b981; font-weight:700; } 
.badge.other{ background:#e0e7ff; color:#3b82f6; font-weight:700; }
.error{ 
  color:#c0392b; 
  margin:6px 0 10px; 
  font-weight:600;
  font-size: clamp(12px, 2vw, 14px);
}

#olay-card .info{ display:none; }

#btn-use-location, 
#submit-btn{
  display:inline-flex; 
  align-items:center; 
  gap:6px; 
  margin-top:6px;
}

#btn-use-location{ margin-right:6px; }

#olay-card .coord-row{
  display: none !important;
}
#olay-card.editing-mode .coord-row{
  display: flex !important;
}

/* Hide location button from event report form */
#olay-card #btn-use-location,
#olay-card #btn-stop-live,
#olay-card .media-loc-btn,
#media-bar .media-loc-btn {
  display: none !important;
}

/* ==========
   Medya Bar (Foto/Video/Mic İkonları)
   ========== */
#media-bar{
  display: flex;
  gap: clamp(8px, 1.5vw, 12px);
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

#media-bar .icon-btn{
  flex: 0 0 auto;
}


#media-bar #btn-stt {
  display: inline-flex !important;
}

label[for="aciklama"] #btn-stt,
label[for="aciklama"] + #btn-stt,
#aciklama + #btn-stt,
#olay-card #btn-stt,
#olay-card .stt-btn,
.stt-btn {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-top: 0;
  margin-left: 6px;
  vertical-align: middle;
}

/* Ensure the label that contains the STT button displays it inline */
label[for="aciklama"] {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
:root.theme-dark #media-bar .icon-btn img,
:root.theme-dark #media-bar .icon-btn svg,
:root.theme-dark #media-bar button img,
:root.theme-dark #media-bar button svg{
  filter: none !important;
  opacity: 1 !important;
}
/* ==========
   Yönetim Paneli 
   ========== */
.stack{
  display:flex; 
  flex-direction:column; 
  gap:8px;
  height: var(--panel-h);
  max-height: var(--panel-h);
  overflow: hidden;
  padding-right: 0;
}

#olay-card{
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}

#admin-card{ 
  flex: 1 1 auto; 
  min-height: 56%;
  height: 100%;
  max-height: 100%;
  background: var(--surface);
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

#admin-card::-webkit-scrollbar{ width: 12px; height: 12px; }
#admin-card::-webkit-scrollbar-thumb{ background:#d1d5db; border-radius:8px; border:2px solid #fff; }
#admin-card{ scrollbar-width: thin; scrollbar-color:#d1d5db transparent; }

body.supervisor-mode-form #olay-card{ 
  flex:1 1 auto; 
  max-height:100%;
}

body.role-supervisor.supervisor-mode-form #admin-card{ 
  display:none !important;
}

body.supervisor-mode-admin #admin-card{ 
  flex:1 1 auto; 
  min-height:100%;
}

body.supervisor-mode-admin #olay-card{ 
  display:none;
}

/* Allow olay-card to show when editing in supervisor modes */
body.supervisor-mode-form #olay-card.editing-mode,
body.supervisor-mode-admin #olay-card.editing-mode,
body.supervisor-readonly-map #olay-card.editing-mode {
  display: flex !important;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  z-index: 10500 !important;
  background: var(--surface, #fff) !important;
  border-radius: var(--radius, 12px) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3) !important;
  padding: clamp(16px, 3vw, 28px) !important;
  width: min(92vw, 520px) !important;
  max-height: 88vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex-direction: column !important;
}
@media (max-width: 576px) {
  body.supervisor-mode-form #olay-card.editing-mode,
  body.supervisor-mode-admin #olay-card.editing-mode,
  body.supervisor-readonly-map #olay-card.editing-mode {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    padding: clamp(60px, 10vh, 80px) clamp(16px, 4vw, 24px) clamp(20px, 4vh, 32px) !important;
  }
}

.admin-grid{
  display:grid;
  grid-template-columns: 1fr !important;
  gap:14px;
  min-width: 1040px;
}

.panel{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel h4{
  margin:0; 
  padding:10px 12px; 
  font-size: clamp(13px, 2vw, 15px);
  font-weight:700;
  display:flex; 
  align-items:center; 
  justify-content:space-between;
  border-bottom:1px solid var(--border-soft);
}

.panel .panel-body,
.panel .table-wrap,
.panel > div[style*="overflow:auto"]{
  overflow: auto;
  max-height: calc(var(--panel-h) - 56px);
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
}

.panel .panel-body::-webkit-scrollbar,
.panel .table-wrap::-webkit-scrollbar{ 
  width: 12px; 
  height: 12px;
}

.panel .panel-body::-webkit-scrollbar-thumb,
.panel .table-wrap::-webkit-scrollbar-thumb{ 
  background:#d1d5db; 
  border-radius:8px; 
  border:2px solid #fff;
}
/* Dark Mode - Admin Panel */
:root.theme-dark #admin-card{
  background: var(--surface);
  color: var(--text);
}

:root.theme-dark .panel{
  background: var(--surface);
  border-color: var(--border);
}

:root.theme-dark .panel h4{
  color: var(--text);
  border-bottom-color: var(--border);
}

:root.theme-dark #admin-card::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}

:root.theme-dark .panel .panel-body::-webkit-scrollbar-thumb,
:root.theme-dark .panel .table-wrap::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}

/* ==========
   Tablo
   ========== */
table{
  width:100%;
  border-collapse: collapse;
  min-width: 980px;
  background: var(--surface);
}

th, td{
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 6px;
  text-align:left;
  font-size: var(--tbl-font);
  vertical-align: top;
  position: relative;
}

th{ 
  white-space: nowrap; 
  font-weight:700; 
  font-size: var(--tbl-head);
}

body.supervisor-mode-admin table th:nth-child(3),
body.supervisor-mode-admin table td:nth-child(3){ 
  width: 34%;
}

td{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: clip;
}

.td-desc{
  display:block;
  max-height: 240px;
  width: 100%;
  padding-right: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.td-desc::-webkit-scrollbar{ width:10px; }
.td-desc::-webkit-scrollbar-thumb{ 
  background:#d1d5db; 
  border-radius:8px; 
  border:2px solid #fff;
}

#event-tbody td:nth-child(2) .td-desc{
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* ==========
   Tablo Export Butonu
   ========== */
.table-export-btn{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 6px !important;
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  vertical-align: middle;
  margin-left: 8px;
  box-shadow: var(--shadow-sm);
}

.table-export-btn:hover{
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--primary);
}

.table-export-btn img{
  width: 18px;
  height: 18px;
  display: block;
}

@media (max-width: 576px){
  .table-export-btn{
    min-width: 32px !important;
    min-height: 32px !important;
  }
  
  .table-export-btn img{
    width: 16px;
    height: 16px;
  }
}

:root.theme-dark .table-export-btn img{
  filter: none !important;
  opacity: 1 !important;
}
/* ==========
   Filtreleme
   ========== */
.filter-icon{
  cursor: pointer;
  margin-left: 4px;
  opacity: 0.5;
  font-size: 12px;
  display: inline-block;
  width: 16px;
  height: 16px;
  text-align: center;
  user-select: none;
  transition: opacity 0.2s ease;
}

.filter-icon:hover{ opacity: 1; }
.filter-icon.active{ 
  opacity: 1; 
  color: var(--primary); 
  font-weight: 700;
}

.filter-dropdown{
  position:fixed !important;
  background:var(--surface);
  border:1px solid var(--border); 
  border-radius:8px; 
  padding:8px;
  box-shadow:var(--shadow-md);
  z-index:999999 !important; 
  min-width:250px;
  max-width:350px;
  min-height:200px;
  max-height:400px; 
  overflow-y:auto; 
  display:none;
}

.filter-dropdown.show{ 
  display:block !important;
}

.filter-search{
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: clamp(12px, 2vw, 14px);
}

.filter-option{
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  cursor: pointer;
  font-size: clamp(12px, 2vw, 14px);
}

.filter-option input{
  cursor: pointer;
  margin: 0;
}

.filter-option:hover{
  background: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
}

.filter-options-container{
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
  scrollbar-width: thin;
}

.filter-options-container::-webkit-scrollbar{ width:8px; }
.filter-options-container::-webkit-scrollbar-thumb{ 
  background:#d1d5db; 
  border-radius:6px; 
  border:1px solid var(--surface);
}

#users-table .filter-dropdown[data-column="role"] .filter-options-container,
#users-table .filter-dropdown[data-column="verified"] .filter-options-container,
#events-table .filter-dropdown[data-column="photo"] .filter-options-container,
#events-table .filter-dropdown[data-column="video"] .filter-options-container{
  min-height: auto;
  max-height: none;
  overflow-y: visible;
}
/* Dark Mode - Filter Dropdown */
:root.theme-dark .filter-dropdown{
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .filter-search{
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

:root.theme-dark .filter-option{
  color: var(--text);
}

:root.theme-dark .filter-option:hover{
  background: rgba(59, 130, 246, 0.15);
}

:root.theme-dark .filter-options-container::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}
/* ==========
   Tab Navigation
   ========== */
.tab-nav{
  display:flex; 
  gap:4px; 
  margin-bottom:12px; 
  border-bottom:2px solid var(--border);
  flex-wrap: wrap;
}

.tab-btn{
  padding: clamp(6px, 1.2vw, 10px) clamp(12px, 2vw, 18px);
  background:transparent; 
  border:none; 
  cursor:pointer;
  font-weight:600; 
  color:var(--muted); 
  border-bottom:2px solid transparent;
  margin-bottom:-2px; 
  transition: all .2s;
  font-size: clamp(13px, 2vw, 15px);
}

.tab-btn.active{ 
  color:var(--primary); 
  border-bottom-color:var(--primary);
}

.tab-btn:hover{ color:var(--text); }
.tab-content{ display:none; }
.tab-content.active{ display:block; }
/* Dark Mode - Tabs */
:root.theme-dark .tab-nav{
  border-bottom-color: var(--border);
}

:root.theme-dark .tab-btn{
  color: var(--muted);
}

:root.theme-dark .tab-btn.active{
  color: var(--primary);
}

:root.theme-dark .tab-btn:hover{
  color: var(--text);
}
/* ==========
   Pagination
   ========== */
.pagination{
  display:flex; 
  align-items:center; 
  justify-content:space-between;
  padding: clamp(6px, 1.2vw, 10px) clamp(8px, 1.5vw, 14px);
  border-top:1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-info{ 
  font-size: clamp(12px, 2vw, 14px);
  color:var(--muted);
}

.pagination-controls{ 
  display:flex; 
  gap:4px;
  flex-wrap: wrap;
}

.pagination-controls button{
  padding: clamp(4px, 0.8vw, 6px) clamp(6px, 1.2vw, 10px);
  border:1px solid var(--border); 
  background:var(--surface);
  border-radius:6px; 
  cursor:pointer; 
  font-size: clamp(12px, 2vw, 14px);
  transition: all 0.2s ease;
}

.pagination-controls button:hover:not(:disabled){
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-controls button:disabled{ 
  opacity:.5; 
  cursor:not-allowed;
}

.pagination-controls button.active{ 
  background:var(--primary); 
  color:#fff; 
  border-color:var(--primary);
}
/* Dark Mode - Pagination */
:root.theme-dark .pagination{
  border-top-color: var(--border);
}

:root.theme-dark .pagination-info{
  color: var(--muted);
}

:root.theme-dark .pagination-controls button{
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .pagination-controls button:hover:not(:disabled){
  background: var(--primary);
  color: #fff;
}

:root.theme-dark .pagination-controls button.active{
  background: var(--primary);
  color: #fff;
}
@media (max-width: 1200px){
  body.supervisor-mode-admin .panel .panel-body,
  body.supervisor-mode-admin .panel .table-wrap,
  body.supervisor-mode-admin .panel > div[style*="overflow:auto"]{
    overflow-x: auto !important;
    overflow-y: visible !important;
  }
  table{ 
    display:block; 
    overflow-x:auto; 
    -webkit-overflow-scrolling: touch;
  }
  thead, tbody, tr{ 
    display: table; 
    width: 100%; 
    table-layout: fixed;
  }
}

/* ==========
   Thumbnail Grid
   ========== */
.thumb-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(90px, 18vw, 120px), 1fr));
  gap: clamp(6px, 1.2vw, 10px);
  margin-top:6px;
}
/* Dark Mode - Tables */
:root.theme-dark table{
  background: var(--surface);
  color: var(--text);
}

:root.theme-dark th{
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--border);
}

:root.theme-dark td{
  color: var(--text);
  border-bottom-color: var(--border);
}

:root.theme-dark .td-desc{
  color: var(--text);
}

:root.theme-dark .td-desc::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}

/* ==================== FORM İÇİ MEDYA DÜZENİ ==================== */

/* Fotoğraf SOL, Video SAĞ */
#photo-list,
#video-list {
  display: inline-block;
  vertical-align: top;
  width: calc(50% - 8px);
}
#photo-list {
  margin-right: 16px;
}
/* Scroll container */
.media-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
  border-radius: 8px;
}
.media-scroll-container::-webkit-scrollbar {
  width: 6px;
}
.media-scroll-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 6px;
  border: 1px solid #fff;
}
/* Dikey grid (tek sütun) */
.media-grid-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Thumbnail wrapper - Sil butonu için relative (ÖNEMLİ) */
.media-thumb-wrapper {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100px;
  width: 100%;
  transition: all 0.2s ease;
}
.media-thumb-wrapper:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
/* Thumbnail link - block yaparak çarpıyı taşımamasını sağla */
.media-thumb {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}
.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
/* Sil butonu (X) - HER KARENIN sağ üstünde */
.media-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(185, 28, 28, 0.9);
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: none;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: #fff;
}
.media-remove-btn:hover {
  background: rgba(220, 38, 38, 1);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
/* Mobil: Alt alta düzen */
@media (max-width: 576px) {
  #photo-list,
  #video-list {
    width: 100%;
    margin-right: 0;
    margin-bottom: 12px;
  }
  
  .media-scroll-container {
    max-height: 200px !important;
  }
  
  .media-thumb-wrapper {
    height: 90px;
  }
  
  .media-remove-btn {
    width: 22px;
    height: 22px;
    top: 4px;
    right: 4px;
    font-size: 16px;
  }
}

.thumb-tile{
  border:1px solid var(--border);
  background:var(--surface);
  border-radius:10px; 
  padding:4px;
  box-shadow:var(--shadow-sm);
  display:flex; 
  align-items:center; 
  justify-content:center;
  max-height:180px; 
  overflow:hidden;
}

.thumb-tile img, 
.thumb-tile video{
  width:100%; 
  height:100%; 
  object-fit:cover; 
  border-radius:6px; 
  display:block;
}
/* Dark Mode - Media Thumbnails */
:root.theme-dark .media-thumb-wrapper{
  border-color: var(--border);
  background: var(--surface);
}

:root.theme-dark .media-scroll-container::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}

:root.theme-dark .thumb-tile{
  border-color: var(--border);
  background: var(--surface);
}
/* ==========
   Modal
   ========== */
.modal{ 
  position:fixed; 
  inset:0; 
  background:rgba(0,0,0,.5); 
  display:none; 
  align-items:center; 
  justify-content:center; 
  z-index:11000; 
  overflow-y: auto; 
}

.modal.show{ 
  display:flex;
}

.modal .box{ 
  background:var(--surface); 
  border:1px solid var(--border); 
  border-radius:12px; 
  width:min(560px, 92vw); 
  max-height: 90vh; 
  overflow-y: auto; 
  padding: clamp(10px, 2vw, 16px);
  box-shadow:var(--shadow-md);
  margin: auto; 
}

.modal .head{ 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  margin-bottom:8px;
}

.modal video, 
.modal canvas{ 
  width:100%; 
  max-height: 70vh; 
  border-radius:10px; 
  background:#000;
  object-fit: contain; 
}

.row.gap6{ 
  display:flex; 
  gap:6px; 
  flex-wrap:wrap; 
  align-items:center;
}
body.modal-open{
  overflow: hidden !important;
}
/* Dark Mode - Modals */
:root.theme-dark .modal .box{
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .modal .box h3,
:root.theme-dark .modal .box h4{
  color: var(--text);
}
/* ==========
   Toast
   ========== */
#toast-root{
  position: fixed; 
  top: calc(var(--header-h) + 12px);
  right: clamp(10px, 2vw, 16px);
  display: flex; 
  flex-direction: column; 
  gap: 8px;
  z-index: 100000; 
  pointer-events: none;
}

.toast{
  pointer-events:auto; 
  background: #111827; 
  color: #fff;
  border-radius: 10px; 
  padding: clamp(8px, 1.5vw, 12px);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,.12);
  display:flex; 
  align-items:center; 
  gap:8px;
  font-size: clamp(12px, 2vw, 14px);
}

.toast.success{ background:#065f46; }
.toast.error{ background:#7f1d1d; }
.toast.info{ background:#2563eb; }

/* ==========
   Yardımcılar
   ========== */
.hidden{ display:none !important; }

a{ 
  color: var(--primary-600); 
  text-decoration: none;
}

a:hover{ text-decoration: underline; }
a:focus-visible{ 
  outline: var(--focus); 
  border-radius: 4px;
}

.card{
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: clamp(12px, 2.5vw, 18px);
  box-shadow: var(--shadow-sm);
}

.card h3{ 
  margin: 0 0 10px; 
  font-size: clamp(14px, 2.5vw, 18px);
}

.sep{ 
  height:1px; 
  background: var(--border-soft); 
  margin:10px 0;
}
/* Dark Mode - Cards & Info */
:root.theme-dark .card{
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .card h3{
  color: var(--text);
}

:root.theme-dark .info{
  background: rgba(51, 65, 85, 0.4);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .sep{
  background: var(--border);
}
/* ==========
   Map Legend - Responsive
   ========== */
.map-wrap{ position: relative; }
.map-wrap .map-legend:not(:last-of-type){ 
  display:none !important;
}

.map-legend{
  position: absolute;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  left: auto;
  z-index: 600;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: clamp(8px, 1.5vw, 12px);
  font-size: var(--legend-font);
  line-height: 1.3;
  max-width: var(--legend-w);
  width: auto;
  max-height: var(--legend-maxh);
  overflow: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  backdrop-filter: saturate(160%) blur(4px);
}

.map-legend .legend-title{
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}

.map-legend .legend-item{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.map-legend .legend-item:last-child{
  margin-bottom: 0;
}

.map-legend .legend-item svg{
  flex-shrink: 0;
  width: 20px;
  height: 28px;
  display: block;
}

.map-legend .legend-item span{
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.map-legend::-webkit-scrollbar{ 
  width: 10px; 
  height: 10px;
}

.map-legend::-webkit-scrollbar-thumb{ 
  background: #d1d5db; 
  border-radius: 8px; 
  border: 2px solid #fff;
}

.map-legend{ scrollbar-width: thin; }

@media (max-width: 992px){
  .map-legend{
    padding: 6px 8px;
    max-width: clamp(160px, 42%, 280px);
  }
  
  .map-legend .legend-title{
    font-size: 0.85rem;
    margin-bottom: 6px;
  }
  
  .map-legend .legend-item{
    gap: 6px;
    margin-bottom: 5px;
  }
  
  .map-legend .legend-item svg{
    width: 18px;
    height: 24px;
  }
  
  .map-legend .legend-item span{
    font-size: 0.72rem;
  }
}

@media (max-width: 576px){
  :root{
    --legend-font: clamp(9px, 2.8vw, 11px);
    --legend-w: clamp(150px, 65vw, 260px);
    --legend-maxh: clamp(110px, 34vh, 38vh);
  }
  
  .map-legend{
    padding: 6px 8px;
    right: 6px; 
    bottom: 6px;
  }
  
  .map-legend .legend-title{
    font-size: 0.8rem;
    margin-bottom: 5px;
  }
  
  .map-legend .legend-item{
    gap: 6px;
    margin-bottom: 4px;
  }
  
  .map-legend .legend-item svg{
    width: 16px;
    height: 22px;
  }
  
  .map-legend .legend-item span{
    font-size: 0.68rem;
  }
}

@media (min-width: 1100px){
  :root{ --legend-w: clamp(200px, 28%, 320px); }
}

.leaflet-control .info{ display:none !important; }

/* Dark Mode - Map Legend */
:root.theme-dark .map-legend{
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--border);
  color: var(--text);
}

:root.theme-dark .map-legend .legend-title{
  color: var(--text);
}

:root.theme-dark .map-legend .legend-item span{
  color: var(--text);
}

:root.theme-dark .map-legend::-webkit-scrollbar-thumb{
  background: #475569;
  border-color: var(--surface);
}
/* ==========
   Cluster İkonları 
   ========== */
.custom-cluster-wrap { background: transparent; }

.custom-cluster {
  width: 40px; 
  height: 40px; 
  border-radius: 999px;
  background: #e5e7eb;
  border: 2px solid #9ca3af;
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-weight: 700; 
  color: #111827;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.custom-cluster.medium { 
  width: 46px; 
  height: 46px;
}

.custom-cluster.large  { 
  width: 54px; 
  height: 54px;
}

.custom-cluster > span { 
  line-height: 1; 
  font-size: clamp(12px, 2.2vw, 15px);
}



/* ==========
   Print Mode
   ========== */
@media print{
  header, .auth, .stack, .btn, .eye-btn{ 
    display:none !important;
  }
  #map{ height: 400px; }
  .card{ border: none; box-shadow: none; }
}

/* ==========
   Mobile Sheet 
   ========== */
@media (max-width: 1100px){
  .sheet{
    position: fixed; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: var(--surface);
    border-top-left-radius: 16px; 
    border-top-right-radius: 16px;
    box-shadow: 0 -8px 28px rgba(0,0,0,.12);
    max-height: 75vh; 
    transform: translateY(55%);
    transition: transform .22s ease; 
    z-index: 5000;
  }
  
  .sheet.open{ transform: translateY(0%); }
  
  .sheet .handle{ 
    width: 44px; 
    height: 5px; 
    border-radius: 999px; 
    background: #d1d5db; 
    margin: 8px auto;
  }
  
  .sheet .stack{
    max-height: calc(75vh - 32px);
    padding: 0 8px 10px; 
    overflow: auto; 
    overscroll-behavior: contain; 
    -webkit-overflow-scrolling: touch;
  }
}
/* ==========
   Yeni Olay Türü Ekleme - Yönetim Paneli
   ========== */
#types-tab .inline,
#types-tab th:has(#new-type-name),
#types-tab th:has(#btn-add-type) {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

#new-type-name{
  display: inline-block !important;
  width: auto !important;
  min-width: 200px;
  max-width: 320px;
  vertical-align: middle;
  margin: 0 !important;
}

#btn-add-type{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 6px 12px !important;
  font-size: 13px !important;
  line-height: 1 !important;
  background: #fff !important;
  border: 1.5px solid var(--danger-soft) !important;
  color: var(--danger) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  white-space: nowrap;
  margin: 0 !important;
  vertical-align: middle;
}

#btn-add-type:hover{
  background: var(--danger-soft) !important;
  color: #fff !important;
}

th:has(#new-type-name){ 
  padding-right: 0 !important;
  white-space: nowrap;
}

th:has(#btn-add-type){ 
  padding-left: 0 !important;
  width: 1%;
  white-space: nowrap;
}


.popup-body{ 
  white-space: pre-wrap; 
  word-break: break-word; 
  line-height: 1.35;
}

.popup-meta{ 
  color: var(--muted); 
  font-size: clamp(11px, 2vw, 13px);
  margin-top: 4px;
}

.popup-photos,
.popup-videos{
  margin-top: 4px;
  margin-bottom: 6px;
}

.popup-photos .grid,
.popup-videos .grid{
  gap: 6px;
}

.popup-photo-link,
.popup-video-link{
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.popup-photo-link:hover,
.popup-video-link:hover{
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.popup-photo-link img,
.popup-video-link video{
  display: block;
  width: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.leaflet-popup-content .popup-body{
  max-width: 60vw;
  word-break: break-word;
}

.grid.grid-3 .thumb-tile img{ 
  display:block; 
  width:100%; 
  height:110px; 
  object-fit:cover; 
  border-radius:8px;
}

.grid.grid-2 .thumb-tile video{ 
  display:block; 
  width:100%; 
  height:140px; 
  object-fit:cover; 
  border-radius:8px;
}


.filter-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.filter-option.disabled input[type="checkbox"] {
  cursor: not-allowed;
}

.filter-option.disabled span {
  color: var(--muted);
}

/* ===================== VG1: Polygon Confirm Card ===================== */
.polygon-flow-card {
  position: fixed !important;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  margin: 0 !important;
  border-radius: 16px 16px 0 0 !important;
  padding: 20px 16px !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
}
.polygon-flow-content {
  text-align: center;
}

/* ===================== VG2: Fullscreen Records Swiper ===================== */
.polygon-records-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: var(--bg, #fff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#polygon-records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border, #e5e5e5);
}
#polygon-records-page-indicator {
  color: var(--muted, #888);
  font-weight: 400;
}
/* Instagram-style floating counter (top-right, fade in/out) */
.pr-float-counter {
  position: fixed;
  top: 56px;
  right: 20px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 14px;
  z-index: 1350;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s ease;
  letter-spacing: 0.5px;
}
.pr-float-counter.visible {
  opacity: 1;
}
/* Instagram-style bottom dots for record pages */
.pr-records-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 8px 0;
  flex-shrink: 0;
}
.pr-records-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #ccc);
  transition: background .2s, transform .2s;
}
.pr-records-dots span.active {
  background: var(--primary, #3b82f6);
  transform: scale(1.3);
}
/* Instagram-style media floating counter within record */
.pr-media-float-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.pr-media-float-counter.visible {
  opacity: 1;
}
#polygon-records-swiper {
  flex: 1;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}
.pr-swiper-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.polygon-record-page {
  min-width: 100%;
  max-width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
  box-sizing: border-box;
}

/* Media section: split 50/50 */
.pr-media-section {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 45vh;
  max-height: 50vh;
  overflow: hidden;
}
.pr-media-half {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
}
.pr-media-half.single {
  flex: none;
  width: 100%;
}
.pr-media-half img,
.pr-media-half video {
  min-width: 100%;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.pr-media-half video {
  object-fit: contain;
  background: #000;
}

/* Info section */
.pr-info-section {
  padding: 14px 16px;
  flex: 1;
}
.pr-info-type {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.pr-info-date {
  font-size: 0.82rem;
  color: var(--muted, #888);
  margin-bottom: 8px;
}
.pr-info-desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text, #333);
}
.pr-no-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30vh;
  background: var(--border, #eee);
  color: var(--muted, #888);
  font-size: 0.95rem;
}
.pr-media-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 6px 0;
  background: rgba(0,0,0,.03);
}
.pr-media-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted, #ccc);
}
.pr-media-dots span.active {
  background: var(--primary, #3b82f6);
}

/* Action buttons */
#polygon-records-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 16px 20px;
  border-top: 1px solid var(--border, #e5e5e5);
}
.pr-add-label {
  font-size: clamp(0.85rem, 3.5vw, 1rem);
  font-weight: 600;
  color: var(--text, #333);
  text-align: center;
  margin-bottom: 12px;
}
.pr-action-buttons {
  display: flex;
  justify-content: center;
  gap: 32px;
}
.polygon-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
  background: transparent;
}
.polygon-action-btn:active { transform: scale(.9); }
.polygon-action-tick {
  color: #22c55e;
  border-color: #22c55e;
}
.polygon-action-cross {
  color: #ef4444;
  border-color: #ef4444;
}

/* ===================== Layer Drawer — Responsive ===================== */
.layer-drawer {
  position: absolute;
  left: 10px;
  top: 120px;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  gap: 0;
  font-family: Arial, sans-serif;
  max-width: calc(100vw - 24px);
}
.layer-notch {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--text, #333);
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  transition: background .2s;
}
.layer-notch:hover { background: var(--border, #f1f5f9); }
.layer-panel {
  width: clamp(200px, 55vw, 320px);
  max-height: min(55vh, 400px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: var(--surface, #ffffff);
  color: var(--text, #333);
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  font-size: clamp(12px, 3.2vw, 14px);
  scrollbar-width: thin;
}
.layer-panel::-webkit-scrollbar { width: 4px; }
.layer-panel::-webkit-scrollbar-thumb { background: var(--muted, #aaa); border-radius: 4px; }
.layer-panel.hidden { display: none; }
.layer-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: -10px;
  background: var(--surface, #ffffff);
  padding: 4px 0 6px;
  z-index: 2;
}
.layer-panel-subtitle {
  opacity: .6;
  font-size: clamp(10px, 2.8vw, 12px);
}
.layer-panel-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Small phones */
@media (max-width: 400px) {
  .layer-drawer { left: 4px; top: 90px; }
  .layer-notch { width: 34px; height: 34px; font-size: 0.95rem; }
  .layer-panel { width: 75vw; max-height: 45vh; padding: 8px; font-size: 12px; }
}
/* Normal phones */
@media (min-width: 401px) and (max-width: 576px) {
  .layer-drawer { left: 6px; top: 100px; }
  .layer-notch { width: 36px; height: 36px; font-size: 1rem; }
  .layer-panel { width: 68vw; max-height: 50vh; padding: 8px; }
}
/* Tablets */
@media (min-width: 577px) and (max-width: 768px) {
  .layer-panel { width: clamp(220px, 45vw, 300px); max-height: 55vh; }
}
/* Desktop */
@media (min-width: 769px) {
  .layer-panel { width: 300px; max-height: 55vh; font-size: 14px; }
  .layer-panel-subtitle { font-size: 12px; }
}

/* Dark mode */
:root.theme-dark .layer-notch {
  background: var(--surface, #1e293b);
  border-color: var(--border, #334155);
  color: var(--text, #f1f5f9);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
:root.theme-dark .layer-notch:hover { background: var(--border, #334155); }
:root.theme-dark .layer-panel {
  background: var(--surface, #1e293b);
  border-color: var(--border, #334155);
  color: var(--text, #f1f5f9);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
:root.theme-dark .layer-panel-header {
  background: var(--surface, #1e293b);
}
/* ===================== Leaflet Dark Theme ===================== */
.theme-dark .leaflet-tile-pane img {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
.theme-dark .leaflet-control-zoom-in,
.theme-dark .leaflet-control-zoom-out,
.theme-dark .leaflet-control-attribution {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
.theme-dark .leaflet-container {
  background-color: #1a1a2e;
}
/* ===================== GeoJSON Import Wizard ===================== */
#import-wizard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#import-wizard-overlay.hidden {
  display: none !important;
}
.import-wizard-modal {
  background: var(--bg, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.import-wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.import-wizard-header h3 {
  margin: 0;
  font-size: clamp(15px, 2.5vw, 18px);
}
.import-wizard-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 0 4px;
}
.import-wizard-body {
  padding: 16px 20px;
  flex: 1;
}
.import-wizard-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.import-epsg-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 8px;
}
:root.theme-dark .import-epsg-warning {
  background: #422006;
  color: #fde68a;
  border-color: #a16207;
}
.active-choice {
  background: var(--accent, #3b82f6) !important;
  color: #fff !important;
  border-color: var(--accent, #3b82f6) !important;
}
@media (max-width: 576px) {
  .import-wizard-modal {
    max-width: 100%;
    border-radius: 8px;
  }
  .import-wizard-header, .import-wizard-body, .import-wizard-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Import button styling */
#btn-geojson-import {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
#btn-geojson-import:hover {
  background: var(--surface, #f1f5f9);
}
/* ===================== Grid Warning Banner ===================== */
.grid-warning-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  font-size: clamp(13px, 2.5vw, 15px);
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(220,38,38,0.4);
  animation: gridBannerSlide 0.35s ease-out;
  text-align: center;
  line-height: 1.4;
}
.grid-warning-banner .banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.grid-warning-banner .banner-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.grid-warning-banner .banner-close:hover {
  background: rgba(255,255,255,0.35);
}
@keyframes gridBannerSlide {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (max-width: 576px) {
  .grid-warning-banner {
    padding: 12px 14px;
    gap: 8px;
  }
}
/* ==================== Time-dependent event type flow ==================== */
.td-x-btn{
  font-size:20px;
  line-height:1;
  padding:2px 10px;
  border-radius:8px;
}
.td-next-btn{
  font-size:20px;
  line-height:1;
  min-width:52px;
  padding:6px 14px;
}
.td-choice-tile{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:150px;
  min-height:110px;
  padding:14px 10px;
  border:2px solid var(--border);
  border-radius:12px;
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
  transition:border-color .15s, box-shadow .15s, transform .05s;
}
.td-choice-tile:hover{ border-color:var(--primary); }
.td-choice-tile:active{ transform:scale(.98); }
.td-choice-tile.selected{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(37,99,235,.20);
}
.td-choice-mark{
  font-size:34px;
  line-height:1;
  font-weight:700;
}
.td-choice-mark.td-yes{ color:#16a34a; }
.td-choice-mark.td-no{ color:var(--danger); }
.td-choice-label{
  font-size:14px;
  font-weight:600;
}
.td-duration-field{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.td-duration-field label{
  font-weight:500;
  min-width:90px;
}
.td-duration-field input{
  flex:1;
  max-width:180px;
}
/* Time-dependent option inside the user event-type <select> */
#event_type option.td-option{
  color:#b45309;
  font-weight:600;
}
/* ==========================================================
   Solver (olay kapatan) — kullanıcı tablosu hücresi
   ========================================================== */
.solver-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
}
.solver-toggle input[type="checkbox"]{
  width:18px;
  height:18px;
  min-width:18px;
  cursor:pointer;
  accent-color: var(--danger);
  margin:0;
}
.solver-toggle input[type="checkbox"]:disabled{
  cursor:not-allowed;
  opacity:.6;
}
.solver-toggle-text{
  font-size: clamp(12px, 1.8vw, 13px);
  color: var(--muted, #6b7280);
  min-width: 30px;
}
.solver-toggle input[type="checkbox"]:checked ~ .solver-toggle-text{
  color: var(--danger);
  font-weight:700;
}
.solver-na{
  color: var(--muted, #9ca3af);
  display:inline-block;
  text-align:center;
  width:100%;
}
/* Popup içindeki Kapat butonu (solver) */
.solver-close-btn{
  font-weight:600;
}

/* Mobil uyum: dar ekranlarda hücreyi ve rozeti sıkıştır */
@media (max-width: 576px){
  .solver-toggle{ gap:6px; }
  .solver-toggle-text{ min-width: 26px; }
  #users-table td[data-cell="solver"]{
    white-space: nowrap;
  }
  .user-mode-logo{
    height: 34px;
    max-width: 120px;
  }
  .user-mode-fallback{
    padding: 3px 6px;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* =====================================================================
   BEĞENİ (LIKE) KONTROLÜ — pop-up içinde
   ===================================================================== */
.like-control{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--border, #e5e7eb);
  flex-wrap:wrap;
}
.like-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:38px;
  min-height:38px;
  padding:6px 10px;
  border:1.5px solid var(--danger-soft, #fca5a5);
  border-radius:999px;
  background:#fff;
  color:var(--danger, #b91c1c);
  cursor:pointer;
  font-size:20px;
  line-height:1;
  transition:transform .08s ease, background .15s ease;
}
.like-btn:hover{ background:#fff1f2; }
.like-btn:active{ transform:scale(.92); }
.like-btn.liked{ background:var(--danger, #b91c1c); color:#fff; border-color:var(--danger, #b91c1c); }
.like-btn:disabled{ opacity:.6; cursor:not-allowed; }
.like-heart{ pointer-events:none; }
.like-count{ font-weight:700; font-size:15px; min-width:16px; text-align:center; }
.like-label{ color:var(--muted, #6b7280); font-size:13px; }
/* Kendi gönderisi: yalnızca beğeni sayısı (kalp yok) */
.like-control.readonly .like-count{ color:var(--danger, #b91c1c); font-size:16px; }

/* =====================================================================
   PROFİL OVERLAY (tam ekran, mobil uyumlu)
   ===================================================================== */
.profile-overlay{
  position:fixed;
  inset:0;
  z-index:11000;
  background:var(--bg, #f8fafc);
  display:flex;
  flex-direction:column;
}
.profile-overlay.hidden{ display:none; }
.profile-overlay-inner{
  position:relative;
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.profile-close{
  position:absolute;
  top:12px;
  right:12px;
  z-index:12;
  width:42px;
  height:42px;
  border-radius:50%;
  border:1.5px solid var(--border, #e5e7eb);
  background:#fff;
  color:var(--text, #111);
  font-size:20px;
  line-height:1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 2px 8px rgba(0,0,0,.12);
}
/* Profil overlay dil butonları — açılan ekranın SOL ÜST köşesinde */
.profile-lang{
  position:absolute;
  top:12px;
  left:12px;
  right:auto;
  z-index:12;
  display:flex;
  gap:6px;
}
.profile-lang button{
  min-width:38px;
  height:34px;
  padding:0 10px;
  border:1.5px solid var(--border, #e5e7eb);
  border-radius:9px;
  background:#fff;
  color:var(--text, #111);
  font-weight:700;
  font-size:13px;
  cursor:pointer;
}
.profile-lang button:hover{ background:#f1f5f9; }
.profile-lang button.active{
  background:var(--primary, #2563eb);
  color:#fff;
  border-color:var(--primary, #2563eb);
}

/* Kaydırmalı sayfa alanı */
.profile-pager{
  flex:1 1 auto;
  display:flex;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.profile-pager::-webkit-scrollbar{ display:none; }
.profile-slide{
  flex:0 0 100%;
  width:100%;
  height:100%;
  scroll-snap-align:start;
  overflow-y:auto;
  padding:20px 16px 44px;
  box-sizing:border-box;
}

/* Sayfa 1: Profil kartı */
.profile-card{
  max-width:520px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:22px;
  padding-top:8px;
}
.profile-head{
  display:flex;
  align-items:center;
  gap:18px;
  width:100%;
  justify-content:center;
}
.profile-avatar{
  width:clamp(96px, 26vw, 140px);
  height:clamp(96px, 26vw, 140px);
  border-radius:20px;
  object-fit:cover;
  box-shadow:0 4px 16px rgba(0,0,0,.15);
  border:2px solid var(--border, #e5e7eb);
  background:#fff;
}
.profile-head-info{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.profile-username{
  font-size:clamp(20px, 5vw, 28px);
  font-weight:800;
  color:var(--text, #111);
  word-break:break-word;
}
.profile-role{
  display:none;
}
.profile-role.is-opener{ background:var(--primary, #2563eb); }
.profile-role.is-solver{ background:var(--danger, #b91c1c); }

.profile-score{
  display:flex;
  align-items:baseline;
  gap:10px;
  background:#fff;
  border:1.5px solid var(--border, #e5e7eb);
  border-radius:16px;
  padding:14px 24px;
  box-shadow:0 2px 10px rgba(0,0,0,.06);
}
.profile-score-label{ font-size:clamp(14px, 4vw, 17px); color:var(--muted, #6b7280); font-weight:600; }
.profile-score-value{ font-size:clamp(28px, 8vw, 42px); font-weight:900; color:var(--primary, #2563eb); }

.profile-map-open-big{
  width:clamp(120px, 40vw, 180px);
  height:clamp(120px, 40vw, 180px);
  border-radius:24px;
  border:2px solid var(--primary, #2563eb);
  background:#fff;
  color:var(--primary, #2563eb);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 4px 16px rgba(37,99,235,.18);
  transition:transform .1s ease, background .15s ease;
}
.profile-map-open-big:hover{ background:#eff6ff; }
.profile-map-open-big:active{ transform:scale(.96); }
.profile-map-open-big-img{ width:56%; height:56%; }

/* Sayfa 2: Gönderiler / Silinenler */
.profile-posts-head{
  max-width:100%;
  margin:0 auto 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.profile-posts-title{
  margin:0;
  font-size:clamp(20px, 5vw, 26px);
  font-weight:800;
  color:var(--text, #111);
}
.profile-map-open-list{
  width:46px;
  height:46px;
  border-radius:12px;
  border:1.5px solid var(--primary, #2563eb);
  background:#fff;
  color:var(--primary, #2563eb);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.profile-map-open-list:hover{ background:#eff6ff; }
.profile-map-open-list-img{ width:24px; height:24px; }

.profile-table-wrap{
  max-width:100%;
  width:100%;
  margin:0;
  overflow:hidden;   /* fixed-layout tablo tam sığar → yatay kaydırma yok */
  border:1px solid var(--border, #e5e7eb);
  border-radius:12px;
  background:#fff;
}
.profile-posts-table{
  width:100%;
  min-width:0 !important;   /* global table{min-width:980px} kuralını profil tablosu için ez */
  border-collapse:collapse;
  table-layout:fixed;       /* sütunlar sabit yüzdelere göre → tablo her zaman ekrana sığar */
}
/* Responsive sütun genişlikleri (toplam %100): Tip / Oluşturma / Kapatma / Beğeni.
   İki tarih sütununa, "03.09.2026 15:13" TEK SATIRA sığsın diye daha çok pay verildi. */
.profile-posts-table th:nth-child(1), .profile-posts-table td:nth-child(1){ width:16%; }
.profile-posts-table th:nth-child(2), .profile-posts-table td:nth-child(2){ width:34%; }
.profile-posts-table th:nth-child(3), .profile-posts-table td:nth-child(3){ width:34%; }
.profile-posts-table th:nth-child(4), .profile-posts-table td:nth-child(4){ width:16%; }
/* Likes sütunu (4.) — sağa hizalı; genişlik artırıldığı için tipik değerler tek satıra sığar */
.profile-posts-table th:nth-child(4){ text-align:right; }
.profile-posts-table td:nth-child(4){ text-align:right; }
.profile-posts-table thead th{
  text-align:left;
  padding:12px 10px;
  background:var(--bg-soft, #f1f5f9);
  color:var(--muted, #475569);
  font-weight:700;
  font-size:14px;          /* okunabilir; küçültülmez */
  white-space:normal;      /* global th{nowrap} ez → başlıklar sarabilir */
  word-break:break-word;
  overflow-wrap:anywhere;
  border-bottom:1px solid var(--border, #e5e7eb);
}
.profile-posts-table tbody td{
  padding:11px 10px;
  border-bottom:1px solid var(--border, #eef2f7);
  font-size:14px;          /* okunabilir; küçültülmez */
  white-space:normal;      /* uzun metin alt satıra sarar → yatay kaydırma gerekmez */
  word-break:break-word;
  overflow-wrap:anywhere;
  vertical-align:top;
}
/* Genel/mobil "table{display:block;overflow-x:auto}" hilesinden profil tablosunu MUAF tut:
   normal tablo modelini zorla → tablo tam ekrana sığar, yatay kaydırma olmaz. */
.profile-posts-table{ display:table !important; overflow:visible !important; }
.profile-posts-table thead{ display:table-header-group !important; }
.profile-posts-table tbody{ display:table-row-group !important; }
.profile-posts-table tr{ display:table-row !important; }
.profile-posts-table th,
.profile-posts-table td{ display:table-cell !important; }
/* İki tarih sütunu (2. ve 3.) tek satırda tam görünsün: alt satıra inmesin.
   Genişlikleri artırıldığı için taşma olmadan tek satıra sığar. */
.profile-posts-table td:nth-child(2),
.profile-posts-table td:nth-child(3){
  white-space:nowrap;
  word-break:normal;
  overflow-wrap:normal;
  padding-left:4px;
  padding-right:4px;
}
.profile-post-row{ cursor:pointer; transition:background .12s ease; }
.profile-post-row:hover{ background:#f8fafc; }
.profile-post-row.pf-row-highlight{
  background:rgba(239,68,68,.18) !important;
  animation:pfHighlightPulse 0.5s ease;
}
@keyframes pfHighlightPulse{
  0%{ background:rgba(239,68,68,.42); }
  100%{ background:rgba(239,68,68,.18); }
}

/* Sayfalama */
.profile-pagination{
  max-width:100%;
  margin:16px auto 0;
  display:flex;
  gap:6px;
  justify-content:center;
  flex-wrap:wrap;
}
.pf-page-btn{
  min-width:38px;
  height:38px;
  padding:0 10px;
  border:1.5px solid var(--border, #e5e7eb);
  border-radius:9px;
  background:#fff;
  color:var(--text, #111);
  cursor:pointer;
  font-weight:600;
}
.pf-page-btn.active{ background:var(--primary, #2563eb); color:#fff; border-color:var(--primary, #2563eb); }
.pf-page-btn:disabled{ opacity:.45; cursor:not-allowed; }

/* Sayfa noktaları */
.profile-dots{
  position:absolute;
  bottom:14px;
  left:0; right:0;
  display:flex;
  gap:10px;
  justify-content:center;
  z-index:11;
  pointer-events:auto;
}
.profile-dot{
  width:11px; height:11px;
  border-radius:50%;
  border:none;
  background:var(--border, #cbd5e1);
  cursor:pointer;
  padding:0;
}
.profile-dot.is-active{ background:var(--primary, #2563eb); transform:scale(1.15); }

/* Harita görünümü */
.profile-map-view{
  position:absolute;
  inset:0;
  z-index:20;
  background:#fff;
  display:flex;
  flex-direction:column;
}
.profile-map-view.hidden{ display:none; }
.profile-map-back{
  position:absolute;
  top:12px;
  left:12px;
  z-index:1000;
  width:44px;
  height:44px;
  padding:0;
  border-radius:50%;
  border:1.5px solid var(--border, #e5e7eb);
  background:#fff;
  color:var(--text, #111);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 2px 8px rgba(0,0,0,.15);
}
.profile-map-back:hover{ background:#f1f5f9; }
.profile-map-back img{ width:22px; height:22px; display:block; }
.profile-map{ flex:1 1 auto; width:100%; height:100%; }

/* Profil harita pop-up içeriği */
.pf-popup{ min-width:180px; }
.pf-pop-type{ font-weight:800; font-size:15px; margin-bottom:4px; }
.pf-pop-desc{ color:var(--muted, #6b7280); font-size:13px; margin-bottom:6px; word-break:break-word; }
.pf-pop-likes{ font-size:14px; margin-bottom:8px; }
.pf-pop-actions{ display:flex; justify-content:flex-start; }
.pf-pop-table{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:40px;
  height:40px;
  padding:0;
  border:1.5px solid var(--primary, #2563eb);
  border-radius:10px;
  background:#fff;
  color:var(--primary, #2563eb);
  cursor:pointer;
}
.pf-pop-table:hover{ background:#eff6ff; }
.pf-pop-table img{ width:22px; height:22px; display:block; }

/* Mobil ince ayarlar */
@media (max-width: 576px){
  .profile-slide{ padding:16px 6px 44px; }
  .profile-head{ flex-direction:column; text-align:center; gap:12px; }
  .profile-head-info{ align-items:center; }
  .profile-role{ align-self:center; }
  .profile-close{ width:38px; height:38px; top:8px; right:8px; }
  .profile-lang{ top:10px; left:10px; right:auto; gap:4px; }
  .profile-lang button{ min-width:34px; height:32px; padding:0 7px; font-size:12px; }

  
  .profile-posts-table thead th{ padding:10px 6px; }
  .profile-posts-table tbody td{ padding:10px 6px; }
}