:root {
  --brand-1: #38bdf8;
  --brand-2: #1d4ed8;
  --brand-3: #0a3aa8;
  --accent: #14b8a6;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e8eef6;
  --bg: #eef4fb;
  --card: #ffffff;
  --radius: 20px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* pastikan atribut [hidden] tetap menang atas display:flex/block di bawah */
[hidden] {
  display: none !important;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background: linear-gradient(180deg, #eaf2fd 0%, #f4f7fb 100%);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* cegah geser horizontal; tabel lebar tetap scroll di dalam .table-wrap */
}

/* ===== HERO ===== */
.hero {
  position: relative;
  background:
    linear-gradient(
      135deg,
      rgba(56, 189, 248, 0.72) -10%,
      rgba(29, 78, 216, 0.8) 55%,
      rgba(10, 58, 168, 0.88) 120%
    ),
    url("img/hero-bg.png") center 60% / cover no-repeat;
  color: #fff;
  padding: 44px 20px 84px;
  overflow: hidden;
}
.hero::before {
  /* pola halus */
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      600px 240px at 85% -10%,
      rgba(255, 255, 255, 0.18),
      transparent 60%
    ),
    radial-gradient(
      480px 220px at 5% 0%,
      rgba(255, 255, 255, 0.1),
      transparent 60%
    );
  pointer-events: none;
}
.hero-inner {
  max-width: 1200px;
  margin: auto;
  position: relative;
  z-index: 1;
}

/* ===== INSTANSI BAR (logo resmi + nama instansi) ===== */
.instansi-bar {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: 22px;
  box-shadow: 0 8px 20px rgba(2, 20, 60, 0.18);
}
.instansi-item {
  display: flex;
  align-items: center;
  gap: 9px;
}
.instansi-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}
.instansi-text {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: #0f172a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  flex-shrink: 0;
  box-shadow: 0 10px 26px rgba(2, 20, 60, 0.35);
  background: rgba(255, 255, 255, 0.12);
}
.brand-text h1 {
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-shadow: 0 2px 14px rgba(2, 20, 60, 0.35);
}
.brand-text p {
  margin-top: 6px;
  font-size: clamp(14px, 1.6vw, 17px);
  opacity: 0.92;
  text-shadow: 0 1px 10px rgba(2, 20, 60, 0.3);
}
.hero-wave {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 80px;
  display: block;
}
.hero-wave path {
  fill: var(--bg);
}

/* ===== CONTAINER ===== */
.container {
  width: 92%;
  max-width: 1200px;
  margin: -46px auto 0;
  position: relative;
  z-index: 2;
  padding-bottom: 40px;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.14);
}
.stat-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, white);
}
.stat-icon svg {
  width: 26px;
  height: 26px;
}
.stat-value {
  display: block;
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}
.stat-label {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

/* ===== FORM ===== */
.search-box {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}
.form-group select,
.form-group input {
  padding: 12px 13px;
  border: 1.5px solid #dbe4ef;
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}
.field-hint {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-2);
  min-height: 14px;
}
.search-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.btn-search {
  flex: 1;
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  color: #fff;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.28);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}
.btn-search:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 16px 30px rgba(29, 78, 216, 0.34);
}
.btn-search:active {
  transform: translateY(0);
}
.btn-reset {
  padding: 14px 22px;
  border: 1.5px solid #dbe4ef;
  border-radius: 12px;
  background: #fff;
  color: #475569;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
.btn-reset:hover {
  background: #f1f5f9;
  border-color: #c7d3e2;
}

/* ===== CONTENT GRID ===== */
.content-grid {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 26px;
  align-items: start;
}
/* biar grid item bisa menyusut & tabel lebar men-scroll di dalam kotaknya, bukan mendorong lebar halaman */
.content-grid > * {
  min-width: 0;
}

.schedule-section,
.poster-section {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 20px;
  color: var(--brand-3);
  font-weight: 800;
}
.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(14, 165, 233, 0.08),
    rgba(99, 102, 241, 0.08)
  );
}
.schedule-actions h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--brand-3);
}
.schedule-actions p {
  margin: 0;
  font-size: 13px;
  color: #475569;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--brand-2);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.btn-action:hover {
  transform: translateY(-1px);
}
.result-count {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-2);
  background: rgba(29, 78, 216, 0.1);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ===== TABEL ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 14px 18px;
  white-space: nowrap;
}
tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14.5px;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:nth-child(even) td {
  background: #fbfdff;
}
tbody tr:hover td {
  background: #f0f6ff;
}

