/* ================================================================
   HVN Mini Board — Master Stylesheet
   ================================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #f1f5f9;
  transition: background-color 0.3s ease;
}
.dark body { background: #0a0f1d; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.animate-fade-up { animation: fadeUp 0.4s ease-out forwards; }

/* ---------- Tab system ---------- */
.tab-content        { display: none; }
.tab-content.active { display: block; }

/* ================================================================
   HEADER — fixed, full-width (bao gồm cả vùng sidebar)
   ================================================================ */
#header-placeholder header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 58px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dark #header-placeholder header {
  background: #111827;
  border-bottom-color: #1f2937;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.side-nav {
  width: 220px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  position: fixed;
  top: 58px;                    /* dưới header */
  left: 0;
  height: calc(100vh - 58px);
  z-index: 40;
  padding-top: 12px;
  overflow-y: auto;
  display: none;
}
.dark .side-nav { background: #111827; border-right-color: #1f2937; }

.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  font-size: 13px; font-weight: 600;
  color: #475569; text-decoration: none; cursor: pointer;
  transition: all 0.15s;
}
.side-nav a:hover  { background: #f1f5f9; color: #306fb6; }
.side-nav a.active { background: rgba(48,111,182,0.08); color: #306fb6; border-right: 3px solid #306fb6; }
.dark .side-nav a         { color: #94a3b8; }
.dark .side-nav a:hover   { background: #1e293b; color: #60a5fa; }
.dark .side-nav a.active  { background: rgba(48,111,182,0.15); color: #60a5fa; }
.side-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-with-side {
  margin-left: 220px;
  padding-top: 58px;
}

/* ================================================================
   BOTTOM NAV (mobile)
   ================================================================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #ffffff; border-top: 1px solid #e5e7eb;
  display: flex; z-index: 50;
}
.dark .bottom-nav { background: #111827; border-top-color: #1f2937; }
.bottom-nav button {
  flex: 1; padding: 10px 4px; font-size: 11px;
  text-align: center; color: #6b7280;
  background: none; border: none; cursor: pointer; font-weight: 600;
}
.bottom-nav button.active { color: #306fb6; }
.bottom-nav button svg { display: block; margin: 0 auto 3px; width: 22px; height: 22px; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (min-width: 768px) {
  .side-nav      { display: block; }
  .bottom-nav    { display: none; }
  .mobile-only   { display: none !important; }
}
@media (max-width: 767px) {
  .side-nav      { display: none !important; }
  .bottom-nav    { display: flex; }
  .main-with-side { margin-left: 0; }
  .desktop-only  { display: none !important; }
}

/* ================================================================
   BADGE
   ================================================================ */
.badge         { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; }
.badge-active  { background: #d1fae5; color: #065f46; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-unknown { background: #fef3c7; color: #92400e; }

/* ================================================================
   CLIENT CARD (dashboard)
   ================================================================ */
.card {
  background: #ffffff; border-radius: 14px; padding: 18px 20px;
  border: 1px solid #e2e8f0; overflow: hidden; word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.dark .card { background: #111827; border-color: #1f2937; }
.card h3   { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.card p    { font-size: 0.85rem; color: #6b7280; }
.dark .card p { color: #94a3b8; }
.card .folder-link {
  display: inline-block; margin-top: 8px;
  font-size: 0.75rem; color: #306fb6; font-weight: 600; text-decoration: none;
}
.card .folder-link:hover { text-decoration: underline; }

#client-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: start;
}

/* ================================================================
   SEARCH BOX
   ================================================================ */
.search-box { position: relative; display: flex; align-items: center; }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: #9ca3af; pointer-events: none; z-index: 1;
}
.search-box input { padding-left: 40px !important; }

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  position: fixed; top: 20px; right: 20px;
  background: #1f2937; color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 0.85rem; z-index: 1000; display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.toast.show { display: block; }

/* ================================================================
   LOG TABLE
   ================================================================ */
.log-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.log-table th {
  background: #f8fafc; padding: 10px 12px;
  text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; color: #64748b;
  border-bottom: 2px solid #e2e8f0;
}
.dark .log-table th { background: #1e293b; color: #94a3b8; border-bottom-color: #334155; }
.log-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; }
.dark .log-table td { border-bottom-color: #1e293b; }
.log-table tr:hover td { background: #f8fafc; }
.dark .log-table tr:hover td { background: #1e293b; }

/* ================================================================
   LEGACY BTN (dashboard CSV, log export btn)
   ================================================================ */
.btn {
  padding: 9px 18px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 700; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.15s; font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-primary   { background: #306fb6; color: #fff; }
.btn-primary:hover { background: #21548f; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.dark .btn-secondary { background: #334155; color: #e2e8f0; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }

/* ================================================================
   HVN FORM SYSTEM — design token riêng, không xung đột Tailwind
   Dùng cho: generator.html, admin.html
   ================================================================ */

/* Wrapper card cho form */
.hvn-form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 28px 24px;
  max-width: 560px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.dark .hvn-form-card {
  background: #111827;
  border-color: #1f2937;
}

/* Card title / subtitle */
.hvn-card-title {
  font-size: 0.95rem; font-weight: 800; color: #1e293b;
  margin-bottom: 4px;
}
.dark .hvn-card-title { color: #f1f5f9; }
.hvn-card-subtitle {
  font-size: 0.78rem; color: #64748b; margin-bottom: 20px;
}

/* Field wrapper — khoảng cách nhất quán */
.hvn-field {
  margin-bottom: 18px;
}
.hvn-field:last-of-type { margin-bottom: 0; }

/* Label */
.hvn-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 7px;
}
.dark .hvn-label { color: #94a3b8; }
.hvn-hint {
  font-weight: 400; font-size: 0.7rem;
  color: #94a3b8; text-transform: none; letter-spacing: 0;
}

/* Input */
.hvn-input {
  display: block; width: 100%;
  height: 42px; line-height: 42px;
  padding: 0 14px;
  font-size: 0.875rem; font-family: 'Plus Jakarta Sans', sans-serif;
  background: #f8fafc; color: #1e293b;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
}
.hvn-input:focus {
  background: #fff;
  border-color: #306fb6;
  box-shadow: 0 0 0 3px rgba(48,111,182,0.13);
}
.hvn-input[readonly] { background: #f1f5f9; cursor: default; color: #475569; }
.dark .hvn-input {
  background: #1e293b; color: #e2e8f0; border-color: #334155;
}
.dark .hvn-input:focus { background: #1e293b; border-color: #60a5fa; }
.dark .hvn-input[readonly] { background: #0f172a; color: #64748b; }

/* Drive link input — dấu gạch nét */
.hvn-drive-input {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}
.hvn-drive-input:focus {
  background: #fff !important;
  border-color: #306fb6 !important;
}
.dark .hvn-drive-input { background: #052e16 !important; border-color: #166534 !important; }

/* ── Custom Select ──
   Dùng wrapper + hidden native select để giữ functionality
   nhưng render bằng CSS thuần → không bao giờ bị nền đen
*/
.hvn-select-wrap {
  position: relative;
  display: block;
}
.hvn-select-wrap::after {
  content: '';
  position: absolute;
  right: 13px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #6b7280;
  pointer-events: none;
  z-index: 2;
}
.dark .hvn-select-wrap::after { border-top-color: #94a3b8; }

.hvn-select {
  display: block; width: 100%;
  height: 42px; line-height: 42px;
  padding: 0 38px 0 14px;
  font-size: 0.875rem; font-family: 'Plus Jakarta Sans', sans-serif;
  background: #f8fafc !important;   /* force override browser dark */
  color: #1e293b !important;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  outline: none; cursor: pointer;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: none !important;   /* arrow do ::after xử lý */
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hvn-select:focus {
  border-color: #306fb6;
  box-shadow: 0 0 0 3px rgba(48,111,182,0.13);
}
.dark .hvn-select {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155;
}
.dark .hvn-select:focus { border-color: #60a5fa; }

/* Option elements — chỉ được 1 phần trên một số browser */
.hvn-select option {
  background: #ffffff;
  color: #1e293b;
  padding: 6px 14px;
}
.dark .hvn-select option {
  background: #1e293b;
  color: #e2e8f0;
}

/* Buttons trong form */
.hvn-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 44px;
  background: #306fb6; color: #fff;
  border: none; border-radius: 10px;
  font-size: 0.9rem; font-weight: 800; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background 0.15s;
  margin-top: 8px;
}
.hvn-btn-primary:hover { background: #21548f; }

.hvn-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px;
  background: #f1f5f9; color: #374151;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.15s; white-space: nowrap;
}
.hvn-btn-secondary:hover { background: #e2e8f0; }
.dark .hvn-btn-secondary { background: #1e293b; color: #e2e8f0; border-color: #334155; }
.dark .hvn-btn-secondary:hover { background: #334155; }

/* Result box */
.hvn-result-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}
.dark .hvn-result-box { border-top-color: #1f2937; }

/* Info rows (admin card bên phải) */
.hvn-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.82rem;
}
.hvn-info-row:last-child { border-bottom: none; }
.dark .hvn-info-row { border-bottom-color: #1f2937; }
.hvn-info-key { color: #64748b; font-weight: 600; }
.hvn-info-val { color: #1e293b; font-weight: 700; max-width: 60%; text-align: right; word-break: break-all; }
.dark .hvn-info-val { color: #e2e8f0; }

/* Admin grid: bên phải không cần max-width constraint */
#tab-admin .hvn-form-card { max-width: 100%; }

/* ================================================================
   LOCK SCREEN (Plexus)
   ================================================================ */
#lockScreen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: #020617; overflow: hidden;
}
#lockScreen.hidden { display: none; }
#plexusCanvas { position: absolute; inset: 0; z-index: 0; opacity: 0.6; }
#lockScreen .lock-gradient {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(to top, #020617, transparent, transparent);
}
#lockBox {
  position: relative; z-index: 10;
  width: 100%; max-width: 400px;
  padding: 32px 16px; text-align: center;
}
#lockBox .logo-wrap {
  padding: 24px 32px; border-radius: 40px;
  background: rgba(255,255,255,0.05); backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 50px rgba(59,130,246,0.2);
  margin-bottom: 32px;
  display: flex; align-items: center; justify-content: center;
}
#lockBox .logo-wrap img { max-height: 80px; width: auto; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
#lockBox h1 { font-size: 2.25rem; font-weight: 900; color: #fff; letter-spacing: -0.05em; margin-bottom: 8px; text-transform: uppercase; }
#lockBox h1 span { color: #306fb6; font-style: italic; }
#lockBox .subtitle { font-size: 9px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.4em; margin-bottom: 48px; }
#lockBox input[type="password"] {
  width: 100%; background: rgba(255,255,255,0.05); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
  padding: 20px 24px; text-align: center; color: #fff;
  font-size: 1.875rem; font-weight: 900; letter-spacing: 0.5em;
  outline: none; transition: all 0.2s;
  -webkit-appearance: none; appearance: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
#lockBox input[type="password"]:focus { border-color: rgba(48,111,182,0.5); }
#lockBox input[type="password"]::placeholder { color: #334155; }
#lockBox .unlock-btn {
  width: 100%; background: #306fb6; color: #fff; padding: 20px;
  border-radius: 16px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.2em; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 16px; transition: all 0.2s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
#lockBox .unlock-btn:hover  { background: #2563eb; }
#lockBox .unlock-btn:active { transform: scale(0.95); }
#lockBox .pin-error { color: #ef4444; font-size: 0.875rem; margin-top: 12px; display: none; }

/* ================================================================
   MINI-12 FIXES
   ================================================================ */
/* Search box style fix */
.search-box input.hvn-input {
  height: 42px;
  padding-left: 40px !important;
}

#status-filter.hvn-select {
  height: 42px;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
