/* ==========================================================================
   Chrysalias.com — Complete Design System
   Fonts, Variables, Reset, Dashboard, Nav, Forms, Responsive
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Montserrat:wght@600;700;800&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --escrow-navy: #01426a;
  --escrow-navy-dark: #002b49;
  --escrow-green: #3cb95d;
  --escrow-green-hover: #329e4e;
  --escrow-slate: #4f5759;
  --escrow-bg-light: #e8eef2;
  --escrow-bg-webapp: #f8fafc;
  --escrow-border: #e2e8f0;
  --escrow-text-dark: #0f172a;
}

/* ---------- Base Reset ---------- */
html { font-size: 15px; box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

html, body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  color: var(--escrow-text-dark);
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, input, button, select, textarea, p, span, a, label, td, th {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}


/* ==========================================================================
   Index Page Navigation Header Dropdowns
   ========================================================================== */
.headerV2-primaryNav-item {
  position: relative;
}

.headerV2-primaryNav-item:hover .headerV2-subnav,
.headerV2-primaryNav-item.is-active .headerV2-subnav {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.headerV2-subnav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border-radius: 4px;
  z-index: 10000;
}

.headerV2-subnav-list {
  list-style: none;
  padding: 12px 0;
  margin: 0;
}

.headerV2-subnav-item { padding: 0; }

.headerV2-subnav-link {
  display: block;
  padding: 10px 20px;
  color: var(--escrow-slate);
  text-decoration: none;
  transition: background 0.15s ease;
}

.headerV2-subnav-link:hover {
  background-color: var(--escrow-bg-light);
  color: var(--escrow-navy);
}

.headerV2-subnav-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--escrow-navy);
  margin: 0 0 2px 0;
}

.headerV2-subnav-desc {
  font-size: 0.78rem;
  color: #7f8c8d;
  margin: 0;
}


/* ==========================================================================
   Sticky Scroll Header (index.html)
   ========================================================================== */
.chrysalias-nav-header {
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.chrysalias-nav-header.is-sticky-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
  animation: slideDownHeader 0.25s ease-out forwards;
}

@keyframes slideDownHeader {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

.chrysalias-nav-header.is-sticky-header .headerV2-logo span,
.chrysalias-nav-header.is-sticky-header .headerV2-primaryNav-text {
  color: #002b49 !important;
}

.chrysalias-nav-header.is-sticky-header .headerV2-authNav-link .headerV2-authNav-text {
  color: #002b49 !important;
}


/* ==========================================================================
   Dashboard Layout
   ========================================================================== */
.dashboard-page-bg {
  background-color: var(--escrow-bg-webapp) !important;
  min-height: 100vh;
  overflow-x: hidden;
}

.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 65px);
  background-color: var(--escrow-bg-webapp);
  max-width: 100%;
  overflow-x: hidden;
}

/* Sidebar */
.dashboard-sidebar {
  width: 240px;
  background-color: var(--escrow-navy-dark);
  color: #ffffff;
  padding: 20px 0;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 0 20px 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 14px;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: #a4b0b1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #ffffff;
  background-color: var(--escrow-navy);
  border-left-color: var(--escrow-green);
}

/* Main content */
.dashboard-main {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 24px 28px;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Tab panels — default block, hidden via inline style */
.tab-panel { display: block; }


/* ==========================================================================
   Dashboard Top Navigation Bar
   ========================================================================== */
.dashboard-header-bar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--escrow-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1050;
  height: 65px;
}

.dashboard-header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

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

/* Notification Bell */
.dashboard-notif-wrapper { position: relative; }

.dashboard-notif-btn {
  background: #f1f5f9;
  border: 1px solid var(--escrow-border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--escrow-navy);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.dashboard-notif-btn:hover {
  background: #e2e8f0;
  color: var(--escrow-green);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

.notif-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 50px;
  width: 310px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  border: 1px solid var(--escrow-border);
  z-index: 2000;
  overflow: hidden;
}

.notif-dropdown.show { display: block; animation: fadeInDown 0.18s ease; }

.notif-dropdown-header {
  padding: 12px 16px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--escrow-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--escrow-navy);
}

.mark-read {
  font-size: 0.75rem;
  color: var(--escrow-green);
  cursor: pointer;
  font-weight: 600;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notif-item:last-child { border-bottom: none; }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--escrow-green);
  margin-top: 6px;
  flex-shrink: 0;
}

.notif-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--escrow-navy-dark);
}

.notif-time { font-size: 0.72rem; color: #94a3b8; }

/* User Profile */
.dashboard-user-profile-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 24px;
  transition: background 0.2s ease;
  user-select: none;
}

.dashboard-user-profile-wrapper:hover { background-color: #f1f5f9; }

.user-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--escrow-navy) 0%, var(--escrow-green) 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.user-profile-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--escrow-navy-dark);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 50px;
  width: 220px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  border: 1px solid var(--escrow-border);
  z-index: 2000;
  padding: 6px 0;
}

.user-profile-dropdown.show { display: block; animation: fadeInDown 0.18s ease; }

.dropdown-user-info { padding: 10px 16px; }

.dropdown-user-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--escrow-navy);
}

.dropdown-user-info small {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-dropdown hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--escrow-border);
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  font-size: 0.85rem;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s ease;
}