/* lebar kolom: Rute | Kapal | Jam | Penumpang */
thead th:nth-child(1),
tbody td:nth-child(1) {
  width: 28%;
}
thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 40%;
}
thead th:nth-child(3),
tbody td:nth-child(3) {
  width: 16%;
}
thead th:nth-child(4),
tbody td:nth-child(4) {
  width: 16%;
}

/* sel Rute */
.rute-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rute-path {
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rute-path .arrow {
  color: var(--accent);
  font-weight: 800;
}
.arah-badge {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.arah-Berangkat {
  background: rgba(20, 184, 166, 0.14);
  color: #0f766e;
}
.arah-Kembali {
  background: rgba(99, 102, 241, 0.14);
  color: #4338ca;
}
.catatan {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* chip kapal + badge hari */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.kapal-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f3f7fd;
  border: 1px solid #e3ecf8;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.hari-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  white-space: nowrap;
}
.hari-setiap-hari {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}
.hari-rabu {
  background: rgba(37, 99, 235, 0.15);
  color: #1d4ed8;
}
.hari-senin {
  background: rgba(139, 92, 246, 0.16);
  color: #6d28d9;
}
.hari-selasa {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

/* kapal yang tidak beroperasi pada tanggal/hari yang difilter -> dipudarkan, bukan disembunyikan */
.kapal-chip.chip-muted {
  opacity: 0.42;
  filter: grayscale(0.4);
}

/* chip jam & penumpang */
.jam-chip {
  display: inline-block;
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}
.pnp-chip {
  display: inline-block;
  background: #eef2f7;
  color: #475569;
  padding: 4px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
}

/* baris kosong */
.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 34px 18px;
  font-size: 14.5px;
}

/* ===== STATE: loading / error ===== */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 52px 20px;
  color: var(--muted);
  text-align: center;
}
.state p {
  font-size: 15px;
}
.state-emoji {
  font-size: 34px;
}
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(29, 78, 216, 0.18);
  border-top-color: var(--brand-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== INFO KESELAMATAN ===== */
.poster-section h2 {
  font-size: 20px;
  color: var(--brand-3);
  font-weight: 800;
  margin-bottom: 8px;
}
.section-text {
  color: #475569;
  line-height: 1.7;
  margin-bottom: 14px;
  font-size: 14px;
}
.gallery-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 70vh;
  padding-right: 4px;
}
.gallery-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.gallery-image,
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  background: #f8fbff;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.gallery-image:hover,
.gallery-item img:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.image-modal[hidden] {
  display: none;
}
.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(2px);
}
.image-modal-content {
  position: relative;
  max-width: min(92vw, 980px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.image-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
body.modal-open {
  overflow: hidden;
}
.gallery-scroll::-webkit-scrollbar {
  width: 9px;
}
.gallery-scroll::-webkit-scrollbar-thumb {
  background: rgba(29, 78, 216, 0.3);
  border-radius: 999px;
}
.gallery-scroll::-webkit-scrollbar-track {
  background: rgba(29, 78, 216, 0.07);
  border-radius: 999px;
}

/* ===== FOOTER ===== */
footer {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  color: #fff;
  text-align: center;
  padding: 22px;
  margin-top: 44px;
  font-size: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .poster-section {
    order: 2;
  }
}
@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .brand-logo {
    width: 54px;
    height: 54px;
  }
  .schedule-section,
  .poster-section,
  .search-box {
    padding: 18px;
  }
  .container {
    width: 94%;
  }
}
@media (max-width: 480px) {
  .hero {
    padding: 34px 16px 74px;
  }
  .btn-search,
  .btn-reset {
    width: 100%;
    flex: none;
  }
  .instansi-bar {
    gap: 12px;
    padding: 8px 12px;
  }
  .instansi-logo {
    width: 26px;
    height: 26px;
  }
  .instansi-text {
    font-size: 10px;
  }
}
