/*
 * Renneway Panel — Top Nav (Trendyol-style)
 * Eski sidebar layout'unu kapatır, yatay üst menü + dropdown'lar getirir.
 * Mobil için hamburger ile aşağıya açılan tam genişlik menü.
 */

/* ========== Eski sidebar layout'u sıfırla ========== */
body.rnw-has-topnav .rnw-sidebar,
body.rnw-has-topnav .rnw-sidebar-backdrop { display: none !important; }
body.rnw-has-topnav .rnw-shell { display: block !important; }
body.rnw-has-topnav .rnw-main { display: block !important; }
body.rnw-has-topnav .rnw-topbar { display: none !important; }

/* ========== Top nav konteyneri ========== */
.rnw-topnav {
  position: sticky; top: 0; z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--rnw-border, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  font-family: var(--rnw-font-sans, 'Inter', -apple-system, sans-serif);
}

/* ========== Üst şerit (brand + user) ========== */
.rnw-topnav__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.rnw-topnav__brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
}
.rnw-topnav__brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--rnw-ink, #0f172a);
  flex-shrink: 0;
  position: relative;
}
.rnw-topnav__brand-logo::after {
  content: '';
  position: absolute; inset: 6px;
  border: 2px solid #fff; border-radius: 4px;
  border-color: #fff transparent #fff transparent;
}
.rnw-topnav__brand-name {
  font-family: 'Fraunces', serif; font-style: italic;
  font-weight: 500; font-size: 18px; line-height: 1;
  color: var(--rnw-ink, #0f172a);
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
}
.rnw-topnav__brand-sub {
  font-size: 9.5px;
  letter-spacing: 0.18em; color: #64748b;
  margin-top: 4px; font-weight: 600;
}

/* ========== Kullanıcı alanı (sağ) ========== */
.rnw-topnav__user {
  display: flex; align-items: center; gap: 14px;
}
.rnw-topnav__clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; color: #64748b;
  padding-right: 14px; border-right: 1px solid #e2e8f0;
}
.rnw-topnav__user-info {
  text-align: right;
  max-width: 220px;
}
.rnw-topnav__user-name {
  font-size: 13px; font-weight: 600; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rnw-topnav__user-role {
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: #94a3b8;
  font-weight: 500; margin-top: 2px;
}
.rnw-topnav__user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--rnw-ink, #0f172a); color: #fff;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.rnw-topnav__logout {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  color: #64748b; background: transparent;
  border: 1px solid #e2e8f0; text-decoration: none;
  transition: all 0.15s;
}
.rnw-topnav__logout:hover { color: #ef4444; border-color: #ef4444; background: #fef2f2; }

/* Hamburger (mobil) */
.rnw-topnav__burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  background: #fff; color: #0f172a;
  align-items: center; justify-content: center;
  cursor: pointer;
}

/* ========== Alt şerit (yatay menü) ==========
   ÖNEMLİ: overflow-x:auto kullanmıyoruz. CSS spec'ine göre overflow-x:auto
   overflow-y'yi de auto'ya çeviriyor → alt menü (dropdown) dışarı taşınca clip'lenir.
   Bunun yerine flex-wrap:nowrap + visible overflow. */
.rnw-topnav__menu {
  display: flex; align-items: stretch;
  gap: 2px;
  padding: 0 18px;
  flex-wrap: nowrap;
  overflow: visible;
}

