/**
 * admin-responsive.css
 * ---------------------------------------------------------------------------
 * Boshqaruv paneli uchun umumiy dizayn + responsivelik qatlami.
 * Faqat ko'rinish (layout, bo'shliqlar, scroll, touch target) bilan ishlaydi —
 * hech qanday biznes logika yoki JS selektorlari o'zgartirilmagan.
 *
 * Breakpointlar (Bootstrap 5):
 *   xs <576 | sm >=576 | md >=768 | lg >=992 | xl >=1200 | xxl >=1400
 * Vuexy menyusi xl (1200px) da off-canvas rejimga o'tadi.
 * ---------------------------------------------------------------------------
 */

/* ==========================================================================
   0. Umumiy himoya — gorizontal "toshib ketish" ni oldini olish
   ========================================================================== */

.layout-page,
.content-wrapper,
.container-xxl,
.card,
.card-body,
.tab-content,
.tab-pane {
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

/* Vuexy'ning qat'iy piksel kengliklari kichik ekranda toshib ketmasin */
[class*='w-px-'] {
  max-width: 100%;
}

/* Uzun so'z/URL larni sindirish */
.card-body,
.list-group-item,
.dropdown-item {
  overflow-wrap: anywhere;
}

/* ==========================================================================
   1. Karta (card) — zamonaviy radius, yumshoq soya
   ========================================================================== */

.card {
  --bs-card-border-radius: 0.625rem;
  --bs-card-inner-border-radius: 0.625rem;
  transition: box-shadow 0.24s ease, transform 0.24s ease;
}

@media (hover: hover) {
  .card.hover-lift:hover,
  .card.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--bs-card-hover-box-shadow, 0 0.25rem 1.125rem 0 rgba(0, 0, 0, 0.18));
  }
}

/* Sarlavha + amallar bitta qatorda; joy yetmasa chiroyli o'raladi */
.card-header.d-flex {
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.card-header .card-title {
  line-height: 1.4;
}

.card-header > .d-flex {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Karta footeri — mobil holatda tugma to'liq kenglikda */
.card-footer.d-flex {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   2. Sahifa bo'shliqlari — ekran kichraygan sari ixchamlashadi
   ========================================================================== */

/* Eslatma: .container-xxl chap/o'ng paddingi mavzuning o'zida
   (1rem <992px, 1.5rem >=992px) navbar bilan tekislangan — tegilmaydi. */

@media (max-width: 575.98px) {
  .container-p-y {
    padding-block: 1.125rem !important;
  }

  .card {
    --bs-card-spacer-x: 1.125rem;
    --bs-card-spacer-y: 1.125rem;
    --bs-card-cap-padding-x: 1.125rem;
    --bs-card-cap-padding-y: 1.125rem;
  }

  .card-header .card-title,
  .card-header h5 {
    font-size: 1.0625rem;
  }

  h4 {
    font-size: 1.25rem;
  }

  h5 {
    font-size: 1.0625rem;
  }
}

/* ==========================================================================
   3. Karta sarlavhasidagi amallar — kichik ekranda to'liq kenglik
   ========================================================================== */

@media (max-width: 575.98px) {
  .card-header.d-flex > .btn,
  .card-footer.d-flex > .btn {
    width: 100%;
    justify-content: center;
  }

  .card-header.d-flex > .form-select,
  .card-header.d-flex > .form-control {
    width: 100% !important;
  }

  /* Tugmalar guruhi: bir qatorda teng bo'linadi */
  .card-header.d-flex > .d-flex {
    width: 100%;
  }

  .card-header.d-flex > .d-flex > .btn {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
  }
}

/* ==========================================================================
   4. DataTables — mobil uchun eng muhim bo'lim
   ========================================================================== */

/* --- "control" ustuni: sig'magan ustunlarni ochadigan +/− tugmasi ---------
   DataTables Responsive `type: 'column'` rejimida 1-ustun toggle bo'ladi.
   Keng ekranda hech narsa yashirilmaydi, shuning uchun u bo'sh turadi — o'shanda
   ortiqcha joy egallamasligi uchun ensiz qilamiz. */
table.dataTable.dtr-column > tbody > tr > td.control,
table.dataTable.dtr-column > tbody > tr > th.control {
  cursor: pointer;
  width: 2.25rem;
  text-align: center;
}

table.dataTable.dtr-column > tbody > tr > td.control::before {
  background-color: var(--bs-primary);
  border-radius: 1rem;
  box-shadow: none;
  color: #fff;
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  height: 1.25rem;
  width: 1.25rem;
  border: 0;
  margin: 0;
  top: auto;
  left: auto;
  position: static;
}

table.dataTable.dtr-column > tbody > tr.dtr-expanded > td.control::before {
  /* Vendor CSS bu holatda uchburchak chegara chizadi — uni bekor qilamiz */
  border: 0;
  content: '\2212';
  background-color: var(--bs-danger);
}

/* Yig'ilgan ustunlar ro'yxati (child row) */
table.dataTable > tbody > tr > td .dtr-details {
  display: block;
  width: 100%;
}

table.dataTable > tbody > tr > td .dtr-details > li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--bs-border-color);
  white-space: normal;
}

table.dataTable > tbody > tr > td .dtr-details > li:last-child {
  border-bottom: 0;
}

table.dataTable > tbody > tr > td .dtr-details > li > .dtr-title {
  min-width: 8rem;
  font-weight: 600;
  color: var(--bs-heading-color);
}

table.dataTable > tbody > tr > td .dtr-details > li > .dtr-data {
  flex: 1 1 auto;
  min-width: 0;
}

/* Child qatorda uzun matn kesilmasin */
.card-datatable table.dataTable > tbody > tr > td.child {
  white-space: normal;
  max-width: none;
  overflow: visible;
}

/* Gorizontal scroll faqat jadval ustida — sahifa qimirlamaydi */
.card-datatable .dt-layout-table > div {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--bs-primary-rgb, 105, 108, 255), 0.35) transparent;
}

