* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Nunito";
  src: url("assets/Nunito/Nunito-VariableFont_wght.ttf") format("truetype");
  font-weight: 200 1000;
  /* Range weight yang didukung variable font */
  font-style: normal;
  font-display: swap;
  /* Opsional: meningkatkan performance */
}

body {
  font-family: "Nunito", Arial, "Segoe UI", sans-serif;
  margin: 0;
  padding: 15px;
  background: #f0f2f5;
  display: flex;
  justify-content: center;
}

#landingPage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 20vh;
  text-align: center;
  background: #fff;
}

.loader {
  width: 60px;
  height: 60px;
  border: 8px solid #ddddf5;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  animation: spin 1.7s linear infinite;
  margin-top: 20px;
}

.credit {
  position: absolute;
  bottom: 15px;
  width: 100%;
  text-align: center;
  font-style: italic;
  color: #444;
  font-size: 13px;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 480px;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 20px);
  /* Pastikan card setidaknya setinggi viewport, dikurangi padding body */
}

.card::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -100px;
  width: 350px;
  height: 350px;
  background-image: url("assets/images/logo pbi.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.card>* {
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

.cardHeader {
  position: relative;
  margin-bottom: 15px;
  /* padding: 8px 40px; */
  padding: 10px;
  display: flex;
  align-items: center;
  /* judul ditengah */
  justify-content: center;
  min-height: 50px;
}

.cardHeader h2 {
  text-align: center;
  margin: 0;
  font-size: 1.3rem;
  flex-grow: 1;
  /* Memberi ruang agar teks memenuhi area tengah */
}

.btn-back {
  position: absolute;
  /* Keluar dari aliran dokumen agar tidak mendorong judul */
  left: 0;
  /* Tempel di kiri parent */
  width: auto;
  /* Override width 100% dari CSS global */
  padding: 5px 12px;
  background: #007bffd2;
  font-size: 16px;
  z-index: 10;
  /* Pastikan di atas elemen lain */
}

.debug-ribbon {
  height: 14px;
  position: fixed;
  top: 13px;
  right: -50px;
  z-index: 9999;
  background: rgb(182, 0, 0);
  padding: 0 50px;
  transform: rotate(45deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

#debugText {
  font-family: Arial, Helvetica, sans-serif;
  color: white;
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 1px;
}

.secNikContainer {
  margin-top: 35vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* #logoMAT,
#tulisanMAT {
  height: auto;
} */

#logoMAT {
  width: 60%;
}

#tulisanMAT {
  width: 80%;
}

#secNik {
  margin-top: 30px;
  margin-left: 40px;
  margin-right: 40px;
  background: #d6e8ffd5;
  box-shadow: 1px 1px 7px 2px rgba(0, 0, 0, 0.2);
  padding: 30px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.formRow {
  display: flex;  
  gap: 10px;
  /* Jarak antara dua input */
  width: 100%;  
}

.formRow100 {
  display: flex;
  gap: 10px;
  /* Jarak antara dua input */
  width: 100%;
}

.formRow .formGroup {
  flex: 1 1 0;
  /* Basis 0 agar bisa shrink dan share space equal */
  min-width: 0;
  /* Cegah overflow dari child elements */
}

.formGroup {
  flex: 1 1 auto;
  /* Auto basis untuk standalone formGroup */
  margin-bottom: 15px;
}

/*       .formGroup25 {
        flex: 0 0 25%;
        margin-bottom: 15px;
      }

      .formGroup75 {
        flex: 0 0 75%;
        margin-bottom: 15px;
      } */

.formGroup25 {
  flex: 4;
  margin-bottom: 15px;
}

.formGroup75 {
  flex: 6;
  margin-bottom: 15px;
}

#userInfo {
  background: #eaf3ffd5;
  box-shadow: 1px 1px 7px 2px rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 50px;
}

