html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #5a3fff;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Auth page custom styles */
.auth-page {
  background: #eef1ff;
}

.auth-card {
  max-width: 960px;
  background-color: transparent;
}

.auth-logo {
  width: 40px;
  height: 40px;
}

.auth-hero {
  background: radial-gradient(circle at top left, #ff9a9e 0, #8a56ff 35%, #6a11cb 100%);
}

.disabled-link {
  pointer-events: none;
  opacity: 0.5;
}

/* Dashboard layout */
.bg-dashboard {
  background: #eef1ff;
}

.dashboard-shell {
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #1b2459;
  color: #ffffff;
}

.sidebar .nav-link {
  color: #cbd3ff;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
}

.sidebar .nav-link.active {
  background: #5a3fff;
  color: #ffffff;
}

.sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #8a56ff, #5a3fff);
}

.topbar {
  background: #f7f8ff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.dashboard-main {
  background: #eef1ff;
  flex: 1 1 auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  min-width: 0;
}

.dashboard-footer {
  background: transparent;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5a3fff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Skeleton cards for empty dashboard */
.skeleton-card {
  background: #f9f9ff;
}

.skeleton-title,
.skeleton-line {
  background: linear-gradient(90deg, #e1e6ff 0, #f0f3ff 50%, #e1e6ff 100%);
  background-size: 200% 100%;
  border-radius: 999px;
  height: 10px;
  animation: skeleton-loading 1.4s ease-in-out infinite;
}

.skeleton-title {
  width: 60%;
  height: 14px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========== Mobil / PWA ========== */
html {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Mobil: içerik taşmasın - viewport sınırı (sadece main, topbar kesilmesin) */
@media (max-width: 767.98px) {
  .content-viewport {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  .content-viewport > * {
    max-width: 100%;
    box-sizing: border-box;
  }
  .dashboard-shell > .flex-grow-1 {
    min-width: 0;
    max-width: 100vw;
  }
}

/* Üst bar: mobilde sabit, marka sağda - her ekranda görünsün */
.topbar-mobile {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: #f7f8ff;
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
  overflow: visible;
}
@media (max-width: 767.98px) {
  .topbar {
    overflow: visible !important;
  }
  .topbar .brand-switcher {
    flex-shrink: 0 !important;
  }
}

/* Mobil navbar: farklı renk (mor-mavi gradient) */
@media (max-width: 767.98px) {
  .topbar,
  .topbar-mobile {
    background: linear-gradient(135deg, #1b2459 0%, #2d3a7c 50%, #5a3fff 100%) !important;
    border-bottom: none;
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.15);
  }
  .topbar .text-muted,
  .topbar .text-truncate,
  .topbar .fw-semibold {
    color: #fff !important;
  }
  .topbar .brand-switcher .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
  }
  .topbar .brand-switcher .btn {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
  }
  .topbar .brand-switcher .btn .text-muted {
    color: rgba(255, 255, 255, 0.9) !important;
  }
}

/* Hamburger ikonu: desktop açık arka plan, mobil koyu navbar için beyaz */
.topbar .btn[data-bs-toggle="offcanvas"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%231a1a2e' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 1.25rem;
  height: 1.25rem;
}
.topbar .btn[data-bs-toggle="offcanvas"]:hover .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%235a3fff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
@media (max-width: 767.98px) {
  .topbar .btn[data-bs-toggle="offcanvas"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }
  .topbar .btn[data-bs-toggle="offcanvas"]:hover .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23cbd3ff' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  }
}
.topbar .btn[data-bs-toggle="offcanvas"] {
  text-decoration: none;
  border-radius: 0.375rem;
}
.topbar .btn[data-bs-toggle="offcanvas"]:focus {
  box-shadow: 0 0 0 0.2rem rgba(90, 63, 255, 0.25);
}

@media (max-width: 767.98px) {
  .brand-switcher {
    min-width: 0;
  }
  .brand-switcher .text-muted.small {
    display: none;
  }
  .brand-switcher .dropdown .btn {
    min-width: 90px;
    max-width: 110px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
  .topbar .brand-switcher .dropdown .btn {
    min-width: 80px;
  }
}

/* Mobil offcanvas menü: sidebar teması */
.sidebar-offcanvas {
  background: #1b2459;
}
.sidebar-offcanvas .brand-switcher .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}
.sidebar-offcanvas .brand-switcher .btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
}
.sidebar-offcanvas .brand-switcher .btn .text-muted {
  color: rgba(255, 255, 255, 0.9) !important;
}
.sidebar-offcanvas .nav-link {
  color: #cbd3ff;
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
}
.sidebar-offcanvas .nav-link.active {
  background: #5a3fff;
  color: #fff;
}
.sidebar-offcanvas .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* Listeler: yatay scroll - tüm sütunlar görünsün */
.table-responsive,
.list-scroll-x {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  overflow-y: visible;
  display: block;
  width: 100%;
}
.table-responsive .table,
.list-scroll-x > * {
  margin-bottom: 0;
}
/* Tablo/liste - mobilde yatay scroll (tüm sayfalar) */
@media (max-width: 767.98px) {
  .card .card-body.p-0,
  .table-responsive {
    overflow-x: scroll !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-responsive .table {
    min-width: 1100px;
    width: max-content !important;
    table-layout: auto;
  }
  .table-responsive::-webkit-scrollbar {
    height: 6px;
  }
  .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
  }
  /* Sağ kenarda hafif gölge – sola kaydırma ipucu */
  .table-responsive {
    position: relative;
  }
  .table-responsive::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 6px;
    width: 24px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.06));
    pointer-events: none;
  }
}

