/* ==========================================================================
   JINTRADE - Dashboard & Authentication Theme Stylesheet
   Matches Homepage Dark-Gold Obsidian FinTech Palette
   ========================================================================== */

:root {
  --jin-sidebar-width: 260px;
  --jin-sidebar-collapsed-width: 80px;
  --jin-topbar-height: 70px;
}

/* Dashboard Body & Layout */
html {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

.dashboard-body {
  background-color: #07090e;
  color: #e5e7eb;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

#dashboard-wrapper {
  display: flex;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

/* Sidebar Styling */
#dashboard-sidebar {
  width: var(--jin-sidebar-width);
  background: #0a0e17;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.sidebar-brand {
  height: var(--jin-topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  padding: 1.25rem 1.5rem 0.5rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0.5rem 0.75rem;
  margin: 0;
}

.sidebar-nav .nav-item {
  margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: #9ca3af;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.sidebar-nav .nav-link i, .sidebar-nav .nav-link svg {
  color: #9ca3af;
  font-size: 1.1rem;
  transition: color 0.2s;
}

.sidebar-nav .nav-link:hover {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.08);
}

.sidebar-nav .nav-link:hover i, .sidebar-nav .nav-link:hover svg {
  color: #f59e0b;
}

.sidebar-nav .nav-link.active {
  color: #000000;
  background: var(--jin-gold-gradient);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.sidebar-nav .nav-link.active i, .sidebar-nav .nav-link.active svg {
  color: #000000;
}

.sidebar-dropdown-menu {
  list-style: none;
  padding-left: 2rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.sidebar-dropdown-menu .nav-link {
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
}

/* Main Dashboard Content Area */
#dashboard-main {
  flex: 1 1 auto;
  min-width: 0;
  width: calc(100% - var(--jin-sidebar-width));
  max-width: calc(100vw - var(--jin-sidebar-width));
  margin-left: var(--jin-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: #07090e;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
  transition: all 0.3s ease;
}

/* Topbar Styling */
#dashboard-topbar {
  height: var(--jin-topbar-height);
  background: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.topbar-search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 1rem 0.45rem 2.25rem;
  font-size: 0.85rem;
  width: 260px;
  transition: all 0.2s;
}

.topbar-search-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--jin-gold);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
  width: 320px;
  outline: none;
}

/* Stat Cards & KPI Boxes */
.dash-card {
  background: #0d121d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.5rem;
  transition: all 0.25s ease;
}

.dash-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(245, 158, 11, 0.08);
}

.dash-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-gold {
  background: rgba(245, 158, 11, 0.12);
  color: var(--jin-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--jin-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stat-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-purple {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Table Dark Gold Styling */
.table-dark-custom {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: rgba(245, 158, 11, 0.05);
  color: #d1d5db;
  border-color: rgba(255, 255, 255, 0.08);
}

.table-dark-custom th {
  color: #9ca3af;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-dark-custom td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.85rem;
}

/* Auth Pages Styling */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #07090e;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: rgba(13, 18, 29, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.12);
}

.auth-input {
  background: #090c13 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.auth-input:focus {
  border-color: var(--jin-gold) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25) !important;
  outline: none;
}

/* OTP Input Boxes */
.otp-box-input {
  width: 52px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: #090c13;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: var(--jin-gold);
  border-radius: 12px;
  transition: all 0.2s;
}

.otp-box-input:focus {
  border-color: var(--jin-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.35);
  outline: none;
  background: #0e1422;
}

/* Responsive Sidebar Toggle & Mobile Drawer & Layout */
@media (max-width: 991.98px) {
  #dashboard-wrapper {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  #dashboard-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
    z-index: 1060;
  }

  #dashboard-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1055;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  #dashboard-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding-bottom: 80px !important;
    overflow-x: hidden !important;
  }

  #dashboard-topbar {
    padding: 0 0.75rem !important;
    height: 60px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  main.p-4.p-lg-5 {
    padding: 1rem 0.6rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Grid & container fixes to prevent mobile horizontal blowout */
  .dashboard-body .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden;
  }

  .dashboard-body .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }

  .dashboard-body .row > * {
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .dash-card, .metric-card {
    padding: 1rem !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Scrollable tables inside cards without page-level horizontal overflow */
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
  }

  .table-responsive > table {
    min-width: 600px;
    margin-bottom: 0;
  }

  /* Scrollable tabs */
  .team-nav-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    gap: 0.25rem !important;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .team-nav-pills::-webkit-scrollbar {
    display: none;
  }
  .team-nav-pills .nav-item {
    flex-shrink: 0 !important;
  }
  .team-nav-pills .nav-link {
    white-space: nowrap !important;
    font-size: 0.75rem !important;
    padding: 0.35rem 0.65rem !important;
  }

  #withdrawTab {
    flex-direction: column !important;
    gap: 0.35rem !important;
  }
  #withdrawTab .nav-link {
    width: 100% !important;
    text-align: left !important;
    justify-content: flex-start !important;
    padding: 0.65rem 0.75rem !important;
    font-size: 0.78rem !important;
  }

  .topbar-search-input {
    width: 140px;
  }

  .topbar-search-input:focus {
    width: 180px;
  }
}