.dropdown-item:hover { background-color: #f8fafc; color: var(--escrow-navy); }

.dropdown-item.logout-item { color: #ef4444; }
.dropdown-item.logout-item:hover { background-color: #fef2f2; color: #dc2626; }

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


/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-escrow-green {
  background-color: var(--escrow-green) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.btn-escrow-green:hover { background-color: var(--escrow-green-hover) !important; }

.btn-escrow-navy {
  background-color: var(--escrow-navy) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 8px 16px !important;
  border-radius: 4px !important;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.btn-escrow-navy:hover { background-color: var(--escrow-navy-dark) !important; }

/* ── Button Loading Spinner ── */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  animation: btnSpin 0.7s linear infinite;
  margin-right: 8px;
}
@keyframes btnSpin {
  to { transform: rotate(360deg); }
}


/* ==========================================================================
   Auth Pages
   ========================================================================== */
.custom-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-color: var(--escrow-bg-webapp);
  box-sizing: border-box;
}

.auth-container {
  background: #ffffff;
  border: 1px solid var(--escrow-border);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  box-sizing: border-box;
}

.auth-header { text-align: center; margin-bottom: 24px; }

.auth-header h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--escrow-navy-dark);
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.auth-header p { font-size: 0.9rem; color: #64748b; margin: 0; }

.demo-auth-box {
  background-color: #f0fdf4;
  border: 1px dashed #bbf7d0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.demo-auth-box p { margin: 0 0 8px 0; font-size: 0.88rem; font-weight: 700; color: #166534; }

.demo-btn-group { display: flex; gap: 8px; }

.demo-btn {
  flex: 1;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--escrow-navy);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.demo-btn:hover { background: var(--escrow-navy); color: #ffffff; border-color: var(--escrow-navy); }

.auth-switch-link {
  margin-top: 20px;
  text-align: center;
  font-size: 0.88rem;
  color: #64748b;
}

.auth-switch-link a { color: var(--escrow-navy); font-weight: 700; text-decoration: none; }
.auth-switch-link a:hover { text-decoration: underline; color: var(--escrow-green); }


/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.92rem;
  color: #1e293b;
  background-color: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--escrow-green);
  box-shadow: 0 0 0 3px rgba(60,185,93,0.18);
}

.form-control::placeholder { color: #94a3b8; }


/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--escrow-navy-dark);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s ease;
  border-left: 4px solid var(--escrow-green);
  max-width: 360px;
  word-break: break-word;
}


/* ==========================================================================
   Payment Option Cards (Start Transaction)
   ========================================================================== */
.payment-option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pay-option-card {
  box-sizing: border-box;
  width: 100%;
}


/* ==========================================================================
   FULL RESPONSIVE — All Breakpoints
   ========================================================================== */

/* Tablet: 768px */
@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .dashboard-sidebar {
    width: 100%;
    padding: 14px 0;
  }

  .sidebar-user {
    padding: 0 16px 12px 16px;
  }

  .sidebar-menu {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 0 12px;
  }

  .sidebar-item { flex-shrink: 0; }

  .sidebar-link {
    padding: 9px 14px;
    font-size: 0.82rem;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: 4px 4px 0 0;
  }

  .sidebar-link:hover, .sidebar-link.active {
    border-left: none;
    border-bottom-color: var(--escrow-green);
  }

  .dashboard-main {
    padding: 16px 14px;
  }

  .dashboard-header-container {
    padding: 0 14px;
  }

  .user-profile-name { display: none; }

  .payment-option-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .pay-option-card { padding: 12px 14px !important; }
}

/* Mobile: 640px */
@media (max-width: 640px) {
  html { font-size: 14px; }

  .dashboard-main { padding: 12px 10px; }

  .dash-welcome-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 16px;
  }

  .dash-welcome-card h1 { font-size: 1.2rem !important; }
  .dash-welcome-card p  { font-size: 0.82rem; }

  .dash-card { padding: 16px 12px; }
  .dash-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dash-card-title  { font-size: 0.95rem !important; }

  .metrics-grid-4 {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .metric-value  { font-size: 1.3rem !important; }
  .metric-label  { font-size: 0.74rem !important; }
  .metric-badge  { font-size: 0.66rem !important; }

  .tx-filter-pill { font-size: 0.72rem !important; padding: 5px 10px !important; }

  .search-input-box { max-width: 100% !important; width: 100% !important; font-size: 0.82rem; }

  .btn-escrow-green, .btn-escrow-navy {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  .user-cards-grid { grid-template-columns: 1fr !important; }

  /* Start Transaction */
  .tx-wizard-container { margin: 12px auto !important; padding: 0 8px !important; }
  .tx-card { padding: 18px 12px !important; border-radius: 10px !important; }
  .tx-card-title { font-size: 1.25rem !important; }
  .tx-card-subtitle { font-size: 0.84rem !important; margin-bottom: 16px !important; }

  .form-grid-2 { grid-template-columns: 1fr !important; gap: 12px !important; }

  .tx-step-bar { margin-bottom: 18px !important; }
  .tx-step-item { padding: 0 6px !important; gap: 4px !important; }
  .tx-step-item span { font-size: 0.72rem !important; }
  .tx-step-num { width: 24px !important; height: 24px !important; font-size: 0.76rem !important; }

  .auth-container { padding: 22px 14px; border-radius: 10px; }
  .demo-btn-group { flex-direction: column; gap: 6px; }

  .toast-container { right: 12px; left: 12px; bottom: 16px; }
  .toast { max-width: 100%; font-size: 0.82rem; padding: 12px 16px; }
}

/* Small mobile: 480px */
@media (max-width: 480px) {
  .metrics-grid-4 {
    grid-template-columns: 1fr !important;
  }

  .dashboard-header-container { padding: 0 10px; }

  .sidebar-menu { padding: 0 8px; }
  .sidebar-link { padding: 8px 10px; font-size: 0.78rem; }

  .notif-dropdown { width: 260px; right: -20px; }
}
