/* ============================================================
   RESPONSIVE.CSS — Fluid typography & mobile hardening
   rakernas.pks.biz.id | Generated 2026-05-16
   Breakpoints: xs<576  sm≥576  md≥768  lg≥992  xl≥1200
   ============================================================ */

/* ── 1. Fluid base font & custom props ────────────────────── */
:root {
  /* clamp(min, preferred, max) — scales smoothly between breakpoints */
  --fs-xs:   clamp(0.68rem, 1vw + 0.5rem,  0.78rem);
  --fs-sm:   clamp(0.78rem, 1.1vw + 0.55rem, 0.88rem);
  --fs-base: clamp(0.85rem, 1.2vw + 0.6rem,  1rem);
  --fs-md:   clamp(0.95rem, 1.4vw + 0.65rem, 1.1rem);
  --fs-lg:   clamp(1.05rem, 1.8vw + 0.7rem,  1.3rem);
  --fs-xl:   clamp(1.2rem,  2.5vw + 0.8rem,  1.8rem);
  --fs-2xl:  clamp(1.4rem,  3.5vw + 0.9rem,  2.5rem);
  --fs-3xl:  clamp(1.6rem,  5vw + 1rem,     3.5rem);
}

/* ── 2. Prevent horizontal scroll on all screens ─────────── */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

.wrapper,
.content-wrapper,
.container-fluid {
  overflow-x: hidden;
}

/* ── 3. Navbar brand text — truncate on narrow screens ───── */
.navbar-brand .brand-text {
  display: inline-block;
  vertical-align: middle;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .navbar-brand .brand-text {
    max-width: 180px;
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .navbar-brand .brand-text {
    max-width: 120px;
    font-size: 0.78rem;
  }
}

@media (max-width: 360px) {
  .navbar-brand .brand-text {
    display: none;
  }
}

/* ── 4. Tables — always scrollable on mobile ─────────────── */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}

