/* ============================================================
   KA App - Custom Styles
   Sections:
     1. Utility helpers
     2. Form / dropzone
     3. Global UI polish (cards, badges, buttons)
     4. Mobile-first responsive enhancements
   Notes:
     - DO NOT remove existing utility classes (w-4/h-4/w-6/h-6, .dropzone)
       — they are referenced from existing markup.
     - All overrides are additive and respect AdminLTE 3 / Bootstrap 4.
   ============================================================ */

/* ---------- 1. Utility helpers (existing) ---------- */
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }

/* ---------- 2. Form / dropzone (existing) ---------- */
.dropzone {
  background: white;
  border-radius: 5px;
  border: 2px dashed rgb(0, 135, 247);
  border-image: none;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- 3. Global UI polish ---------- */

/* Softer card shadows + smoother corners across all dashboards */
.card {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.card .card-header {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-color: #fbfcfd;
}

/* Small-box (AdminLTE summary tiles) — flatter, more modern */
.small-box {
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.small-box > .inner {
  padding: 16px;
}
.small-box h3 {
  font-weight: 700;
  letter-spacing: -0.5px;
}
.small-box .icon > i {
  font-size: 4.5rem;
  top: 12px;
  right: 14px;
  opacity: 0.25;
}

/* Badges — slightly larger, rounded for legibility */
.badge {
  font-weight: 600;
  padding: 0.35em 0.6em;
  border-radius: 999px;
  letter-spacing: 0.2px;
}

/* Buttons — comfortable touch targets without disrupting AdminLTE */
.btn {
  border-radius: 8px;
  font-weight: 500;
}
.btn-sm {
  border-radius: 6px;
}

/* Tables — quieter borders */
.table thead th {
  border-bottom: 2px solid #e9ecef;
  font-weight: 600;
  color: #495057;
}
.table td, .table th {
  vertical-align: middle;
}

/* Empty-state visuals */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: #6c757d;
}
.empty-state img {
  max-width: 120px;
  opacity: 0.85;
  margin-bottom: 12px;
}

/* CTA card (reusable highlighted action) */
.cta-card {
  background: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 6px 18px rgba(67, 97, 238, 0.25);
}
.cta-card h4 {
  color: #fff;
  margin: 0 0 4px 0;
  font-weight: 700;
}
.cta-card p {
  margin: 0;
  opacity: 0.9;
}
.cta-card .btn {
  background: #fff;
  color: #3f37c9;
  font-weight: 600;
}
.cta-card .btn:hover {
  background: #f1f3f5;
  color: #3f37c9;
}

/* Progress meter (used on pupil dashboard) */
.progress-meter {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 16px;
}
.progress-meter .label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #495057;
  margin-bottom: 6px;
}
.progress-meter .progress {
  height: 10px;
  border-radius: 999px;
  background-color: #eef0f3;
}
.progress-meter .progress-bar {
  border-radius: 999px;
}

/* ---------- 4. Mobile-first responsive enhancements ---------- */

/* Comfortable base sizing on phones */
@media (max-width: 575.98px) {
  /* Tighten container padding so cards aren't cramped */
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Header titles scale down */
  .content-header h1,
  .content-header h3 {
    font-size: 1.35rem;
  }

  /* Cards: lighter margins to maximize content width */
  .card .card-body {
    padding: 12px;
  }
  .card .card-header {
    padding: 10px 12px;
  }

  /* Small-box numbers shrink slightly */
  .small-box h3 {
    font-size: 1.6rem;
  }
  .small-box p {
    font-size: 0.875rem;
  }
  .small-box .icon > i {
    font-size: 3.2rem;
  }

  /* Buttons: bigger tap targets */
  .btn {
    min-height: 40px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  .btn-sm {
    min-height: 34px;
  }

  /* Button groups should stack on very narrow screens */
  .btn-group.btn-block-mobile {
    display: flex;
    flex-direction: column;
  }
  .btn-group.btn-block-mobile .btn {
    border-radius: 8px !important;
    margin: 4px 0 !important;
  }

  /* Form controls comfortable for touch */
  .form-control,
  .custom-select {
    min-height: 42px;
    font-size: 1rem;
  }

  /* Tables: allow horizontal scroll without breaking layout */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  /* Hide AdminLTE footer on tiny screens to free vertical space */
  .main-footer {
    font-size: 0.75rem;
    padding: 0.5rem;
    text-align: center;
  }

  /* CTA card stacks on phones */
  .cta-card {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .cta-card .btn {
    width: 100%;
  }
}

/* Tablet adjustments */
@media (min-width: 576px) and (max-width: 991.98px) {
  .small-box h3 {
    font-size: 1.9rem;
  }
  .content-header h1 {
    font-size: 1.6rem;
  }
}

/* Sidebar/Navbar: ensure the AdminLTE sidebar overlay works smoothly */
@media (max-width: 991.98px) {
  body.sidebar-open .content-wrapper::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1037;
  }
}

/* Print friendliness (optional, low cost) */
@media print {
  .main-sidebar,
  .main-header,
  .main-footer,
  .btn,
  .no-print {
    display: none !important;
  }
  .content-wrapper {
    margin-left: 0 !important;
  }
}

/* ============================================================
   5. Inner-page enhancements (forms, tables, modals)
      Lifts every admin/tutor/app inner page without markup changes.
   ============================================================ */

/* ----- Form pages ----- */

/* Consistent label rhythm */
.content-wrapper form label,
.content-wrapper form .col-form-label {
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 0.35rem;
}

/* Match select2 single-select height to AdminLTE form-control */
.select2-container--bootstrap4 .select2-selection--single {
  height: calc(2.25rem + 2px);
  padding: 0.375rem 0.75rem;
}
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding-left: 0;
}
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: 100%;
}