@media (max-width: 575.98px) {
  .referral-input-group-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .referral-input-group-stack > * {
    width: 100% !important;
    border-radius: 8px !important;
  }

  #dashboard-topbar {
    gap: 0.25rem;
  }

  .btn-dash-theme-toggle {
    padding: 0.35rem 0.5rem !important;
  }
}

/* ==========================================================================
   DASHBOARD LIGHT MODE OVERRIDES
   ========================================================================== */
[data-theme="light"] .dashboard-body {
  background-color: #f8fafc;
  color: #0f172a;
}

[data-theme="light"] #dashboard-main {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(217, 119, 6, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 90% 20%, rgba(5, 150, 105, 0.05) 0%, transparent 45%);
}

[data-theme="light"] #dashboard-sidebar {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .sidebar-brand {
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .sidebar-brand .font-heading {
  color: #0f172a !important;
}

[data-theme="light"] .sidebar-heading {
  color: #64748b;
}

[data-theme="light"] .sidebar-nav .nav-link {
  color: #475569;
}

[data-theme="light"] .sidebar-nav .nav-link i,
[data-theme="light"] .sidebar-nav .nav-link svg {
  color: #64748b;
}

[data-theme="light"] .sidebar-nav .nav-link:hover {
  color: var(--jin-gold);
  background: rgba(217, 119, 6, 0.08);
}

[data-theme="light"] .sidebar-nav .nav-link:hover i,
[data-theme="light"] .sidebar-nav .nav-link:hover svg {
  color: var(--jin-gold);
}

[data-theme="light"] .sidebar-nav .nav-link.active {
  color: #000000 !important;
  background: var(--jin-gold-gradient) !important;
}

[data-theme="light"] .sidebar-nav .nav-link.active i,
[data-theme="light"] .sidebar-nav .nav-link.active svg {
  color: #000000 !important;
}

[data-theme="light"] #dashboard-topbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .topbar-search-input {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .topbar-search-input:focus {
  background: #ffffff;
  border-color: var(--jin-gold);
  color: #0f172a;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.2);
}

[data-theme="light"] .dash-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  color: #0f172a;
}

[data-theme="light"] .dash-card:hover {
  border-color: rgba(217, 119, 6, 0.35);
  box-shadow: 0 10px 25px rgba(217, 119, 6, 0.1);
}

[data-theme="light"] .table-dark-custom {
  --bs-table-bg: #ffffff;
  --bs-table-striped-bg: #f8fafc;
  --bs-table-hover-bg: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

[data-theme="light"] .table-dark-custom th {
  background-color: #f8fafc;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .table-dark-custom td {
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .auth-wrapper {
  background-color: #f8fafc;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(217, 119, 6, 0.08) 0%, transparent 50%),
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

[data-theme="light"] .auth-card {
  background: #ffffff;
  border: 1px solid rgba(217, 119, 6, 0.25);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 15px rgba(217, 119, 6, 0.06);
}

[data-theme="light"] .auth-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .auth-input:focus {
  border-color: var(--jin-gold) !important;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.25) !important;
}

[data-theme="light"] .otp-box-input {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: var(--jin-gold);
}

[data-theme="light"] .otp-box-input:focus {
  border-color: var(--jin-gold);
  box-shadow: 0 0 15px rgba(217, 119, 6, 0.3);
  background: #fffbeb;
}