label {
  font-size: 14px;
  font-weight: bold;
  display: block;
  margin-bottom: 5px;
}

input,
button,
select {
  font-family: "Nunito", Arial, "Segoe UI", sans-serif;
  font-size: 16px;
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

#inputNik {
  font-size: 20px;
  font-weight: bold;
  text-align: center;

  &:focus {
    border-color: #007bffd2;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
  }

  &::placeholder {
    font-size: 14px;
    font-weight: normal;
    text-align: left;
  }

  &:focus::placeholder {
    color: transparent;
  }
}

button {
  background: #007bffd2;
  border: none;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

/* ===== CARD CHECKLIST ITEM ===== */
.check-item {
  border: 1px solid #ddd;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
/*     background-color 0.3s,
    border-color 0.3s; */
  cursor: pointer;
}

.check-item.good {
  background: #e2f5e9 !important;
  border-color: #28a745 !important;
  color: #155724;
}

.check-item.bad {
  background: #f8d7da !important;
  border-color: #dc3545 !important;
  color: #721c24;
}

.check-item label {
  font-weight: bold;
  margin-bottom: 6px;
  display: block;
}

.check-item textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
}

.check-item.collapsed .check-content {
  display: none;
}

.check.item.collapsed .item-label {
  margin-bottom: 0;
}

.check-item.collapsed::after {
  content: "↩ (Klik untuk ubah)";
  font-size: 11px;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
}

/* ===== TIRE INSPECTION STYLES ===== */
.truck-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 20px auto auto auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  height: 500px;
}

.tire-input-wrapper {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 60px;
}

.tire-input-wrapper input {
  width: 100%;
  padding: 5px;
  font-size: 12px;
  text-align: center;
  border: 2px solid #007bffd2;
  background: rgba(255, 255, 255, 0.9);
}

.tire-input-wrapper label {
  font-size: 10px;
  margin-bottom: 2px;
  background: #333;
  color: white;
  padding: 0 4px;
  border-radius: 3px;
}

/* Posisi Ban TM */
.pos-fl {
  top: 45px;
  left: 10%;
}

.pos-fr {
  top: 45px;
  right: 10%;
}

.pos-mol {
  top: 310px;
  left: 0%;
}

.pos-mil {
  top: 310px;
  left: 25%;
}

.pos-mir {
  top: 310px;
  right: 25%;
}

.pos-mor {
  top: 310px;
  right: 0%;
}

.pos-rol {
  top: 420px;
  left: 0%;
}

.pos-ril {
  top: 420px;
  left: 25%;
}

.pos-rir {
  top: 420px;
  right: 25%;
}

.pos-ror {
  top: 420px;
  right: 0%;
}

/* Posisi Ban WL */
.wl-fl {
  top: 170px;
  left: 10%;
}

.wl-fr {
  top: 170px;
  right: 10%;
}

.wl-rl {
  top: 330px;
  left: 10%;
}

.wl-rr {
  top: 330px;
  right: 10%;
}

/* ===== LOADER OVERLAY ===== */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-overlay.hidden {
  display: none;
}