/* Auto-wrap bare tables not already inside .table-responsive */
@media (max-width: 767px) {
  .card-body > table,
  .content > table,
  .tab-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Ensure table text wraps rather than forcing width */
.content td,
.content th {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* On xs: collapse fixed-width table columns */
@media (max-width: 575px) {
  table th,
  table td {
    font-size: 0.76rem;
    padding: 0.4em 0.5em;
  }
}

/* ── 5. Scale down large UI utility font classes on mobile ── */
@media (max-width: 575px) {
  .ui-fs-5r  { font-size: 2.5rem !important; }
  .ui-fs-3r  { font-size: 1.8rem !important; }
  .ui-fs-2e  { font-size: 1.4em  !important; }
  .ui-fs-15r,
  .ui-fs-15r-imp { font-size: 1.1rem !important; }
  .ui-fs-13r { font-size: 1.05rem !important; }
  .ui-fs-12r,
  .ui-fs-12e { font-size: 0.98rem !important; }
  .ui-fs-11r,
  .ui-fs-11e { font-size: 0.94rem !important; }
  .ui-fs-1r,
  .ui-fs-1e  { font-size: 0.9rem  !important; }
}

/* ── 6. Fluid font for large data numbers / big headings ──── */
/* These classes are used in stats/charts to show big figures */
.ui-badge-tomato { font-size: clamp(1.2rem, 4vw + 0.8rem, 2rem) !important; }
.ui-badge-orange { font-size: clamp(0.9rem, 2vw + 0.6rem, 1.2em) !important; }
.ui-fs-3r        { font-size: clamp(1.8rem, 4vw + 1rem, 3rem) !important; }
.ui-fs-5r        { font-size: clamp(2.5rem, 6vw + 1.2rem, 5rem) !important; }

/* ── 7. Charts — responsive height ───────────────────────── */
.ui-chart-500 {
  height: clamp(240px, 40vh, 500px) !important;
  width: 100% !important;
}

@media (max-width: 575px) {
  .ui-chart-500 { height: 240px !important; }
}

/* ── 8. Fixed-pixel widths — allow auto on xs ────────────── */
@media (max-width: 575px) {
  .ui-w-150,
  .ui-w-120,
  .ui-w-100px,
  .ui-w-160px,
  .ui-w-200px {
    width: auto !important;
  }

  .ui-mw-200,
  .ui-mw-240,
  .ui-mw-250,
  .ui-mw-210,
  .ui-mw-150 {
    min-width: 0 !important;
    width: auto !important;
  }
}

/* ── 9. Fixed heights — allow scroll on mobile ───────────── */
@media (max-width: 575px) {
  .ui-h-500 {
    height: auto !important;
    max-height: 350px !important;
    overflow-y: auto !important;
  }

  .ui-h-350 {
    height: auto !important;
    max-height: 300px !important;
    overflow-y: auto !important;
  }

  .ui-h-300 {
    height: auto !important;
    max-height: 280px !important;
    overflow-y: auto !important;
  }

  .ui-progbar-track,
  .ui-progbar-25 {
    height: 14px !important;
  }
}

/* ── 10. Card hover — disable on touch-only devices ─────── */
@media (hover: none) {
  .card:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .news-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* ── 11. WELCOME PAGE — hero ─────────────────────────────── */

/* Fluid hero title using clamp */
.hero-title {
  font-size: clamp(1.15rem, 3.5vw + 0.5rem, 1.8rem) !important;
  line-height: 1.25;
}

.hero-subtitle {
  font-size: clamp(0.8rem, 1.5vw + 0.5rem, 1rem) !important;
}

.stat-num {
  font-size: clamp(1.1rem, 3vw + 0.5rem, 1.5rem) !important;
}

/* Hero row: stack on phone */
@media (max-width: 575px) {
  .welcome-hero {
    padding: 16px 14px !important;
  }

  .welcome-hero .d-flex.align-items-center {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .hero-logo {
    height: 56px !important;
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
  }
}

/* On 576-767px: keep row but reduce padding */
@media (min-width: 576px) and (max-width: 767px) {
  .welcome-hero {
    padding: 20px 18px !important;
  }

  .hero-logo {
    height: 72px !important;
  }
}

/* ── 12. WELCOME PAGE — stats strip 2×2 on phone ─────────── */
@media (max-width: 575px) {
  .stats-strip {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 10px 6px;
  }

  .stat-item {
    min-width: 0 !important;
    padding: 8px 6px;
  }

  /* remove vertical dividers inside grid */
  .stat-item + .stat-item::before {
    display: none !important;
  }

  .stat-label {
    font-size: 0.68rem;
    letter-spacing: 0.3px;
  }
}

/* ── 13. WELCOME PAGE — GPGG card ───────────────────────── */
@media (max-width: 575px) {
  .gpgg-card .gpgg-header h3 {
    font-size: clamp(0.95rem, 3vw + 0.5rem, 1.2rem);
  }

  .gpgg-card .gpgg-header p {
    font-size: 0.8rem;
  }

  .feature-item h6 {
    font-size: 0.82rem;
  }

  .feature-item p {
    font-size: 0.75rem;
  }
}

/* ── 14. WELCOME PAGE — login panel ─────────────────────── */
@media (max-width: 575px) {
  .login-panel .login-panel-header h4 {
    font-size: 1rem;
  }

  .login-panel .login-panel-header p {
    font-size: 0.8rem;
  }

  .login-panel .login-logo {
    height: 56px !important;
  }
}

/* ── 15. WELCOME PAGE — news section ─────────────────────── */
.news-title {
  font-size: clamp(0.95rem, 2vw + 0.6rem, 1.1rem) !important;
}

@media (max-width: 767px) {
  .news-headline {
    min-height: 0 !important;
    font-size: 0.88rem;
  }

  .news-image-wrap {
    height: 120px !important;
  }

  .news-body {
    padding: 10px 11px 12px;
    gap: 6px;
  }

  .news-time {
    font-size: 0.75rem;
  }
}

@media (max-width: 575px) {
  .news-grid {
    padding: 10px 8px;
  }

  .news-grid .col-md-6 {
    padding-left: 5px;
    padding-right: 5px;
  }

  .news-shell .card-header {
    padding: 12px;
  }

  .news-empty {
    margin: 10px;
    padding: 14px;
  }
}

/* ── 16. Forms — prevent iOS auto-zoom on focus ──────────── */
@media (max-width: 575px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important; /* iOS zooms in if < 16px */
  }
}

/* ── 17. Footer ───────────────────────────────────────────── */
@media (max-width: 575px) {
  .main-footer {
    font-size: 0.8rem;
    text-align: center;
  }

  .main-footer .float-right {
    float: none !important;
    display: block;
    margin-top: 4px;
  }
}

/* ── 18. Buttons — minimum tap target 44px on touch ─────── */
@media (max-width: 767px) {
  .btn {
    min-height: 36px;
  }

  .btn-sm {
    min-height: 30px;
  }
}

/* ── 19. Dropdown menus — full-width on xs ───────────────── */
@media (max-width: 575px) {
  .dropdown-menu {
    width: 100%;
    min-width: unset;
  }
}

/* ── 20. Admin table: dataTables controls stack on xs ────── */
@media (max-width: 575px) {
  div.dataTables_wrapper div.dataTables_length,
  div.dataTables_wrapper div.dataTables_filter {
    text-align: left;
    margin-bottom: 6px;
  }

  div.dataTables_wrapper div.dataTables_filter input {
    width: 100%;
    display: block;
  }

  div.dataTables_wrapper div.dataTables_info,
  div.dataTables_wrapper div.dataTables_paginate {
    font-size: 0.78rem;
  }
}

/* ── 21. Miscellaneous: images never overflow ─────────────── */
img {
  max-width: 100%;
  height: auto;
}

/* ── 22. Layout Top-Nav padding on xs ───────────────────── */
@media (max-width: 575px) {
  .layout-top-nav .content {
    padding: 8px 0;
  }
}

/* ── 23. Word overflow safety net ────────────────────────── */
h1, h2, h3, h4, h5, h6,
p, span, label, a, td, th, li {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ── 24. Tablet optimizations (768–991px) ────────────────── */
@media (min-width: 768px) and (max-width: 991px) {
  .welcome-hero {
    padding: 24px 20px !important;
  }

  .stat-item {
    min-width: 90px;
  }

  .hero-logo {
    height: 76px !important;
  }

  .news-image-wrap {
    height: 140px !important;
  }
}