.card-datatable .dt-layout-table > div::-webkit-scrollbar {
  height: 0.375rem;
}

.card-datatable .dt-layout-table > div::-webkit-scrollbar-track {
  background: transparent;
}

.card-datatable .dt-layout-table > div::-webkit-scrollbar-thumb {
  background: rgba(var(--bs-primary-rgb, 105, 108, 255), 0.35);
  border-radius: 1rem;
}

.card-datatable .dt-layout-table > div::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--bs-primary-rgb, 105, 108, 255), 0.6);
}

/* Qatorlar ixcham va o'qishli */
.card-datatable table.dataTable > tbody > tr > td {
  white-space: nowrap;
  vertical-align: middle;
}

.card-datatable table.dataTable > tbody > tr > td:not(.dt-empty):not(.dataTables_empty):not(.child) {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* "Ma'lumot yo'q" qatori har doim to'liq ko'rinsin */
.card-datatable table.dataTable > tbody > tr > td.dt-empty,
.card-datatable table.dataTable > tbody > tr > td.dataTables_empty {
  white-space: normal;
  text-align: center;
  padding-block: 1.75rem;
}

.card-datatable table.dataTable > thead > tr > th {
  white-space: nowrap;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

.card-datatable table.dataTable > tbody > tr:hover > * {
  background-color: rgba(var(--bs-primary-rgb, 105, 108, 255), 0.04);
}

/* Amallar ustuni tugmalari yopishib qolmasin */
.card-datatable table.dataTable td .btn-icon + .btn-icon {
  margin-inline-start: 0.125rem;
}

/* Yuqori/pastki boshqaruv qatorlari */
.dt-container div.dt-search input {
  min-width: 12rem;
}

/* Mobil toolbar.
   DataTables o'z CSS'ida (max-width:767px) `div.dt-container div.dt-search`
   selektori bilan hammasini markazga tekislaydi. Bu yerdagi selektorlar
   xuddi shunday og'irlikda, lekin fayl keyinroq ulangani uchun ustun keladi. */
@media (max-width: 767.98px) {
  div.dt-container div.dt-length,
  div.dt-container div.dt-search {
    text-align: start;
    width: 100%;
    margin-block: 0.75rem 0;
  }

  /* Qidiruv — to'liq kenglikda, alohida qatorda */
  div.dt-container div.dt-search input {
    display: block;
    width: 100%;
    min-width: 0;
    margin-inline: 0;
  }

  div.dt-container div.dt-search label:empty {
    display: none;
  }

  /* Sahifa hajmi — chapda, yorliq bilan */
  div.dt-container div.dt-length select {
    margin-inline: 0 0.5rem;
  }

  div.dt-container div.dt-info,
  div.dt-container div.dt-paging {
    text-align: center;
    width: 100%;
  }

  div.dt-container div.dt-paging {
    display: flex;
    justify-content: center;
  }

  div.dt-container div.dt-paging ul.pagination {
    flex-wrap: wrap;
    justify-content: center;
    margin-block-end: 0;
  }

  /* Toolbar qatorlari orasidagi bo'shliq */
  .card-datatable .dt-container > .row {
    --bs-gutter-y: 0.25rem;
  }
}

/* Oddiy (DataTables bo'lmagan) jadvallar ham scroll bo'lsin */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-responsive > .table {
  margin-bottom: 0;
}

.table-responsive > .table > :not(caption) > * > * {
  white-space: nowrap;
}

/* ==========================================================================
   5. Modallar — telefonda "sheet" ko'rinishi
   ========================================================================== */

.modal-content {
  border-radius: 0.75rem;
}

.modal-header,
.modal-footer {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-footer > .btn {
  margin: 0;
}

@media (max-width: 575.98px) {
  .modal .modal-dialog:not(.modal-fullscreen):not([class*='modal-fullscreen-']) {
    margin: 0.75rem;
  }

  /* Fullscreen modalda kontent to'liq oqadi */
  .modal-fullscreen-sm-down .modal-content {
    border-radius: 0;
  }

  .modal-fullscreen-sm-down .modal-body {
    overflow-y: auto;
  }

  .modal-footer > .btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
  }
}

/* ==========================================================================
   6. Tab / nav-pills — mobil uchun gorizontal scroller
   ========================================================================== */

.nav-pills.nav-scroller {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-block-end: 0.25rem;
  gap: 0.375rem;
}

.nav-pills.nav-scroller::-webkit-scrollbar {
  display: none;
}

.nav-pills.nav-scroller .nav-item {
  flex: 0 0 auto;
}

.nav-pills.nav-scroller .nav-link {
  white-space: nowrap;
}

/* ==========================================================================
   7. Formalar — barmoq bilan qulay
   ========================================================================== */

.form-label {
  font-weight: 500;
}

input[type='color'].form-control {
  padding: 0.25rem;
  min-height: 2.625rem;
  cursor: pointer;
}

input[type='date'].form-control,
input[type='time'].form-control {
  min-height: 2.625rem;
}

/* iOS "zoom on focus" ni oldini olish */
@media (max-width: 767.98px) {
  .form-control,
  .form-select {
    font-size: 1rem;
  }
}

.form-check-input {
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
}

/* Fayl tanlash tugmasi kichik ekranda ham to'liq ko'rinsin */
.form-control[type='file'] {
  overflow: hidden;
}

/* ==========================================================================
   8. Tugmalar — touch target va o'ralish
   ========================================================================== */

.btn {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .btn {
    min-height: 2.375rem;
  }

  .btn-icon {
    min-width: 2.25rem;
    min-height: 2.25rem;
  }
}

/* ==========================================================================
   9. Statistik kartalar (KPI)
   ========================================================================== */

.stat-tile .stat-tile-label {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.stat-tile .stat-tile-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

@media (max-width: 575.98px) {
  .stat-tile .stat-tile-value {
    font-size: 1.25rem;
  }

  .stat-tile .avatar-initial {
    width: 2.25rem;
    height: 2.25rem;
  }
}

/* ==========================================================================
   10. Menyu / navbar / footer
   ========================================================================== */

@media (max-width: 1199.98px) {
  .layout-menu {
    box-shadow: 0 0 2.5rem rgba(0, 0, 0, 0.35);
  }
}

.layout-navbar .navbar-nav-right {
  gap: 0.25rem;
}

@media (max-width: 575.98px) {
  .content-footer .footer-container {
    text-align: center;
    justify-content: center !important;
  }
}

/* ==========================================================================
   11. Yordamchi utility'lar (Bootstrap'da yo'q)
   ========================================================================== */

/* Flex/grid ichida matn "text-truncate" ishlashi uchun */
.min-w-0 {
  min-width: 0 !important;
}

@media (min-width: 576px) {
  .w-sm-auto {
    width: auto !important;
  }
}

@media (min-width: 768px) {
  .w-md-auto {
    width: auto !important;
  }
}

/* Chip / badge ro'yxati */
.chip-box {
  min-height: 2.875rem;
  border-radius: 0.5rem;
}

.chip-box .badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  padding: 0.375rem 0.625rem;
}

/* ==========================================================================
   12. SweetAlert2 / toast — kichik ekran
   ========================================================================== */

@media (max-width: 575.98px) {
  .swal2-popup {
    width: calc(100vw - 2rem) !important;
    padding: 1.25rem !important;
  }

  .swal2-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .swal2-actions .btn {
    flex: 1 1 auto;
  }
}

/* ==========================================================================
   13. Apex charts — konteynerdan chiqib ketmasin
   ========================================================================== */

.apexcharts-canvas {
  max-width: 100%;
}

.card-body > [id$='Chart'],
.card-body > [id$='Donut'],
.card-body > [id$='Bar'] {
  min-width: 0;
}