.loader-box {
  background: #fff;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid #2a7cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== SUCCESS CARD ===== */
.success-card {
  text-align: center;
  max-width: 420px;
}

.success-card h2 {
  color: #2e7d32;
  margin-bottom: 20px;
}

.success-card p {
  font-size: 16px;
  line-height: 1.5;
  color: #444;
}

.success-actions {
  margin-top: 25px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

.btn-primary,
.btn-secondary {
  background: #2a7cff;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
}

/*     .btn-secondary {
      background: #eee;
      border: none;
      padding: 10px 18px;
      border-radius: 8px;
      cursor: pointer;
    } */

.btn-primary:hover,
.btn-secondary:hover {
  opacity: 0.9;
}

/*     .btn-secondary:hover {
      background: #ddd;
    } */


  /* Menargetkan div pembungkus agar scrollbar selalu terlihat di perangkat berbasis WebKit (iOS & Android) */
  .custom-scroll::-webkit-scrollbar {
    -webkit-appearance: none;
    height: 7px; /* Mengatur tinggi scrollbar horizontal */
  }

  /* Mengatur tampilan track (jalur) scrollbar */
  .custom-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
  }
  
  /* Mengatur tampilan thumb (batang geser) scrollbar */
  .custom-scroll::-webkit-scrollbar-thumb {
    background: #888; 
    border-radius: 4px;
  }

  /* Efek ketika thumb scrollbar ditekan */
  .custom-scroll::-webkit-scrollbar-thumb:hover {
    background: #555; 
  }


    
/* Responsive: stack jadi vertikal di layar kecil */
@media (max-width: 359px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }

  .stat-card {
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  }

  .stat-card:last-child {
    border-bottom: none;
  }

  /*       #summaryTable .stat-cards {
        top: 32px;
      } */

  #summaryTableWrapper .stat-cards {
    top: 34px;
    /* adjust untuk mobile */
  }

  #summaryTableWrapper>div:last-child {
    max-height: 350px;
    /* lebih pendek di mobile */
  }
}

/* ── formRow tidak dipaksakan sejajar di layar sangat kecil ── */
@media (max-width: 359px) {
  body {
    padding: 8px;
  }

  .card {
    padding: 14px 12px;
    min-height: unset;
  }

  .cardHeader h2 {
    font-size: 1rem;
  }

  /* Stack formRow jadi vertikal */
  .formRow {
    flex-direction: column;
    gap: 0;
  }

  input,
  select,
  button {
    font-size: 14px;
    padding: 9px 8px;
  }

  #summaryTable table {
    font-size: 11px;
  }

  #summaryTable th,
  #summaryTable td {
    padding: 5px 4px !important;
  }

  .truck-container {
    height: 380px;
  }

  .tire-input-wrapper {
    width: 50px;
  }
}

/* ── HP normal (360–479px) ── */
@media (min-width: 360px) and (max-width: 479px) {
  body {
    padding: 10px;
  }

  .card {
    padding: 16px 14px;
  }

  #summaryTable table {
    font-size: 12px;
  }

  #summaryTable th,
  #summaryTable td {
    padding: 6px 5px !important;
  }
}

/* ── Tablet kecil / HP landscape (480–767px) ── */
@media (min-width: 480px) and (max-width: 767px) {
  body {
    padding: 15px;
  }

  .card {
    max-width: 100%;
    padding: 20px 18px;
  }

  #summaryTable table {
    font-size: 13px;
  }
}

/* ── Tablet / desktop (>= 768px) ── */
@media (min-width: 768px) {
  body {
    padding: 24px;
    align-items: flex-start;
  }

  .card {
    max-width: 600px;
    padding: 28px 24px;
  }

  .cardHeader h2 {
    font-size: 1.35rem;
  }

  input,
  select,
  button {
    font-size: 15px;
  }

  #summaryTable table {
    font-size: 14px;
  }

  #summaryTable th,
  #summaryTable td {
    padding: 10px 9px !important;
  }

  .truck-container {
    height: 520px;
  }

  .tire-input-wrapper {
    width: 65px;
  }

  .check-item {
    padding: 14px;
  }
}

/* ── Desktop lebar (>= 1024px) ── */
@media (min-width: 1024px) {
  .card {
    max-width: 680px;
  }
}

/* ── Orientasi landscape di HP ── */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding: 8px;
    align-items: flex-start;
  }

  .card {
    min-height: unset;
  }

  #landingPage {
    padding-top: 10vh;
  }

  .truck-container {
    height: 340px;
  }
}

/* ── Touch device: area sentuh lebih besar ── */
@media (hover: none) and (pointer: coarse) {
  button {
    min-height: 44px;
  }

  input,
  select {
    min-height: 44px;
  }
}