:root {
  /* RENK PALETİ */
  --bg: #0f172a;
  --fg: #E3B968;
  --muted: #9ca3af;
  --accent: #111;     /* ana vurgu: siyah */
  --accent2: #FF9900;    /* ikinci vurgu: turuncu */
  --accent3: #fcd34d;    /* açık amber */
  --danger: #ef4444;
  --card: #1A1006;
  --border: #2a3146;
  --white: #FFF;
  --yellow: #FFFF00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

/* ========== HEADER ========== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #FF9900;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%; /* scrollbar genişliği taşmasını önlemek için 100% */
  box-sizing: border-box;
  z-index: 1500;
}

.app-header .logo {
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--accent);
  font-size: 22px;
  text-decoration: none;
}

/* Mobil menü toggle */
.menu-toggle {
  display: none;
  background: transparent;
  color: var(--bg);
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  margin-left: 12px;
}

.app-header nav a {
  color: var(--bg);
  margin-left: 14px;
  text-decoration: none;
  opacity: .85;
  transition: opacity .2s, color .2s;
}

.app-header nav a:hover {
  opacity: 1;
  color: var(--white);
}

/* ========== ANA GÖVDE VE FOOTER ========== */
.app-main { padding: 24px; }

/* Sayfa içerik genişliğini kontrol et (My Trips vb.) */
.app-main .container { max-width: 960px; margin: 0 auto; }
.app-main .container.trips { max-width: 100%; }

.app-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  opacity: .75;
  font-size: 14px;
}

