/* KTP style.css | Semua warna + bentuk website | Lokasi net-tool/static/style.css */
/* File apa: CSS-nya NET-TOOL, yang ngatur warna, kotak bulat, sidebar, form, tombol */
/* Fungsi: Biar semua halaman tampilannya sama, tidak perlu tulis style di tiap HTML */
/* Route: Tidak punya route, di-load dari base.html lewat link /static/style.css */
/* Konsep: 1 CSS dipakai semua halaman. Mau ganti warna, edit sini saja, semua ikut berubah */
/* Kalau error: Website jadi polos, tidak ada warna, tidak ada kotak bulat */
/* Kapan edit: Mau ganti warna, ganti bulat, ganti jarak, ganti bentuk form, edit sini */
/* Aturan tertib: 1 class cuma 1x di file ini. Kalau mau ubah, ubah di tempatnya, jangan tambah lagi di bawah. Urutan dari atas ke bawah: DASAR, LAYOUT, SIDEBAR, BREADCRUMB, KOTAK, FORM, KARTU, HP */

:root { --card-bg: #1E293B; --card-text: #F1F5F9; --input-bg: #0F172A; }

/* DASAR */
* { box-sizing: border-box; }
body { overflow-x: hidden; background: #0b1220; color: white; font-family: 'Segoe UI', sans-serif; font-size: clamp(14px, 0.9vw, 16px); margin: 0; padding: 0; }
h1 { margin-top: 0; font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.85rem); }

/* LAYOUT: KIRI + KANAN SEIMBANG */
.layout { display: flex; width: 100%; min-height: 100vh; min-width: 0; }
.page { flex: 1; width: auto; max-width: none; min-width: 0; min-height: 100vh; margin: 0; padding: clamp(16px, 3vw, 32px); overflow-x: hidden; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; transition: padding 0.2s ease; }

/* SIDEBAR */
.sidebar { position: relative; z-index: 2; width: var(--sidebar-width, 280px); flex: 0 0 var(--sidebar-width, 280px); min-width: 0; min-height: 100vh; max-height: 100vh; overflow-x: hidden !important; overflow-y: auto; background: #111c33; padding: 28px 16px; border-right: 0; transition: width 0.2s ease, flex-basis 0.2s ease, padding 0.2s ease; }
.sidebar-header { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; padding-bottom: 44px; }
.sidebar h2 { display: flex; flex: 0 1 auto; align-items: center; justify-content: center; gap: 6px; min-width: 0; margin: 0; font-size: 22px; }
.sidebar-brand-icon { flex: 0 0 auto; }
.sidebar-toggle { position: absolute; top: 38px; right: 0; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: #e2e8f0; font-size: 18px; cursor: pointer; }
.sidebar-toggle:hover { background: #0b1220; color: #38bdf8; }
.sidebar-sub { color: #94a3b8; font-size: 12px; margin: 6px 0 24px 0; }
.sidebar-label { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-header h2 .sidebar-label { flex: 1; }
.menu-home { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; color: white; text-decoration: none; padding: 12px 16px; border-radius: 12px; background: #0b1220; margin-bottom: 12px; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-icon { display: inline-flex; flex: 0 0 22px; align-items: center; justify-content: center; }
.sidebar details { display: block; width: 100%; min-width: 0; position: relative; overflow: hidden; border-left: 1px solid #334155; }
.sidebar details summary { display: block; width: 100%; min-width: 0; overflow: hidden; cursor: pointer; padding: 12px 32px 12px 12px; border-radius: 12px; font-weight: bold; list-style: none; position: relative; white-space: nowrap; text-overflow: ellipsis; }
.sidebar details summary::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%) rotate(90deg); font-size: 20px; color: #94a3b8; transition: transform 0.2s; font-weight: bold; }
.sidebar details[open] summary::after { transform: translateY(-50%) rotate(0deg); color: #38bdf8; }
.sidebar details summary:hover { background: #0b1220; color: #38bdf8; }
.sidebar-group-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-width: 0; margin: 4px 0; padding: 10px 12px; overflow: hidden; border: 0; border-radius: 10px; background: transparent; color: #e2e8f0; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-align: left; text-transform: uppercase; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-group-btn:hover, .sidebar-group-btn.active { background: #0b1220; color: #38bdf8; }
.sidebar-arrow { display: inline-block; font-size: 18px; line-height: 1; transition: transform 0.2s ease; }
.sidebar-arrow.rotate { transform: rotate(90deg); }
.sidebar-submenu { display: none; }
.sidebar-submenu.open { display: block; animation: sidebar-submenu-in 0.18s ease-out; }
@keyframes sidebar-submenu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* parent-title: Judul induk di sidebar, misal IP. Ini class, stikernya parent-title. Bold biar keliatan sebagai judul, bukan teks biasa */
.parent-title { margin: 16px 0 6px 12px; padding: 0; color: #e2e8f0; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.sidebar details a { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; overflow: hidden; color: white; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 4px; margin-left: 0; border-left: none; white-space: nowrap; text-overflow: ellipsis; }
.sidebar details a .sidebar-label { min-width: 0; }
.sidebar details a:hover { background: #0b1220; color: #38bdf8; }
.sidebar details a.active { background: #1e293b; color: #38bdf8; font-weight: bold; border-left: 2px solid #38bdf8; }
.sidebar-resize-handle { position: absolute; z-index: 3; top: 0; right: 0; width: 8px; height: 100%; background: transparent; opacity: 0; cursor: ew-resize; touch-action: none; user-select: none; }
.sidebar-resize-handle::after { position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: #38bdf8; content: ""; }
.sidebar-resize-handle:hover, .sidebar-resize-handle:focus-visible, .sidebar.is-resizing .sidebar-resize-handle { opacity: 1; }
.sidebar-resize-handle:focus-visible { outline: none; }
.mobile-menu-toggle { display: none; align-self: flex-start; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 12px; border: 1px solid #334155; border-radius: 10px; background: #111c33; color: white; font: inherit; cursor: pointer; }
.sidebar-backdrop { display: none; }

.layout.is-collapsed .sidebar { width: 64px; flex-basis: 64px; padding-right: 8px; padding-left: 8px; }
.layout.is-collapsed .sidebar-header { justify-content: center; margin-bottom: 8px; padding-bottom: 0; }
.layout.is-collapsed .sidebar h2 { display: none; }
.layout.is-collapsed .sidebar-label, .layout.is-collapsed .sidebar-sub { display: none; }
.layout.is-collapsed .sidebar-toggle { position: static; width: 40px; height: 36px; }
.layout.is-collapsed .menu-home, .layout.is-collapsed .sidebar details a { justify-content: center; padding-right: 8px; padding-left: 8px; }
.layout.is-collapsed .sidebar details { margin-left: 0; padding-left: 0; border-left: 0; }
.layout.is-collapsed .sidebar details summary { margin: 0; padding: 10px 0; text-align: center; font-size: 0; }
.layout.is-collapsed .sidebar details summary::before, .layout.is-collapsed .sidebar-group-btn::before { content: "☷"; font-size: 18px; }
.layout.is-collapsed .sidebar details summary::after { display: none; }
.layout.is-collapsed .sidebar-group-btn { justify-content: center; padding-right: 0; padding-left: 0; font-size: 0; }
.layout.is-collapsed .sidebar-arrow { display: none; }
.layout.is-collapsed .sidebar details a.active { margin-left: 0; padding-right: 8px; padding-left: 8px; border-left-width: 2px; }
.layout.is-collapsed .sidebar-resize-handle { display: none; }
.layout.is-collapsed > .page { padding-inline: clamp(12px, 1.2vw, 20px); }

/* BREADCRUMB */
.breadcrumb { color: #94a3b8; font-size: 13px; margin: 0 0 12px 0; }
/* breadcrumb-pojok: Breadcrumb nempel pojok kiri atas konten, tidak ikut kotak tengah */
.breadcrumb-pojok { align-self: stretch; width: 100%; margin: 0 0 12px; padding: 0; text-align: left; }

/* CARD KONTEN */
.card { width: 100%; max-width: 100%; min-width: 0; margin-inline: auto; background: var(--card-bg); color: var(--card-text); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: clamp(20px, 3vw, 32px); box-shadow: 0 20px 40px rgba(0,0,0,0.2); box-sizing: border-box; }
.card:has(textarea), .card:has(table) { max-width: 100%; }

/* FORM: DITUMPUK KE BAWAH, JANGAN JADI FLEX LAGI */
.card form { display: block; width: 100%; margin-top: 16px; }
.card form div { display: block; width: 100%; margin-bottom: 14px; }
.card label { display: block; margin-bottom: 6px; color: #cbd5e1; font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem); }
.card input { display: block; width: 100%; min-width: 0; box-sizing: border-box; padding: clamp(10px, 1vw, 12px) clamp(12px, 1.2vw, 14px); border-radius: 12px; border: 1px solid #334155; background: var(--input-bg); color: white; outline: none; font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem); }
.card input:focus { border-color: #38bdf8; }
.card textarea { display: block; width: 100%; min-width: 0; box-sizing: border-box; padding: clamp(10px, 1vw, 12px) clamp(12px, 1.2vw, 14px); border-radius: 12px; border: 1px solid #334155; background: var(--input-bg); color: white; outline: none; font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem); font-family: inherit; resize: vertical; }
.card textarea:focus { border-color: #38bdf8; }
.card select { background: var(--input-bg); color: white; }
.card input, .card textarea, .card select, .card button { width: 100%; box-sizing: border-box; }
.card button { display: block; width: 100%; padding: clamp(10px, 1vw, 12px) clamp(16px, 1.8vw, 22px); background: #22c55e; border: none; border-radius: 12px; cursor: pointer; font-weight: bold; color: #0b1220; font-size: clamp(0.9rem, 0.85rem + 0.2vw, 1rem); }
.card button:hover { background: #16a34a; }
table { width: 100%; margin-top: 20px; border-collapse: collapse; }
td { padding: clamp(8px, 0.9vw, 10px) clamp(8px, 0.8vw, 12px); border-bottom: 1px solid #334155; }
td:first-child { color: #cbd5e1; width: 35%; }
.result-table, .info-table { width: 100%; table-layout: fixed; }
.result-table td:first-child, .info-table td:first-child { width: 160px; }
.result-table td:last-child, .info-table td:last-child { word-break: break-word; overflow-wrap: anywhere; white-space: normal; }
.card form > .ip-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(10px, 1.5vw, 18px); align-items: start; margin-bottom: 14px; }
.ip-form-grid > .ip-form-field { min-width: 0; margin: 0; }
.vlsm-field { grid-column: 1 / -1; }
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { width: 100%; min-width: 820px; border-collapse: collapse; white-space: nowrap; }
.table-wrap td { white-space: nowrap; }
.table-wrap th { white-space: nowrap; }
.dns-lookup-results table { min-width: 0; table-layout: fixed; white-space: normal; }
.dns-lookup-results th, .dns-lookup-results td { padding: 10px 12px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.dns-lookup-results th:nth-child(1), .dns-lookup-results td:nth-child(1) { width: 24%; }
.dns-lookup-results th:nth-child(2), .dns-lookup-results td:nth-child(2) { width: 11%; }
.dns-lookup-results th:nth-child(3), .dns-lookup-results td:nth-child(3) { width: 14%; }
.dns-lookup-results th:nth-child(4), .dns-lookup-results td:nth-child(4) { width: 51%; }
.dns-lookup-results td.dns-ip { font-family: Consolas, 'Courier New', monospace; white-space: normal; overflow-wrap: anywhere; }
.dns-record-types { table-layout: fixed; }
.dns-record-types td { padding: 10px 12px; }
.dns-record-types td:first-child { width: 80px; }
.dns-record-types td:last-child { overflow-wrap: anywhere; }
.vlsm-textarea { width: 100%; min-height: 140px; box-sizing: border-box; resize: vertical; }
.vlsm-results table { min-width: 820px; table-layout: auto; }
.vlsm-results th, .vlsm-results td { padding: clamp(10px, 1vw, 12px) clamp(12px, 1.3vw, 16px); text-align: left; }
.vlsm-results th { color: #cbd5e1; border-bottom: 1px solid #334155; }
.vlsm-results td:first-child { width: auto; }
.vlsm-ip { white-space: nowrap; font-family: Consolas, 'Courier New', monospace; }
.card form.dns-tool-form { display: block; width: 100%; }
.card form.dns-tool-form .dns-tool-form-row { display: flex; align-items: end; gap: 12px; width: 100%; margin-bottom: 14px; }
.card form.dns-tool-form .dns-tool-field { flex: 1; min-width: 0; margin: 0; }
.card form.dns-tool-form .dns-tool-control { display: block; width: 100%; height: 46px; min-width: 0; box-sizing: border-box; padding: 10px 14px; border: 1px solid #334155; border-radius: 12px; background: var(--input-bg); color: white; font: inherit; line-height: 1.2; }
.card form.dns-tool-form .dns-tool-control:focus { border-color: #38bdf8; outline: none; }
.card form.dns-tool-form .dns-tool-submit { flex: 0 0 auto; width: auto; min-width: 180px; height: 46px; margin: 0; padding: 10px 18px; }
.dns-tool-progress { width: 100%; height: 12px; overflow: hidden; border-radius: 999px; background: #0f172a; }
.dns-tool-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: #38bdf8; transition: width 0.2s ease; }
.dns-tool-progress.is-indeterminate > span { width: 35%; animation: dns-tool-progress 1.1s ease-in-out infinite alternate; }
@keyframes dns-tool-progress { from { transform: translateX(0); } to { transform: translateX(185%); } }
.dns-tool-results { width: 100%; min-width: 0; overflow-x: auto; }
.dns-tool-results table { width: 100%; min-width: 0; table-layout: fixed; white-space: normal; }
.dns-tool-results th, .dns-tool-results td { padding: 10px 12px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.dns-tool-status { margin-top: 16px; padding: 12px; border-radius: 10px; font-weight: 700; }
.dns-tool-status.safe { background: #14532d; color: #dcfce7; }
.dns-tool-status.warning { background: #7f1d1d; color: #fee2e2; }
.dns-tool-status.neutral { background: #334155; color: #e2e8f0; }

/* KARTU HOME */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.home-card { background: #0b1220; padding: 22px; border-radius: 16px; text-decoration: none; color: white; border: 1px solid #334155; display: block; }
.home-card:hover { border-color: #38bdf8; transform: translateY(-2px); }
.home-card h3 { margin: 0 0 6px 0; color: #38bdf8; }
.home-card p { margin: 0; color: #94a3b8; font-size: 13px; }

/* HP */
@media (max-width: 767px) {
  .layout { min-height: 100vh; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 86vw); flex-basis: auto; max-height: 100vh; padding: 24px 16px; border-right: 0; transform: translateX(-105%); transition: transform 0.2s ease; }
  .layout.mobile-open .sidebar { transform: translateX(0); }
  .sidebar-header { padding-bottom: 0; }
  .sidebar-toggle, .sidebar-resize-handle { display: none; }
  .mobile-menu-toggle { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 1; display: block; visibility: hidden; opacity: 0; border: 0; background: rgba(0, 0, 0, 0.55); transition: opacity 0.2s ease, visibility 0.2s ease; }
  .layout.mobile-open + .sidebar-backdrop { visibility: visible; opacity: 1; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .card form > .ip-form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  .card form.dns-tool-form .dns-tool-form-row { align-items: stretch; flex-direction: column; }
  .card form.dns-tool-form .dns-tool-submit { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-arrow, .sidebar-backdrop, .dns-tool-progress > span { transition: none; animation: none; }
  .sidebar-submenu.open { animation: none; }
}
