/* ===== FILE: static/css/style.css (lengkap) ===== */

/* ----------------------------
   Variabel & Reset ringan
   ---------------------------- */
:root { --header-height: 96px; --brand-blue: #001f8e; --sidebar-bg: #034d5b; --submenu-bg: #222; }
* { box-sizing: border-box; }
body.bg-beige {
    background: #f9eecf;
    font-family: Arial, Helvetica, sans-serif;
    margin: 0; }

/* ----------------------------
   Container & umum
   ---------------------------- */
.container {
    max-width: 980px;
    margin: 24px auto;
    padding-top: calc(var(--header-height) + 12px);
    box-sizing: border-box;
}

.card {
    background: rgba(255,255,255,0.7);
    border-radius:6px;
    padding:18px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.small-card {
    width:420px; 
    margin: 0 auto;
}

.medium-card {
    width:640px;
    margin: 0 auto;
}

.wide-card { 
    width:940px;
    margin: 0 auto;
}

.form-table {
    width:100%; 
    border-collapse: collapse;
}

.form-table .label { width:160px;
    padding:8px; 
    vertical-align:top; 
    font-weight:600;
}

.form-table td { 
    padding:8px;
}

.form-section {
  border: 1px solid #bbb;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  background: #fff;
}


input[type="text"], input[type="password"], textarea, select {
  width:100%; padding:8px; border:1px solid #ccc; border-radius:4px;
}

.center-row { text-align:center; padding-top:10px; }
.btn {
    background:#bfe6ff;
    border:1px solid #333;
    padding:8px 18px; border-radius:4px;
    cursor:pointer; text-decoration:none;
    color:#000;
    display:inline-block;
}

.btn-outline { 
    background:transparent;
    border:1px solid #333; padding:8px 18px;
    border-radius:4px;
    text-decoration:none;
}

.section-title { 
    text-align:center; 
    margin-bottom:12px; 
    font-weight:700; 
}

.flash { 
    background:#ffd6d6; 
    padding:8px; 
    border:1px solid #d33; 
    margin-bottom:10px; 
    border-radius:4px; 
}

/* ----------------------------
   HEADER & BRAND
   ---------------------------- */
.brand-header {
  background-color: var(--brand-blue);
  color: white;
  text-align: center;
  padding: 12px 0 8px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1200;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  box-sizing: border-box;
}

.header-top {
    display: flex;
    flex-direction: column;
    align-items: center;
}
    
.brand-title {
    color: white; font-size: 26px;
    font-weight: bold;
    margin-bottom: 6px;
}

/* baris bawah header - center untuk menu utama; username absolute kanan */
.header-bottom {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px 18px;
}
.mobile-toggle {
  font-size: 24px; background: none; border: none; color: white; cursor: pointer; display: none; margin-right: auto;
}
.brand-username {
  position: absolute; right: 18px; top: 12px; color: white; font-size: 16px; font-weight: 600; z-index: 1300;
}

@media (max-width: 860px) {
  .mobile-toggle { display: block; }
  .brand-username { position: static; margin-left: auto; }
  .brand-title { font-size: 20px; }
}

/* user dropdown */
.user-dropdown-wrapper { position: relative; display:inline-block; }
.user-btn { background: transparent; border: none; color: #fff; font-weight: 600; cursor: pointer; }
.user-dropdown {
  display: none; position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid #ddd; border-radius: 6px;
  min-width: 160px; z-index: 9999; box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.user-dropdown.show { display:block; }
.user-dropdown-item { display:block; padding:10px 12px; color:#222; text-decoration:none; }
.user-dropdown-item:hover { background:#f3f3f3; }
.divider { height:1px; background:#eee; margin:4px 0; }

/* ----------------------------
   DESKTOP MENU (top-level tetap CENTER)
   ---------------------------- */
/* root / horizontal */
.menu-root, .desktop-menu .submenu { list-style: none; margin: 0; padding: 0; }
.menu-root {
  display: flex;
  justify-content: center; /* tetap di tengah */
  gap: 12px;
  align-items: flex-start;
  padding: 0 12px;
}

/* top-level item style */
.menu-item {
  position: relative;
  background: purple;
  color: white;
  padding: 10px 14px;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
}
.menu-link, .menu-item > a {
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* top-level tetap center (inherited by menu-root) */
}

/* indikator panah untuk item yang punya children (level-1) */
.menu-item.has-children > .menu-link::after,
.menu-item.has-children > a::after {
  content: "▾"; /* panah bawah */
  font-size: 12px;
  margin-left: 6px;
  opacity: 0.95;
}

/* ----------------------------
   SUBMENU (level-1) — teks rata kiri
   ---------------------------- */
.desktop-menu .submenu {
  display: none;
  position: absolute;
  top: 100%;               /* rapat langsung ke bawah parent, tanpa jarak */
  left: 0;
  background: var(--submenu-bg);
  color: white;
  border-radius: 6px;
  min-width: 220px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  padding: 6px 0;
  z-index: 1400;
}


/* submenu items (teks rata kiri) */
.desktop-menu .submenu li { position: relative; }
.desktop-menu .submenu a {
  display: block;
  padding: 8px 16px;       /* beri padding kiri yang nyaman */
  text-align: left;        /* ⬅️ kunci: teks submenu rata kiri */
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

/* hover effect untuk submenu */
.desktop-menu .submenu a:hover { background: rgba(255,255,255,0.06); }

/* ----------------------------
   NESTED SUBMENU (level-2 & level-3)
   - buka ke kanan, indikator segitiga kanan
   - teks tetap rata kiri
   ---------------------------- */
.desktop-menu .submenu .has-children > .menu-link::after,
.desktop-menu .submenu .has-children > a::after {
  content: "▸"; /* panah kanan untuk nested */
  float: right;
  margin-left: 8px;
}

/* level-2 buka di kanan parent */
.desktop-menu .submenu .has-children > .submenu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: -1px;
  min-width: 220px;
  border-radius: 6px;
}

/* level-3 sama logikanya */
.desktop-menu .submenu .submenu .has-children > .submenu {
  left: 100%;
  top: 0;
}

/* tampilkan submenu saat hover / keyboard focus */
.menu-item:hover > .submenu,
.menu-item:focus-within > .submenu,
.submenu li:hover > .submenu,
.submenu li:focus-within > .submenu {
  display: block;
}

/* ----------------------------
   MOBILE SIDEBAR & OVERLAY
   (sidebar muncul mulai tepat di bawah header)
   ---------------------------- */
/* overlay & sidebar */
.mobile-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1190;
  display: none;
  opacity: 0;
  transition: opacity 180ms ease;
}
.mobile-overlay.show { display: block; opacity: 1; }

.mobile-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  height: calc(100% - var(--header-height));
  width: 86%;
  max-width: 360px;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 1195;
  transform: translateX(-110%);
  transition: transform 280ms ease;
  box-shadow: 6px 0 30px rgba(0,0,0,0.35);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}
.mobile-sidebar.open { transform: translateX(0); }
.mobile-sidebar-inner { padding: 18px; }
.mobile-close { background: transparent; border: 0; color: #fff; font-size: 28px; float: right; cursor: pointer; margin-top: -6px; }

/* menu */
.mobile-menu-root, .mobile-submenu { list-style: none; padding: 0; margin: 0; }
.mobile-item, .mobile-submenu li { padding: 0; }

/* style untuk <a class="mobile-link"> dan fallback untuk <a> biasa */
.mobile-link, .mobile-menu-root a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

/* default submenu tersembunyi */
.mobile-submenu { display: none; padding-left: 10px; }

/* tampilkan submenu bila li punya kelas open (mendukung mobile-item atau hanya has-children) */
.mobile-item.open > .mobile-submenu,
.has-children.open > .mobile-submenu {
  display: block;
}

/* indikator panah (menggunakan ::after pada link) */
.mobile-item.has-children > .mobile-link::after,
.has-children > .mobile-link::after {
  content: "▸";
  transition: transform 160ms ease;
  margin-left: 8px;
}
.mobile-item.open > .mobile-link::after,
.has-children.open > .mobile-link::after {
  transform: rotate(90deg);
}

/* fallback: jika <a> child tidak punya class mobile-link */
.mobile-item > a { display: flex; justify-content: space-between; align-items: center; }

/* dukungan untuk aria-hidden attribute */
.mobile-submenu[aria-hidden="true"] { display: none; }
.mobile-submenu[aria-hidden="false"] { display: block; }

/* prevent body scroll when sidebar open */
body.no-scroll { overflow: hidden; touch-action: none; }

/* responsive */
@media (max-width: 860px) {
  .desktop-menu { display: none !important; }
  .wide-card, .medium-card, .small-card { width: 96%; }
}

/* focus outline untuk aksesibilitas */
.mobile-link:focus, .mobile-menu-root a:focus {
  outline: 2px solid rgba(255,255,255,0.18);
  outline-offset: 2px;
}

/* ---------- tambahan: register small helpers (toggle eye, msg styles) ---------- */

/* samakan style untuk kedua tombol eye */
/* ------------------------------
   Toggle Eye Buttons (Show/Hide)
   ------------------------------ */
.toggle-eye,
.toggle-eye-confirm {
  position: absolute;
  right: 8px;                 /* jarak dari kanan input */
  top: 50%;                   /* vertical center */
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
  font-size: 16px;
  line-height: 1;
  background: transparent;
  border: none;               /* hilangkan border default */
  padding: 6px;               /* area klik nyaman */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: none;
}

/* fokus tetap terlihat untuk aksesibilitas — halus */
.toggle-eye:focus,
.toggle-eye-confirm:focus {
  outline: 2px solid rgba(0,0,0,0.12);
  outline-offset: 2px;
}

/* ------------------------------
   Input Password (beri ruang untuk tombol eye)
   ------------------------------ */
#pw_new_1f3,
#pw_conf_1f3 {
  padding-right: 40px;        /* cukup untuk tombol eye */
  box-sizing: border-box;     /* pastikan lebar input tetap */
}

/* beri ruang kanan pada input agar teks tidak tertutup ikon */
input[type="password"],
input[type="text"] { 
  /* HATI-HATI: ini mempengaruhi semua input; jika ingin hanya untuk password,
     gunakan selector yang lebih spesifik seperti #pw_new_1f3, #pw_conf_1f3 */
}

/* opsi: padding-right khusus untuk password inputs supaya ikon tidak menimpa */
#pw_new_1f3, #pw_conf_1f3 {
  padding-right: 48px; /* sesuaikan bila perlu */
}

.msg-ok { color: green; font-weight: 600; }
.msg-bad { color: red; font-weight: 600; }
.disabled { opacity: 0.6; pointer-events: none; }

/* ===== tambahan: kota-row agar label sejajar dengan .form-table .label ===== */
.kota-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;     /* jarak ke elemen berikutnya */
}

.kota-row label {
  width: 160px;            /* SAMAKAN dengan .form-table .label yang sudah ada */
  padding: 8px 0;          /* agar vertikal align mirip sel tabel */
  font-weight: 600;
  display: inline-block;
}

.kota-row select {
  flex: 1;                 /* ambil sisa ruang agar lebar mirip input lain */
  max-width: 100%;         /* biar responsif */
  padding: 8px;
  border:1px solid #ccc;
  border-radius:4px;
  background: white;
}

/* ===== tambahan: judul halaman register ===== */
.judul-biru {
  color: #0056b3;         /* biru elegan */
  font-weight: bold;
  text-align: center;
  margin-bottom: 4px;
  text-transform: uppercase;
  font-size: 1.6rem;      /* besar tapi tetap proporsional */
}

.subjudul {
  color: #333;
  font-size: 1.1rem;      /* sedikit lebih kecil */
  text-align: center;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

/* Batasi lebar semua input dalam form profil */
.form-table input[type="text"],
.form-table input[type="password"],
.form-table input[type="email"],
.form-table textarea,
.form-table select {
  width: 100%;
  max-width: 400px;   /* ubah sesuai selera, misal 300px atau 350px */
  box-sizing: border-box;
}

.flash {
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 4px;
  color: #fff;
  font-weight: 500;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  position: relative;
}

.flash.success { background-color: #4caf50; }
.flash.warning { background-color: #ff9800; }
.flash.danger  { background-color: #f44336; }

.flash .close-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  color: #fff;
}

#flash-messages-container {
  margin-bottom: 12px; /* jarak dari form */
}

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 500;
  color: #fff;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  font-size: 0.95rem;
}

.flash.success { background-color: #4caf50; }
.flash.warning { background-color: #ff9800; }
.flash.danger  { background-color: #f44336; }

.flash .close-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  color: #fff;
}

/* ===== CARD ===== */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 24px;
  margin: 16px auto;
  max-width: 480px;
}

.card.wide-card {
  max-width: 600px;
}

.card.medium-card {
  max-width: 480px;
}

/* ===== FORM TABLE ===== */
.form-table {
  width: 100%;
  border-collapse: collapse;
}

.form-table .label {
  width: 160px;
  vertical-align: top;
  padding: 6px 8px;
  font-weight: 600;
}

.form-table td {
  padding: 6px 8px;
}

.center-row {
  text-align: center;
  padding-top: 12px;
}

input, select, textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #007bff;
}

/* ===== TOGGLE EYE ===== */
.toggle-eye,
.toggle-eye-confirm {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
  font-size: 16px;
  line-height: 1;
  background: transparent;
  border: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: none;
}

.toggle-eye:focus,
.toggle-eye-confirm:focus {
  outline: 2px solid rgba(0,0,0,0.12);
  outline-offset: 2px;
}

/* ===== FLASH MESSAGES ===== */

#flash-messages {
  margin: 10px auto;
  max-width: 600px;
}

.flash {
  position: relative;
  padding: 10px 40px 10px 14px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 15px;
  transition: opacity 0.4s ease;
}

.flash.success { background-color: #d4edda; color: #155724; }
.flash.warning { background-color: #fff3cd; color: #856404; }
.flash.danger  { background-color: #f8d7da; color: #721c24; }

.flash-close {
  position: absolute;
  top: 6px;
  right: 10px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}


/* ===== PASSWORD INPUT ADJUSTMENT ===== */
input[type="password"] {
  padding-right: 36px; /* space untuk tombol eye */
}

/* ===== KOTA ROW ===== */
.kota-row {
  margin-bottom: 12px;
}

.kota-row label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

/* pastikan tombol berada di atas semua header/overlay */
#userBtn, .user-btn, .user-dropdown-wrapper {
  position: relative; /* atau absolute jika sesuai layout */
  z-index: 9999 !important;
  pointer-events: auto !important;
}

/* jika elemen header generik menutupi, turunkan z-indexnya */
.header-top, .brand-header, .menu-root, .menu-item {
  z-index: 10; /* pastikan lebih kecil dari 9999 */
}

/* jika ada overlay element yang sengaja menutupi, non-aktifkan pointer pada overlay */
.header-overlay, .mobile-overlay, .some-covering-element {
  pointer-events: none; /* tidak menangkap klik */
}

@media (max-width: 768px) {
  #userBtn, .user-btn, .user-dropdown-wrapper {
    z-index: 9999 !important;
    position: relative;
  }
  .header-top, .brand-header {
    z-index: 5;
  }
}

.brand-header::before,
.brand-header::after {
  pointer-events: none;
}

/* fallback anchor color */
a { color: inherit; }