/* Tagify / bootstrap-tagsinput baseline parity with form-control */
.bootstrap-tagsinput,
.tagify {
  width: 100%;
  min-height: calc(2.25rem + 2px);
  border-radius: 0.25rem;
  border: 1px solid #ced4da;
  padding: 0.25rem 0.5rem;
}

/* File inputs — consistent block layout */
.form-control-file {
  display: block;
  width: 100%;
  padding: 0.375rem 0;
}

/* Summernote chrome */
.note-editor.note-frame {
  border-radius: 6px;
}

/* Group "Title + Back" header rows on phones */
@media (max-width: 575.98px) {
  .content-header .row.mb-2 .col-sm-6.text-right {
    text-align: left !important;
    margin-top: 8px;
  }
  .content-header .row.mb-2 .col-sm-6.text-right .btn {
    width: 100%;
  }
}

/* ----- DataTables (index pages) ----- */

.dataTables_wrapper .row {
  align-items: center;
  row-gap: 8px;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 8px;
}
.dataTables_wrapper .dataTables_filter input {
  margin-left: 0.5em;
  border-radius: 6px;
  border: 1px solid #ced4da;
  padding: 0.3rem 0.6rem;
}
.dataTables_wrapper .dataTables_length select {
  border-radius: 6px;
  border: 1px solid #ced4da;
  padding: 0.2rem 0.4rem;
}
.dataTables_wrapper .pagination {
  margin-bottom: 0;
}
.dataTables_wrapper .pagination .page-link {
  border-radius: 6px;
  margin: 0 2px;
  border: 1px solid #e9ecef;
}
.dataTables_wrapper .pagination .page-item.active .page-link {
  background-color: #4361ee;
  border-color: #4361ee;
}

@media (max-width: 575.98px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: left !important;
    float: none !important;
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label {
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    margin-left: 0;
    margin-top: 4px;
  }
  .dataTables_wrapper .dataTables_paginate {
    margin-top: 8px;
  }
  .dataTables_wrapper .dataTables_paginate .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* DataTable Buttons toolbar (Copy / CSV / Excel / PDF / Print / ColVis) */
  .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .dt-buttons .btn {
    flex: 1 1 auto;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* ----- Table action button groups -----
   Index tables typically render an Edit/Delete/etc. .btn-group-sm
   in the last column. Keep them tight on desktop, stack on phones. */
.table td .btn-group-sm > .btn {
  border-radius: 6px;
  margin-right: 2px;
}
@media (max-width: 575.98px) {
  .table td .btn-group,
  .table td .btn-group-sm {
    display: flex;
    flex-wrap: wrap;
  }
  .table td .btn-group-sm > .btn {
    flex: 1 1 auto;
    margin: 2px;
  }
}

/* ----- Cards on inner pages ----- */
.content .card .card-body {
  padding: 1rem 1.1rem;
}

/* Image preview tiles (commonly used in product/brand/tutor forms) */
.image-preview,
.preview-tile {
  width: 100%;
  max-width: 180px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  padding: 4px;
  background: #fff;
}

/* ----- Modals on phones ----- */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  .modal-body {
    padding: 1rem;
  }
  .modal-footer {
    flex-wrap: wrap;
    gap: 6px;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
  }
}

/* ----- iziToast (notifications) baseline ----- */
.iziToast-wrapper {
  z-index: 2000;
}

/* ----- Accessibility: focus rings everywhere ----- */
.btn:focus,
.form-control:focus,
.custom-select:focus {
  outline: none;
}
.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.35);
}

