/*
 * ==========================================================================
 *   MOBILE SPECIFIC STYLES
 *   Overrides for screens < 768px (MD) and < 576px (SM)
 *   Uses variables from custom-styles.css
 * ==========================================================================
 */

@media (max-width: 767.98px) {
  /* --- LAYOUT & SPACING --- */
  .content-wrapper {
    padding: 1rem 0 80px 0 !important;
    min-height: calc(100vh - 110px) !important;
  }

  .content {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 3rem !important;
  }

  .content-header {
    padding: 10px 0 !important;
  }

  .container-fluid {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* --- CARDS --- */
  .card {
    border-radius: var(--rounded-md);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
  }

  .card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    height: auto !important;
  }

  .card-header .card-title {
    margin-bottom: 0.5rem;
    width: 100%;
    font-size: 1.1rem;
  }

  .card-header .card-tools {
    float: none !important;
    margin-top: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-header .card-tools .btn {
    flex: 1;
  }

  .card-body {
    padding: 1rem;
  }

  /* --- TABLES --- */
  .table-responsive {
    border: 0;
    -webkit-overflow-scrolling: touch;
  }

  .table td,
  .table th {
    white-space: nowrap;
    padding: 0.4rem;
    font-size: 0.8rem;
  }

  /* --- DATATABLES --- */
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: left !important;
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_filter input {
    margin-left: 0 !important;
    width: 100%;
    display: block;
    margin-top: 0.25rem;
  }

  .dataTables_wrapper .dataTables_info {
    padding-top: 0 !important;
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_paginate .pagination {
    justify-content: flex-start !important;
  }

  /* --- BUTTONS --- */
  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
  }

  .btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  /* --- FORMS --- */
  .form-group label {
    font-size: 0.9rem;
  }

  .form-control {
    font-size: 0.9rem;
    height: calc(1.5em + 1rem + 2px);
  }

  .col-form-label {
    text-align: left !important;
    padding-bottom: 0;
  }

  /* --- MODALS --- */
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-dialog.modal-lg,
  .modal-dialog.modal-xl {
    max-width: calc(100vw - 1rem);
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-body .row .col-md-4,
  .modal-body .row .col-md-6 {
    margin-bottom: 0.25rem;
  }

  /* --- TIMELINE --- */
  .timeline::before {
    left: 15px;
  }

  .timeline > div > .timeline-item {
    margin-left: 38px;
  }

  .timeline > div > .timeline-item > .timeline-header {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }

  .timeline > div > .timeline-item > .timeline-body {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .timeline > div > .timeline-item > .timeline-footer {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }

  .timeline > div > .fas,
  .timeline > div > .far,
  .timeline > div > .fa-solid {
    left: 2px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    font-size: 0.75rem;
  }

  /* --- INFO BOX --- */
  .info-box {
    min-height: auto;
  }

  .info-box .info-box-icon {
    width: 55px;
    font-size: 1.4rem;
  }

  .info-box .info-box-number {
    font-size: 1.2rem;
  }

  .info-box .info-box-text {
    font-size: 0.75rem;
  }

  /* --- LIST GROUP --- */
  .list-group-item {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  .list-group-item .font-weight-bold {
    font-size: 0.85rem;
  }

  /* --- SMALL BOX --- */
  .small-box .inner {
    padding: 1rem;
  }

  .small-box h3 {
    font-size: 1.6rem;
  }

  .small-box .icon {
    font-size: 3rem;
  }

  /* --- BADGES --- */
  .badge {
    font-size: 0.7em;
    padding: 0.3em 0.55em;
  }

  /* --- TYPOGRAPHY --- */
  h1,
  .h1 {
    font-size: 1.5rem;
  }
  h2,
  .h2 {
    font-size: 1.25rem;
  }
  h3,
  .h3 {
    font-size: 1.125rem;
  }

  .page-title {
    font-size: 1.35rem !important;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem !important;
    color: var(--slate-800);
  }

  .lead {
    font-size: 1.05rem;
    line-height: 1.5;
  }

  /* --- UTILITIES --- */
  .float-right {
    float: none !important;
  }

  .btn.float-right {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    text-align: center;
    float: none !important;
  }
}

/* Very small screens */
@media (max-width: 575.98px) {
  .btn-block-xs {
    display: block;
    width: 100%;
  }

  /* Stack info-box vertically on very small screens */
  .info-box {
    flex-direction: column;
    text-align: center;
  }

  .info-box .info-box-icon {
    width: 100%;
    border-radius: var(--rounded-lg) var(--rounded-lg) 0 0;
    padding: 0.75rem;
  }
}

/* --- CUSTOM STAT CARD (MOBILE) --- */
@media (max-width: 767.98px) {
  .custom-stat-card {
    padding: 1rem 1.25rem;
  }

  .stat-card-value {
    font-size: 1.2rem;
  }
  .btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  /* --- FORMS --- */
  .form-group label {
    font-size: 0.9rem;
  }

  .form-control {
    font-size: 0.9rem;
    height: calc(1.5em + 1rem + 2px);
  }

  .col-form-label {
    text-align: left !important;
    padding-bottom: 0;
  }

  /* --- MODALS --- */
  .modal-dialog {
    margin: 0.5rem;
  }

  .modal-dialog.modal-lg,
  .modal-dialog.modal-xl {
    max-width: calc(100vw - 1rem);
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-body .row .col-md-4,
  .modal-body .row .col-md-6 {
    margin-bottom: 0.25rem;
  }

  /* --- TIMELINE --- */
  .timeline::before {
    left: 15px;
  }

  .timeline > div > .timeline-item {
    margin-left: 38px;
  }

  .timeline > div > .timeline-item > .timeline-header {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }

  .timeline > div > .timeline-item > .timeline-body {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }

  .timeline > div > .timeline-item > .timeline-footer {
    font-size: 0.85rem;
    padding: 0.6rem 1rem;
  }

  .timeline > div > .fas,
  .timeline > div > .far,
  .timeline > div > .fa-solid {
    left: 2px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    font-size: 0.75rem;
  }

  /* --- INFO BOX --- */
  .info-box {
    min-height: auto;
  }

  .info-box .info-box-icon {
    width: 55px;
    font-size: 1.4rem;
  }

  .info-box .info-box-number {
    font-size: 1.2rem;
  }

  .info-box .info-box-text {
    font-size: 0.75rem;
  }

  /* --- LIST GROUP --- */
  .list-group-item {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }

  .list-group-item .font-weight-bold {
    font-size: 0.85rem;
  }

  /* --- SMALL BOX --- */
  .small-box .inner {
    padding: 1rem;
  }

  .small-box h3 {
    font-size: 1.6rem;
  }

  .small-box .icon {
    font-size: 3rem;
  }

  /* --- BADGES --- */
  .badge {
    font-size: 0.7em;
    padding: 0.3em 0.55em;
  }

  /* --- TYPOGRAPHY --- */
  h1,
  .h1 {
    font-size: 1.5rem;
  }
  h2,
  .h2 {
    font-size: 1.25rem;
  }
  h3,
  .h3 {
    font-size: 1.125rem;
  }

  .page-title {
    font-size: 1.35rem !important;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem !important;
    color: var(--slate-800);
  }

  .lead {
    font-size: 1.05rem;
    line-height: 1.5;
  }

  /* --- UTILITIES --- */
  .float-right {
    float: none !important;
  }

  .btn.float-right {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    text-align: center;
    float: none !important;
  }

  /* --- MOBILE GLASS NAV --- */
  .front-glass-nav-container {
    max-width: calc(100vw - 70px); /* Account for hamburger menu width */
  }

  .front-glass-nav {
    padding: 2px 4px;
    border-radius: 20px;
    width: 100%;
    background: rgba(241, 245, 249, 0.85);
  }
  
  /* --- PILL FILTER DROPDOWN MOBILE TWEAKS --- */
  .pill-filter-container {
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 2px; /* Small buffer for scroll */
  }

  .pill-filter-item {
    flex: 0 0 auto;
  }

  /* Hamburger menu active state */
  [data-widget="pushmenu"]:active i,
  [data-widget="pushmenu"]:focus i,
  body.sidebar-open [data-widget="pushmenu"] i {
    color: var(--warning) !important;
  }

  .front-glass-nav::after {
    content: "";
    min-width: 2px; /* Small buffer so last item doesn't touch the right border when scrolled */
    display: block;
  }

  .glass-nav-item {
    padding: 4px 12px;
    font-size: 0.8rem;
  }
}

/* Very small screens */
@media (max-width: 575.98px) {
  .btn-block-xs {
    display: block;
    width: 100%;
  }

  /* Stack info-box vertically on very small screens */
  .info-box {
    flex-direction: column;
    text-align: center;
  }

  .info-box .info-box-icon {
    width: 100%;
    border-radius: var(--rounded-lg) var(--rounded-lg) 0 0;
    padding: 0.75rem;
  }
}

/* --- CUSTOM STAT CARD (MOBILE) --- */
@media (max-width: 767.98px) {
  .custom-stat-card {
    padding: 1rem 1.25rem;
  }

  .stat-card-value {
    font-size: 1.2rem;
  }

  .stat-card-value.value-lg {
    font-size: 1.4rem;
  }

  .gender-progress-label {
    font-size: 0.75rem;
  }

  .chart-table-container {
    max-height: 200px;
  }
}

/* PMB Dashboard Custom Classes */
.chart-container-250 {
  position: relative;
  height: 250px;
}
.chart-container-300 {
  position: relative;
  height: 300px;
}
.chart-container-350 {
  position: relative;
  height: 350px;
}
.card-rounded-12 {
  border-radius: 12px;
  overflow: hidden;
}
.w-35-custom {
  width: 35% !important;
}
}

/* ==========================================================================
   SIDEBAR STICKY COMPONENTS (MOBILE SPECIFIC IF NEEDED)
   ========================================================================== */

.sticky-user-panel {
  position: sticky;
  top: 0;
  z-index: 1010;
  background-color: var(--white);
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  padding-top: 15px;
  border-bottom: 1px solid var(--slate-100);
}

.sticky-logout-btn {
  position: sticky;
  bottom: 0;
  z-index: 1010;
  background-color: var(--white);
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid var(--slate-100);
  margin-top: auto;
}

/* ==========================================================================
   RBAC BLUR AND PROTECTED CARD (MOBILE)
   ========================================================================== */
.content-wrapper {
  position: relative;
}

.content-wrapper.is-protected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1040;
}

.protected-warning-card {
  position: fixed;
  top: 50%;
  left: 58%;
  transform: translate(-50%, -50%);
  z-index: 1050;
  width: 90%;
  max-width: 450px;
}

@media (max-width: 767.98px) {
  /* ==========================================================================
     WELCOME PAGE OVERRIDES (MOBILE)
     ========================================================================== */

  .welcome-blend-card {
    height: auto;
    min-height: 220px;
  }
  .welcome-blend-bg {
    width: 100%;
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 30%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 30%, rgba(0, 0, 0, 0) 100%);
    opacity: 0.15;
    background-position: center top;
  }
  .welcome-blend-content {
    width: 100%;
    padding: 2rem 1.5rem;
    align-items: center;
    text-align: center;
  }
  .welcome-blend-title {
    font-size: 1.6rem;
  }
  .welcome-blend-desc {
    font-size: 1rem;
  }

  .promo-card {
    min-height: auto;
    padding: 1.5rem;
    align-items: center;
    text-align: center;
  }
  .promo-title, .promo-desc {
    max-width: 100% !important;
  }
  .promo-title {
    font-size: 1.3rem;
  }
  .promo-img-right,
  .promo-img-bottom-right {
    opacity: 0.15;
    height: 180px !important;
    right: -10px !important;
    bottom: -10px !important;
    z-index: 0;
  }
  .promo-btn {
    align-self: center;
    width: 100%;
    margin-top: 1rem;
  }

  .welcome-chip-card {
    border-radius: 20px !important; /* Slightly less rounded on mobile */
  }
  .welcome-chip-icon {
    width: 45px;
    height: 45px;
    font-size: 1.35rem;
  }
  .welcome-chip-text {
    padding: 0.5rem 0.5rem 0.5rem 0;
  }
  .welcome-chip-title {
    font-size: 0.95rem;
  }
  .welcome-chip-desc {
    display: none; /* Sembunyikan deskripsi di HP agar ringkas */
  }

} /* Akhir dari @media (max-width: 767.98px) */
