/* ==========================================================================
   N+ POWERED BY HAP — DESIGN SYSTEM & MOCKUP STYLES
   Source Style: https://dev-pre-registration.neural.bappartners.com/
   ========================================================================== */

:root {
  --blue: #2864ee;
  --blue-dark: #174bc4;
  --blue-light: #edf3ff;
  --blue-border: #8fb1ff6b;
  --ink: #101217;
  --ink-sub: #172238;
  --gray: #707783;
  --line: #dfe3ea;
  --soft: #f5f7fa;
  --background: #ffffff;
  
  /* Status Colors */
  --success: #147846;
  --success-bg: #e8f8ef;
  --warning: #9a5e05;
  --warning-bg: #fff4dd;
  --danger: #b42318;
  --danger-bg: #fff4f4;

  /* Card & Glassmorphism */
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(211, 219, 232, 0.92);
  --card-shadow: 0 22px 60px rgba(35, 51, 79, 0.12);
  --glass-blur: blur(18px);

  /* Typography */
  --font-sans: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   SITE SHELL & WEB3 ANIMATED BACKGROUND
   -------------------------------------------------------------------------- */
.site-shell {
  border-top: 6px solid var(--blue);
  isolation: isolate;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding-bottom: 90px; /* space for floating toolbar */
}

.site-shell::before {
  content: "";
  z-index: -3;
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(40, 100, 238, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(40, 100, 238, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 40%, rgba(40, 100, 238, 0.09), transparent 62%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  animation: grid-drift 22s linear infinite;
  mask-image: linear-gradient(#000 0, rgba(0, 0, 0, 0.85) 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(#000 0, rgba(0, 0, 0, 0.85) 70%, transparent 100%);
}

@keyframes grid-drift {
  to {
    background-position: 48px 48px, 48px 48px, 0 0;
  }
}

.web3-background {
  z-index: -2;
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  z-index: 50;
  border-bottom: 1px solid var(--line);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background: rgba(255, 255, 255, 0.85);
  justify-content: space-between;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  position: sticky;
  top: 0;
}

.brand {
  color: inherit;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  display: inline-flex;
}

.brand-mark {
  letter-spacing: -0.07em;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.brand-mark span {
  color: var(--blue);
}

.brand-name {
  color: var(--gray);
  letter-spacing: -0.03em;
  font-size: 18px;
  font-weight: 600;
}

.role-switcher {
  display: flex;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.role-btn {
  border: none;
  background: transparent;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.role-btn svg {
  stroke: currentColor;
  transition: stroke 0.2s ease, transform 0.2s ease;
}

.role-btn.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(40, 100, 238, 0.3);
}

.role-btn.active svg {
  stroke: #ffffff;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  box-shadow: 0 3px 10px rgba(35, 51, 79, 0.06);
}

.language-switch button {
  background: transparent;
  border: none;
  color: #747c88;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-switch button.active,
.language-switch button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 6px rgba(40, 100, 238, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wallet-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
  color: var(--ink-sub);
}

.wallet-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(40, 100, 238, 0.25);
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-outline {
  border: 1px solid var(--blue);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.btn-outline:hover {
  background: var(--blue);
  color: #fff;
}

.btn-secondary {
  border: 1px solid var(--line);
  color: var(--ink-sub);
  background: #fff;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: var(--soft);
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.btn-danger:hover {
  background: #fecaca;
}

/* --------------------------------------------------------------------------
   NAVBAR LINKS FOR MEMBER & ADMIN AREA
   -------------------------------------------------------------------------- */
.sub-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  gap: 8px;
  justify-content: center;
  overflow-x: auto;
}

.sub-nav-item {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 750;
  color: var(--gray);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.sub-nav-item:hover, .sub-nav-item.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* --------------------------------------------------------------------------
   SCREEN CONTAINER & VIEWS MANAGEMENT
   -------------------------------------------------------------------------- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.scr-view {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.scr-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* SCR Header Badge Header */
.scr-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid rgba(40, 100, 238, 0.2);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   CARD PANELS & LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.panel {
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--card-shadow);
  margin-bottom: 28px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   METRIC & STAT CARDS
   -------------------------------------------------------------------------- */
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 12px rgba(35, 51, 79, 0.04);
}

.stat-label {
  font-size: 12px;
  font-weight: 750;
  color: var(--gray);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink-sub);
  line-height: 1.2;
}

.stat-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   BADGES (P-RANK, T-RANK, STATUS)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.badge-p1 { background: #e0f2fe; color: #0369a1; }
.badge-p2 { background: #dcfce7; color: #15803d; }
.badge-p3 { background: #fef9c3; color: #a16207; }
.badge-p4 { background: #ffedd5; color: #c2410c; }
.badge-p5 { background: #fae8ff; color: #86198f; }

.badge-t, .badge-t1, .badge-t2, .badge-t3, .badge-t4, .badge-t5 { background: #f3e8ff; color: #6b21a8; font-weight: 850; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* --------------------------------------------------------------------------
   FORM CONTROLS
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: var(--ink-sub);
  margin-bottom: 8px;
}

.form-group label span {
  color: var(--blue);
  font-size: 10px;
  background: var(--blue-light);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.form-control {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid #cbd1db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(40, 100, 238, 0.15);
}

.input-with-action {
  display: flex;
  gap: 10px;
}

.input-with-action .form-control {
  flex: 1;
}

/* --------------------------------------------------------------------------
   DATA TABLES
   -------------------------------------------------------------------------- */
.table-wrapper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(35, 51, 79, 0.04);
  margin-top: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--soft);
  color: var(--gray);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-sub);
  font-weight: 600;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8faff;
}

/* --------------------------------------------------------------------------
   UNILEVEL TREE VISUALIZER (SCR-007 & SCR-015)
   -------------------------------------------------------------------------- */
.tree-container {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 16px;
  overflow-x: auto;
  min-height: 360px;
  text-align: center;
}

.tree-wrapper {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.tree-ul {
  padding-top: 20px;
  position: relative;
  display: flex;
  justify-content: center;
  list-style-type: none;
  margin: 0;
  padding-left: 0;
}

.tree-li {
  float: left;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 8px 0 8px;
  transition: all 0.2s ease;
}

/* Vertical stem line coming down from parent */
.tree-ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid var(--blue);
  width: 0;
  height: 20px;
}

/* Horizontal connecting lines between siblings */
.tree-li::before, .tree-li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 2px solid var(--blue);
  width: 50%;
  height: 20px;
}

.tree-li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid var(--blue);
}

/* Remove connectors for single/first/last child */
.tree-li:only-child::after, .tree-li:only-child::before {
  display: none;
}

.tree-li:only-child {
  padding-top: 0;
}

.tree-li:first-child::before, .tree-li:last-child::after {
  border: none;
}

.tree-li:last-child::before {
  border-right: 2px solid var(--blue);
  border-radius: 0 8px 0 0;
}

.tree-li:first-child::after {
  border-radius: 8px 0 0 0;
}

.tree-node-box {
  display: inline-block;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 130px;
  position: relative;
  z-index: 2;
}

.tree-node-box:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(40, 100, 238, 0.18);
}

.tree-node-box.root-node {
  border: 2px solid var(--blue);
  background: #f0f5ff;
}

.tree-node-box.has-children {
  border-color: var(--blue);
  background: #fafcff;
}

.tree-toggle-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 800;
  color: var(--blue);
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  padding: 2px 8px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.tree-node-box:hover .tree-toggle-badge {
  background: var(--blue);
  color: #fff;
}

.tree-node-box.is-expanded {
  border-color: var(--blue);
}

.tree-node-wallet {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-sub);
  margin-bottom: 4px;
}

.tree-branch-wrapper {
  display: flex;
  justify-content: center;
  gap: 20px;
  position: relative;
  margin-top: 16px;
}

/* --------------------------------------------------------------------------
   FLOATING CLIENT SCREEN SWITCHER TOOLBAR
   -------------------------------------------------------------------------- */
.client-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(16, 18, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  color: #fff;
}

.toolbar-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.scr-select-dropdown {
  background: #ffffff;
  color: #101217;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 750;
  outline: none;
  cursor: pointer;
  max-width: 280px;
}

.scr-select-dropdown option,
.scr-select-dropdown optgroup {
  background-color: #ffffff !important;
  color: #101217 !important;
}

.toolbar-nav-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s;
}

.toolbar-nav-btn:hover {
  background: var(--blue);
}

/* --------------------------------------------------------------------------
   MODAL POPUPS
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(16, 18, 23, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #fff;
  border-radius: 18px;
  max-width: 480px;
  width: 100%;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-sub);
}

.close-modal {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray);
  cursor: pointer;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  font-weight: 750;
  color: var(--ink-sub);
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.15s;
}

.wallet-option:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

/* Hero section for Landing Page SCR-001 */
.hero-box {
  text-align: center;
  padding: 60px 20px;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink-sub);
  line-height: 1.15;
  margin-bottom: 20px;
}

.hero-lead {
  font-size: 18px;
  color: var(--gray);
  font-weight: 600;
  line-height: 1.8;
  margin-bottom: 32px;
}

/* --------------------------------------------------------------------------
   FLOATING TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  min-width: 280px;
  max-width: 440px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  transform: translateY(-16px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-message.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-message.success {
  border-left: 4px solid var(--success);
}

.toast-message.warning {
  border-left: 4px solid var(--warning);
}