/* ========== BUTONLAR ========== */
.btn {
  background: var(--accent2);
  color: #1a1000;
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .15s, filter .2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover { filter: brightness(1.50); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

.btn.secondary { background: var(--accent2); color: #2a1c00; }
.btn.tertiary { background: var(--accent3); color: #1a1400; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.find { padding: 8px 10px; min-width: 72px; }
.btn.cancel { padding: 8px 10px; min-width: 84px; }

/* Başarı (Onay) butonu yeşil */
.btn.success {
  background: #22c55e; /* green-500 */
  color: #fff;
}
.btn.success:hover { filter: brightness(1.12); }

/* Turkuaz vurgulu CTA buton */
.btn.turquoise {
  background: #06b6d4; /* cyan-500 */
  color: #003036;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, .18);
}
.btn.turquoise:hover { filter: brightness(1.06); }

/* Küçük buton varyantı */
.btn.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 8px;
}

/* Sürücü paneli: çağrı kartında kabul/reddet butonlarını yan yana göster */
.call-item .btn {
  display: inline-block;
  width: calc(50% - 6px);
  margin-top: 10px;
}

/* Admin Sürücü Listesi: mobilde iki buton yan yana %50 */
@media (max-width: 640px) {
  .actions .btn {
    display: inline-block;
    width: calc(50% - 6px);
  }
}

/* Form butonları: giriş/kayıt ekranlarında üst boşluk ver */
.landing form .btn,
.auth form .btn { margin-top: 12px; }
.card form .btn { margin-top: 12px; }

/* ========== KARTLAR VE PANELLER ========== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: border-color .2s;
}

.card:hover { border-color: var(--accent2); }
.card h3 { margin-top: 0; }

/* Chat okundu işareti */
.tick-read {
  color: #16a34a; /* green */
  font-weight: 700;
  margin-left: 6px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

/* Genel aksiyon buton konteyneri */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sayfalama (pager) */
.pager {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.pager .pager-actions {
  display: flex;
  gap: 8px;
}

/* Mobilde iki butonu yan yana ve eşit genişlikte göster */
@media (max-width: 640px) {
  .actions .btn {
    display: inline-block;
    width: calc(50% - 6px);
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager .pager-actions .btn {
    flex: 1 1 50%;
  }
}

/* ========== TABS (AUTH) ========== */
.tabs { margin-top: 16px; }
.tab-nav { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn {
  background: #1a2133;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.tab-btn.active { background: var(--accent2); color: #1a1000; border-color: #a36a0b; }
.tab-content { }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.subtabs { display: flex; gap: 8px; margin-bottom: 10px; }
.subtab-btn {
  background: #1a2133;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.subtab-btn.active { background: var(--accent2); color: #2a1c00; border-color: #b98c1a; }

.muted { color: var(--muted); }

/* ========== FORM ELEMANLARI ========== */
label { display: block; margin: 10px 0 6px; font-weight: 500; }

input, textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121826;
  color: var(--fg);
  font-size: 15px;
}

/* Yolcu adres girişi: masaüstünde daha büyük ve sağda temizleme butonuna yer aç */
@media (min-width: 900px) {
  #dest-address { font-size: 18px; padding: 12px 14px; }
}

/* Adres alanını masaüstünde tam genişlikte göster */
.controls label,
.controls .address-input { grid-column: 1 / -1; }

/* Adres temizleme butonu (input içinde sağda) */
/* clear-btn için özel konumlandırma kaldırıldı; artık input dışında kullanılacak */

input:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .3);
}

/* ========== UYARILAR ========== */
.alert { padding: 10px 14px; border-radius: 8px; }
.alert-error {
  background: #3b0f0f;
  border: 1px solid #6b1b1b;
  color: #fca5a5;
}

/* ========== HARİTA VE GRID ========== */
.grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}

.map {
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

/* ========== KONTROLLER ========== */
.controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
}

/* ========== TABLOLAR ========== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

/* Geniş tabloyu gövdeyi taşırmadan yatay kaydırılabilir yap */
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap .table { min-width: 100%; }

/* My Trips görünümü: daha küçük font ve sıkı tablo */
.trips .table { font-size: 14px; }
.trips .table th, .trips .table td { padding: 8px; }
@media (max-width: 768px) {
  .trips .table { font-size: 12px; }
  .trips .table th, .trips .table td { padding: 5px; }
}

/* Durum ikonları (küçük ve sade) */
.status-icon { font-size: 12px; vertical-align: middle; }
.status-completed { color: #22c55e; } /* yeşil */
.status-active { color: #f59e0b; }    /* amber */
.status-pending { color: #9ca3af; }   /* gri */
.status-cancelled { color: #ef4444; } /* kırmızı */
.status-unknown { color: var(--muted); }

/* My Trips tablo sütunlarını daralt ve sabitle */
.trips .table { table-layout: fixed; width: 100%; }
.trips .table th:nth-child(1), .trips .table td:nth-child(1) { width: 7%; }
.trips .table th:nth-child(2), .trips .table td:nth-child(2) { width: 8%; text-align: center; }
.trips .table th:nth-child(4), .trips .table td:nth-child(4) { width: 15%; }
.trips .table th:nth-child(5), .trips .table td:nth-child(5) { width: 25%; }
.trips .table th:nth-child(6), .trips .table td:nth-child(6) { width: 25%; }
.trips .table td:nth-child(3) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* fixed layout ile kalan alanı kullanıp ellipsis uygula */
}

@media (max-width: 768px) {
  .trips .table th, .trips .table td { padding: 4px 6px; }
.trips .table th:nth-child(1), .trips .table td:nth-child(1) { width: 7%; }
.trips .table th:nth-child(2), .trips .table td:nth-child(2) { width: 8%; text-align: center; }
.trips .table th:nth-child(4), .trips .table td:nth-child(4) { width: 15%; }
.trips .table th:nth-child(5), .trips .table td:nth-child(5) { width: 25%; }
.trips .table th:nth-child(6), .trips .table td:nth-child(6) { width: 25%; }
  .status-icon { font-size: 11px; }
}

@media (max-width: 480px) {
  .trips .table { font-size: 11px; }
}

/* Cihaz bazlı sıkılaştırma sınıfları */
.trips .table.compact-desktop th,
.trips .table.compact-desktop td {
  padding: 8px 10px;
}
.trips .table.compact-mobile th,
.trips .table.compact-mobile td {
  padding: 3px 4px;
  font-size: 11px;
}

/* ========== KOD ROZETİ ========== */
.code-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: #111827; /* koyu arka plan */
  color: var(--white);
  border: 1px solid var(--accent2);
  font-weight: 700;
  letter-spacing: .6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

/* ========== CHAT MESAJLARI ========== */
#chat-list {
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121826;
  margin-bottom: 8px;
}

.chat-row {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 6px 0;
  font-size: 15px;
}

.chat-row.me {
  background: #3f2f14;
  border: 1px solid #9a6a19;
}

.chat-row.them {
  background: #202a40;
  border: 1px solid #334366;
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  width: 92%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: modalFade .25s ease;
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content h3 { margin-top: 0; color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.stars {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.stars .star {
  font-size: 28px;
  line-height: 1;
  background: transparent;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  transition: color .2s;
}

.stars .star.active { color: var(--accent2); }

/* MODAL GİZLEME (öncelikli kural) */
  .modal.hidden { display: none; }
  /* Genel gizleme yardımcı sınıfı */
  .hidden { display: none !important; }

/* ========== ADRES ÖNERİLERİ DROPDOWN ========== */
.address-input { position: relative; }

.suggestions {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  max-height: 220px;
  overflow: auto;
  z-index: 1000;
}

.suggestions .item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.suggestions .item:last-child { border-bottom: none; }

.suggestions .item:hover { background: #0e1628; }

/* ========== RESPONSIVE TASARIM ========== */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .map { height: 300px; }
  .controls { grid-template-columns: 1fr; }
  .controls .btn { width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .app-header { flex-wrap: wrap; gap: 10px; }
  .menu-toggle { display: block; }
  .app-header nav { display: none; width: 100%; }
  .app-header.menu-open nav { display: block; }
  .app-header nav a { display: block; padding: 10px 0; margin: 0; border-top: 1px solid var(--border); }
  .app-header nav a:first-child { border-top: none; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  .app-main { padding: 12px; }
  .app-header { padding: 12px 16px; }
  .map { height: 240px; }
  .modal-content {
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 16px;
  }
  .btn { width: 100%; }
  /* Küçük butonda tam genişlikten kaçın */
  .btn.btn-sm { width: auto; }
  /* Aktif sürücü panelinde mobilde dikey boşluk ve hizalama */
  #active-trip .btn { margin-top: 10px; }
  #active-trip .btn:first-child { margin-top: 0; }
  .stars .star { font-size: 32px; }
  .card { padding: 14px; }
}
/* Admin driver cards: dark navy vs brown backgrounds */
.theme-admin .card.approved-card {
  background-color: #0B1E39; /* lacivert */
  color: #ffffff;
}
.theme-admin .card.pending-card {
  background-color: #3D2C1A; /* kahverengi */
  color: #ffffff;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.pager-actions .btn {
  margin-right: 8px;
}
/* Leaflet DivIcon: koyu kırmızı konum işareti */
.marker-pin {
  width: 24px;
  height: 32px;
  position: relative;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 2px #ffffff, 0 2px 6px rgba(0,0,0,0.3);
}
.marker-pin::after {
  content: '';
  width: 10px;
  height: 10px;
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ffffff;
  border-radius: 50%;
}
.marker-red {
  background: #b91c1c; /* koyu kırmızı */
}
/* Koyu mavi yolcu işareti */
.marker-blue {
  background: #1e3a8a; /* daha açık mavi (blue-800) */
}