/* Formlar: mobilde tek sütun, iç içe geçmesin */
@media (max-width: 767.98px) {
  .dashboard-main form .row.g-3 > [class*="col-"],
  .dashboard-main .row.g-3 > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
  .dashboard-main .row.g-3 .d-flex.align-items-end {
    justify-content: stretch;
  }
  .dashboard-main .row.g-3 .d-flex.align-items-end .btn {
    width: 100%;
  }
}

/* Filtre alanı: mobilde tek sütun, taşma yok - tam görünsün */
@media (max-width: 767.98px) {
  .collapse[id^="filter"],
  [id^="filter"],
  [id^="filter"] .card,
  .filter-form-mobile,
  .filter-form-mobile .card {
    width: 100% !important;
    max-width: 100% !important;
  }
  [id^="filter"] .card-body,
  .filter-form-mobile .card-body {
    padding: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  [id^="filter"] form,
  .filter-form-mobile form {
    width: 100% !important;
    max-width: 100% !important;
  }
  [id^="filter"] .row.g-3,
  .filter-form-mobile .row.g-3 {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  [id^="filter"] .row.g-3 > [class*="col-"],
  .filter-form-mobile .row.g-3 > [class*="col-"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  [id^="filter"] .form-control,
  [id^="filter"] .form-select,
  .filter-form-mobile .form-control,
  .filter-form-mobile .form-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  [id^="filter"] .d-flex.gap-1,
  .filter-form-mobile .d-flex.gap-1 {
    width: 100% !important;
    max-width: 100% !important;
  }
  [id^="filter"] .d-flex.gap-1 .btn,
  [id^="filter"] .d-flex.gap-1 a,
  .filter-form-mobile .d-flex.gap-1 .btn,
  .filter-form-mobile .d-flex.gap-1 a {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}

/* Mobil: tüm kart ve liste taşmasın */
@media (max-width: 767.98px) {
  .content-viewport .card,
  .content-viewport .mb-4 {
    max-width: 100%;
  }
  .content-viewport .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* Filtre alanı toggle */
.filter-toggle[aria-expanded="false"] .filter-toggle-show { display: inline; }
.filter-toggle[aria-expanded="false"] .filter-toggle-hide { display: none; }
.filter-toggle[aria-expanded="true"] .filter-toggle-show { display: none; }
.filter-toggle[aria-expanded="true"] .filter-toggle-hide { display: inline; }
