/* ============================================================
   MOBILE OPTIMIZATION – Tambahan CSS untuk HP
   Website Database Keamanan Penerbangan – OTBAN Wilayah VII
   ============================================================ */

/* ── Bottom Navigation Bar (Mobile Only) ─────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  border-top: 1px solid var(--neutral-100);
  z-index: 1100;
  box-shadow: 0 -4px 20px rgba(0,35,96,.10);
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--neutral-400);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  flex: 1;
  max-width: 80px;
  min-width: 0;
}

.bottom-nav-item i {
  font-size: 20px;
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--primary);
  background: rgba(0,53,128,.08);
}

.bottom-nav-item:hover {
  color: var(--primary);
}

.bottom-nav-item span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ── Mobile Header ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-header {
    padding: 0 14px;
    height: 56px;
  }

  .header-page-title { font-size: 14px; }
  .header-page-subtitle { font-size: 10px; }
  
  .header-user {
    padding: 6px 8px;
    gap: 6px;
  }
  
  .header-user-avatar {
    width: 32px;
    height: 32px;
  }

  /* ── Page body padding untuk bottom nav ────────────────── */
  .page-body {
    padding: 14px 14px 84px;
  }

  /* ── Bottom Nav ───────────────────────────────────────── */
  .bottom-nav {
    display: flex;
  }

  /* ── Stats Cards ─────────────────────────────────────── */
  .stat-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 16px;
  }

  .row.g-3 .card.p-3 {
    padding: 10px 10px !important;
    gap: 8px !important;
  }

  .row.g-3 [style*="font-size:22px"] {
    font-size: 18px !important;
  }

  /* ── Section Divider ─────────────────────────────────── */
  .section-divider {
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0 14px;
  }

  .section-divider-title {
    font-size: 13px;
  }

  /* ── Personel Grid – 2 kolom rapi ───────────────────── */
  .personel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .personel-card {
    padding: 14px 10px;
    gap: 6px;
  }

  .personel-avatar {
    width: 56px;
    height: 56px;
  }

  .personel-name {
    font-size: 12px;
    line-height: 1.3;
  }

  .personel-jabatan {
    font-size: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .duty-badge {
    font-size: 9.5px;
    padding: 3px 8px;
  }

  /* ── Tools Grid – 1 kolom ───────────────────────────── */
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tool-card {
    padding: 14px;
    gap: 10px;
  }

  /* ── Team Grid – 2 kolom ────────────────────────────── */
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .team-card-top {
    padding: 16px 12px 12px;
  }

  .team-avatar {
    width: 64px;
    height: 64px;
  }

  .team-name { font-size: 13px; }
  .team-jabatan { font-size: 11px; }
  .team-nip { font-size: 10px; }

  .team-card-actions a {
    padding: 10px 6px;
    font-size: 11px;
  }

  /* ── Table – scroll horizontal ───────────────────────── */
  .table-wrapper {
    border-radius: 10px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table thead th {
    padding: 10px 12px;
    font-size: 10px;
  }

  .data-table tbody td {
    padding: 10px 12px;
  }

  /* ── Page Header ─────────────────────────────────────── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header .d-flex {
    width: 100%;
  }

  .page-title { font-size: 18px; }
  .page-sub { font-size: 12px; }

  /* ── Search Bar full width ───────────────────────────── */
  .search-bar {
    width: 100%;
    min-width: unset !important;
  }

  /* ── Form Row ────────────────────────────────────────── */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* ── Modal ───────────────────────────────────────────── */
  .modal-box {
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    margin-top: auto;
    margin-bottom: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100% !important;
    transform: translateY(100%);
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay.active .modal-box {
    transform: translateY(0);
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-body {
    padding: 16px 20px;
  }

  .modal-footer {
    padding: 12px 20px;
  }

  /* ── DB Tabs ─────────────────────────────────────────── */
  .db-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .db-tab {
    padding: 7px 12px;
    font-size: 11.5px;
  }

  /* ── Buttons ─────────────────────────────────────────── */
  .btn {
    font-size: 13px;
    padding: 8px 16px;
  }

  .btn-sm {
    font-size: 11.5px;
    padding: 5px 10px;
  }

  /* ── Profile Detail ──────────────────────────────────── */
  .profile-detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* ── Pagination ──────────────────────────────────────── */
  .pagination-wrapper {
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    text-align: center;
  }
}

/* ── Very Small Screens (< 380px) ─────────────────────────── */
@media (max-width: 380px) {
  .personel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .personel-avatar {
    width: 48px;
    height: 48px;
  }

  .personel-name { font-size: 11px; }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav-item {
    padding: 6px 8px;
  }
}

/* ── Touch improvements ────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .nav-item { padding: 13px 14px; }
  
  /* Remove hover transforms on touch devices */
  .personel-card:hover,
  .team-card:hover,
  .tool-card:hover,
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  /* Faster transitions for mobile */
  :root { --transition: all .15s ease; }
}

/* ── Safe Area untuk notch/rounded corners ─────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  @media (max-width: 768px) {
    .page-body {
      padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }
  }
}