.rnw-topnav__link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 16px; min-height: 48px;
  color: #475569; font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  border: none; background: transparent; cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.rnw-topnav__link svg {
  width: 18px; height: 18px; flex-shrink: 0;
}
.rnw-topnav__link:hover {
  color: var(--rnw-ink, #0f172a);
  background: #f8fafc;
}
.rnw-topnav__link.is-active {
  color: var(--rnw-ink, #0f172a);
  border-bottom-color: var(--rnw-ink, #0f172a);
  font-weight: 600;
}
.rnw-topnav__chev {
  width: 14px !important; height: 14px !important;
  transition: transform 0.15s;
  opacity: 0.6;
}

/* Badge (okunmamış ticket sayısı vb.) */
.rnw-topnav__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 700;
  margin-left: 2px;
}

/* ========== Dropdown ========== */
.rnw-topnav__dropdown-wrap {
  position: relative;
  display: inline-flex;
}
.rnw-topnav__dropdown {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 220px; padding: 8px;
  background: #fff;
  border: 1px solid var(--rnw-border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 60;
  margin-top: -1px;
}
.rnw-topnav__dropdown-wrap.is-open .rnw-topnav__dropdown {
  display: flex; flex-direction: column; gap: 1px;
}
.rnw-topnav__dropdown-wrap.is-open .rnw-topnav__chev {
  transform: rotate(180deg);
}
.rnw-topnav__dropdown-link {
  display: block;
  padding: 10px 12px;
  font-size: 13.5px; color: #1e293b;
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
}
.rnw-topnav__dropdown-link:hover {
  background: #f1f5f9; color: var(--rnw-ink, #0f172a);
}

/* İçerik kapsayıcı (top nav modunda) */
.rnw-content--topnav {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}

/* ========== TABLET (≤ 1024px) ========== */
@media (max-width: 1024px) {
  .rnw-topnav__bar { padding: 10px 16px; }
  .rnw-topnav__menu { padding: 0 12px; }
  .rnw-topnav__link { padding: 12px 12px; font-size: 13px; }
  .rnw-content--topnav { padding: 18px 16px 60px; }
  .rnw-topnav__clock { display: none; }
}

/* ========== MOBİL (≤ 768px) ========== */
@media (max-width: 768px) {
  .rnw-topnav__burger { display: inline-flex; }
  .rnw-topnav__user-info { display: none; }
  .rnw-topnav__brand-sub { display: none; }
  .rnw-topnav__brand-name { font-size: 17px; }

  /* Menü tam genişlik dikey panel olur */
  .rnw-topnav__menu {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 8px 12px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  .rnw-topnav__menu.is-open { display: flex; }
  .rnw-topnav__link {
    width: 100%; justify-content: flex-start;
    border-bottom: 1px solid #f1f5f9; min-height: 52px;
    padding: 12px 14px;
  }
  .rnw-topnav__link.is-active {
    background: #f8fafc;
    border-left: 3px solid var(--rnw-ink, #0f172a);
    border-bottom: 1px solid #f1f5f9;
    padding-left: 11px;
  }
  .rnw-topnav__dropdown-wrap { display: block; width: 100%; }
  .rnw-topnav__dropdown {
    position: static; box-shadow: none; border: none;
    background: #f8fafc; margin: 0;
    border-radius: 0;
    padding: 4px 0 8px 36px;
  }
  .rnw-topnav__dropdown-wrap.is-open .rnw-topnav__dropdown {
    display: flex;
  }
  .rnw-topnav__dropdown-link {
    padding: 12px 12px; font-size: 13.5px;
    border-bottom: 1px solid #f1f5f9;
  }

  /* Üst şeritteki kullanıcı sadece avatar + logout */
  .rnw-topnav__user { gap: 8px; }
  .rnw-topnav__logout {
    width: 40px; height: 40px;
  }

  .rnw-content--topnav { padding: 14px 12px 80px; }
}

/* ========== KÜÇÜK MOBİL (≤ 480px) ========== */
@media (max-width: 480px) {
  .rnw-topnav__bar { gap: 8px; padding: 10px 12px; }
  .rnw-topnav__brand-name { font-size: 16px; }
  .rnw-topnav__user-avatar { width: 36px; height: 36px; font-size: 13px; }
}

/* ========== GENEL MOBİL UYUM (içerik) ========== */
@media (max-width: 768px) {
  /* Sayfa başlığı sarmal: mobilde dikey ve daha sıkı */
  .rnw-page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .rnw-page-title { font-size: 22px !important; }

  /* Tablolar: yatay scroll */
  .rnw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rnw-table { min-width: 600px; }

  /* Form grid'ler: tek sütun */
  .rnw-form__row,
  .rnw-detail-grid,
  .rnw-origin-row,
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  /* Origin row gibi inline grid'lerde özel davran */
  .rnw-origin-row {
    border: 1px solid var(--rnw-border-subtle, #e2e8f0);
    padding: 12px; border-radius: 8px;
    background: #f8fafc;
  }
  .rnw-origin-row > button[aria-label="Kaldır"] {
    align-self: flex-end;
  }

  /* Aside (sipariş/ticket detay sağ panel) altta görünsün */
  .rnw-detail-aside { width: 100%; }

  /* Butonlar tam genişlik daha kullanışlı */
  .rnw-form-actions { flex-direction: column; align-items: stretch !important; gap: 10px; }
  .rnw-form-actions .rnw-btn { width: 100%; justify-content: center; }

  /* Search bar formlar düzgün taşsın */
  form[style*="display:flex"][style*="flex-wrap:wrap"],
  form[style*="display: flex"][style*="flex-wrap: wrap"] {
    flex-direction: column; align-items: stretch !important;
  }
  form[style*="display:flex"][style*="flex-wrap:wrap"] .rnw-select,
  form[style*="display: flex"][style*="flex-wrap: wrap"] .rnw-select,
  form[style*="display:flex"][style*="flex-wrap:wrap"] .rnw-search,
  form[style*="display: flex"][style*="flex-wrap: wrap"] .rnw-search,
  form[style*="display:flex"][style*="flex-wrap:wrap"] .rnw-btn,
  form[style*="display: flex"][style*="flex-wrap: wrap"] .rnw-btn {
    width: 100% !important; min-width: 0 !important;
  }

  /* Card padding'lerini sıkılaştır */
  .rnw-card__body { padding: 14px !important; }
  .rnw-fieldset { padding: 14px !important; }

  /* Ticket sohbet baloncukları daha geniş */
  [style*="max-width:78%"] { max-width: 92% !important; }
}
