/* ====================================================
   DASHBOARD STYLES – USING GLOBAL EXCHANGE THEME
   Light theme in :root, dark theme via [data-theme="dark"]
==================================================== */

/* ==================== THEME VARIABLES ==================== */
:root {
  /* Brand + semantic colors (same as previous page) */
  --primary: #21808D;
  --primary-gradient: linear-gradient(135deg, #21808D 0%, #1A686F 100%);
  --success: #28a745;
  --warning: #ffc107;
  --error: #dc3545;

  /* Light theme surfaces & text (default) */
  --bg: #FCFCF9;
  --surface: #FFFFFF;
  --border: rgba(0, 0, 0, 0.08);
  --text-primary: #1F2121;
  --text-secondary: #626C6C;
  --text-muted: #A7A9A9;

  /* Elevation */
  --shadow: 0 8px 16px rgba(0, 0, 0, 0.12);

  /* Shape & spacing */
  --radius: 12px;
  --radius-sm: 6px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Motion */
  --transition: all 0.25s ease;
}

/* Dark theme overrides – match previous page behavior */
[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a1f2e;
  --border: rgba(255, 255, 255, 0.1);
  --text-primary: #FCFCF9;
  --text-secondary: #A7A9A9;
  --text-muted: #A7A9A9;
  --shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==================== HEADER ==================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  backdrop-filter: blur(20px);
}

.header-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: var(--transition);
}

.header-hamburger:hover {
  color: var(--primary);
  transform: scale(1.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notification-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: var(--transition);
}

.notification-btn:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--error);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 380px;
  max-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  overflow: hidden;
  z-index: 100;
}

.notification-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-header h3 {
  font-size: 1rem;
  color: var(--text-primary);
}

.notification-header button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.875rem;
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.notification-item:hover {
  background: rgba(33, 128, 141, 0.05);
}

.notification-item.read {
  opacity: 0.6;
}

.notification-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.notification-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--primary);
}

.logout-btn {
  background: var(--primary-gradient);
  border: none;
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(33, 128, 141, 0.3);
}

/* ==================== OVERLAY ==================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition);
}

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

/* ==================== MAIN LAYOUT ==================== */
.main-layout {
  display: flex;
  margin-top: 70px;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 70px;
  width: 260px;
  height: calc(100vh - 70px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 0;
  overflow-y: auto;
  z-index: 9999 !important;
  opacity: 1 !important;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: var(--primary-gradient);
  border-radius: 0 4px 4px 0;
  transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary);
  background: rgba(33, 128, 141, 0.05);
}

.nav-item.active::before {
  height: 40px;
}

.nav-item i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.nav-item span {
  font-weight: 500;
}

/* Main Content */
main {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
  min-height: calc(100vh - 70px);
}

main>section {
  display: none;
}

main>section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== SECTION HEADER ==================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.card h3 {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-change {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.card-change.positive {
  color: var(--success);
}

.card-change.negative {
  color: var(--error);
}

.card-change i {
  margin-right: 0.25rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ==================== ACTIVITY FEED ==================== */
.activity-feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.activity-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.activity-item:hover {
  background: rgba(33, 128, 141, 0.05);
}

.activity-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon.completed {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.activity-icon.pending {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning);
}

.activity-icon.cancelled {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error);
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.activity-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.activity-status {
  text-align: right;
}

.activity-amount {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

/* ==================== CONVERSION FORM ==================== */
.conversion-container {
  max-width: 800px;
  margin: 0 auto;
}

.conversion-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.mode-toggle .btn {
  flex: 1;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  position: relative;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.step.active .step-circle {
  background: var(--primary-gradient);
  border-color: var(--primary);
  color: white;
}

.step.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step span {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.step.active span {
  color: var(--primary);
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 0.5rem;
  margin-bottom: 1.5rem;
}

/* Step Content */
.step-content {
  display: none;
}

.step-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.form-section {
  margin-bottom: 2rem;
}

.form-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Currency Selector */
.currency-selector {
  position: relative;
  margin-bottom: 1.5rem;
}

.currency-trigger {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}

.currency-trigger:hover {
  border-color: var(--primary);
}

.currency-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.currency-icon-wrapper {
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.currency-icon {
  font-size: 1.5rem;
}

.currency-details {
  text-align: left;
}

.currency-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.currency-price {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.currency-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 400px;
  overflow: hidden;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
}

.currency-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-search {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  font-size: 1rem;
}

.dropdown-list {
  max-height: 320px;
  overflow-y: auto;
}

.currency-option {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}

.currency-option:hover {
  background: rgba(33, 128, 141, 0.05);
}

.currency-option.active {
  background: rgba(33, 128, 141, 0.1);
  border-left: 3px solid var(--primary);
}

/* ==================== NETWORK SELECTOR ==================== */
.network-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.network-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
}

.network-option:hover {
  border-color: var(--primary);
}

.network-option.active {
  border-color: var(--primary);
  background: rgba(33, 128, 141, 0.05);
}

.network-info {
  flex: 1;
}

.network-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.network-fee {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ==================== WARNING BOX ==================== */
.warning-box {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  gap: 1rem;
}

.warning-icon {
  color: var(--warning);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.warning-content h4 {
  color: var(--warning);
  margin-bottom: 0.5rem;
}

.warning-content p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ==================== AMOUNT SECTION ==================== */
.amount-section {
  margin-top: 1.5rem;
}

.amount-input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.amount-label {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 1rem;
}

.amount-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  padding-right: 5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.amount-input:focus {
  border-color: var(--primary);
}

/* ==================== RATE PREVIEW ==================== */
.rate-preview {
  background: rgba(33, 128, 141, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
}

.rate-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.rate-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.rate-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rate-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.rate-detail:last-child {
  border-bottom: none;
}

.rate-detail span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.rate-detail strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==================== PAYOUT METHODS ==================== */
.payout-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.method-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.method-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.method-card.active {
  border-color: var(--primary);
  background: rgba(33, 128, 141, 0.05);
}

.method-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  margin: 0 auto 1rem;
}

.method-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.method-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.method-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Payout Form */
.payout-form {
  display: none;
}

.payout-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input,
.form-select {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--primary);
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(33, 128, 141, 0.3);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-full {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-group .btn {
  flex: 1;
}

/* ==================== BADGES ==================== */
.status-badge,
.type-badge {
  padding: 0.375rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.completed {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

.status-badge.pending {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning);
}

.status-badge.cancelled {
  background: rgba(220, 53, 69, 0.1);
  color: var(--error);
}

.type-badge.sell {
  background: rgba(33, 128, 141, 0.1);
  color: var(--primary);
}

.type-badge.buy {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
}

/* ==================== HISTORY ==================== */

/* Card box */
.history-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Search + filters */
.history-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.history-search {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem 0.75rem 3rem;
  color: var(--text-primary);
  outline: none;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-chip.active,
.filter-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Hint */
.history-scroll-hint {
  margin: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* SCROLL WRAPPER */
.history-table-scroll {
  width: 100%;
  max-width: 900px;
  /* narrower than content to force scroll */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 auto;
  /* center it inside the card */
}

/* Inner container – structural */
.history-table-container {
  width: 100%;
}

/* TABLE – wider than wrapper; colors match card */
.history-table {
  width: 1600px;
  /* way wider than 800px wrapper */
  border-collapse: collapse;
  background: var(--surface);
  /* match card background */
}

.history-table thead {
  background: rgba(33, 128, 141, 0.05);
}

.history-table th,
.history-table td {
  padding: 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-primary);
  text-align: left;
}

.history-row:hover {
  background: rgba(33, 128, 141, 0.05);
}

.order-id {
  color: var(--primary);
  font-weight: 600;
}

.action-btn {
  background: var(--primary-gradient);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== MOBILE ADJUSTMENTS ==================== */
@media (max-width: 768px) {

  /* Make the whole history card narrower than the screen */
  #history .history-container {
    max-width: 92vw;
    /* or 90vw if you want more padding */
    margin: 0 auto 1rem;
    /* center it with side space */
    padding: 1rem;
  }

  .history-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Keep table slightly wider than card so it scrolls horizontally */
  .history-table {
    width: 700px;
    /* adjust between ~650–800 to taste */
    border-collapse: collapse;
  }
}


/* ==================== ACCOUNT SECTION ==================== */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.account-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

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

.profile-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-value {
  color: var(--text-primary);
  font-weight: 600;
}

.profile-value.positive {
  color: var(--success);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-switch input {
  display: none;
}

.toggle-switch.checked {
  background: var(--primary);
}

.toggle-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch.checked .toggle-knob {
  left: 24px;
}

/* ==================== BOTTOM NAV (MOBILE) ==================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface) !important;
  border-top: 1px solid var(--border);
  z-index: 9999 !important;
  opacity: 1 !important;
  backdrop-filter: blur(20px);
}

.bottom-nav-list {
  display: flex;
  list-style: none;
  justify-content: space-around;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item i {
  font-size: 1.25rem;
}

.bottom-nav-item span {
  font-size: 0.75rem;
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

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

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

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

.toast.info {
  border-left: 4px solid var(--primary);
}

.toast i {
  font-size: 1.5rem;
}

.toast.success i {
  color: var(--success);
}

.toast.error i {
  color: var(--error);
}

.toast.warning i {
  color: var(--warning);
}

.toast.info i {
  color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    top: 0 !important;
    height: 100vh !important;
    z-index: 10000 !important;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  main {
    margin-left: 0;
  }

  .header-hamburger {
    display: block;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0 1rem;
  }

  .logo span {
    font-size: 0.85rem;
    /* slightly smaller */
    padding-right: 5px;
  }

  .logout-text {
    display: none;
  }

  main {
    padding: 1rem;
    padding-bottom: 80px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .conversion-form {
    padding: 1rem;
  }

  .step-indicator {
    padding: 0;
  }

  .step span {
    display: none;
  }

  .step-connector {
    margin-bottom: 0;
  }

  .payout-methods {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: block;
  }

  .notification-dropdown {
    width: calc(100vw - 2rem);
    right: 1rem;
  }

  .history-header {
    flex-direction: column;
  }

  .history-table-container {
    overflow-x: scroll;
  }



  .toast {
    right: 1rem;
    left: 1rem;
    bottom: 90px;
  }
}

@media (max-width: 480px) {
  .mode-toggle {
    flex-direction: column;
  }

  .card-value {
    font-size: 1.5rem;
  }

  .rate-value {
    font-size: 1.5rem;
  }

  .amount-input {
    font-size: 1.25rem;
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}


.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
  color: #fff;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.loading-text {
  font-size: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20000 !important;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem 1.75rem;
  position: relative;

  /* NEW: responsive height */
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}


.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.modal-title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-section {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.modal-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.modal-json {
  margin-top: 0.5rem;
  max-height: 160px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.modal-details-list .modal-row.small {
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

/* ==================== RATE PREVIEW CARD ==================== */
.rate-preview {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.rate-preview-header {
  background: var(--primary-gradient);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.rate-preview-title {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rate-preview-value {
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.rate-preview-body {
  padding: 1.25rem;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.rate-row:last-child {
  border-bottom: none;
  padding-top: 1.125rem;
  margin-top: 0.5rem;
  border-top: 2px solid var(--border);
}

.rate-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  flex-shrink: 0;
}

.rate-label i {
  color: var(--primary);
  font-size: 0.85rem;
  width: 16px;
  flex-shrink: 0;
}

.rate-amount {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.rate-amount.fee {
  color: var(--error);
}

.rate-row.total .rate-label {
  font-weight: 600;
  color: var(--primary);
  font-size: 1rem;
}

.rate-row.total .rate-amount {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.125rem;
}

/* Tablet adjustments */
@media (max-width: 768px) {
  .rate-preview {
    margin-top: 1rem;
  }

  .rate-preview-header {
    padding: 0.875rem 1rem;
    flex-wrap: wrap;
  }

  .rate-preview-title {
    font-size: 0.85rem;
  }

  .rate-preview-value {
    font-size: 0.85rem;
    padding: 0.325rem 0.75rem;
  }

  .rate-preview-body {
    padding: 1rem;
  }

  .rate-row {
    padding: 0.75rem 0;
    gap: 0.75rem;
  }

  .rate-label {
    font-size: 0.8rem;
  }

  .rate-amount {
    font-size: 0.85rem;
  }

  .rate-row.total .rate-label {
    font-size: 0.9rem;
  }

  .rate-row.total .rate-amount {
    font-size: 1rem;
  }
}

/* Mobile phone adjustments */
@media (max-width: 480px) {
  .rate-preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .rate-preview-value {
    align-self: flex-end;
    width: auto;
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
  }

  .rate-preview-body {
    padding: 1rem 0.75rem;
  }

  .rate-row {
    padding: 0.65rem 0;
    gap: 0.5rem;
  }

  .rate-label {
    font-size: 0.75rem;
    gap: 0.375rem;
  }

  .rate-label i {
    font-size: 0.7rem;
    width: 14px;
  }

  .rate-amount {
    font-size: 0.8rem;
  }

  .rate-row.total .rate-label {
    font-size: 0.85rem;
  }

  .rate-row.total .rate-amount {
    font-size: 0.95rem;
  }
}

/* Extra small phones */
@media (max-width: 360px) {
  .rate-preview-header {
    padding: 0.65rem 0.75rem;
  }

  .rate-preview-body {
    padding: 0.875rem 0.65rem;
  }

  .rate-label {
    font-size: 0.7rem;
  }

  .rate-label i {
    font-size: 0.65rem;
    width: 12px;
  }

  .rate-amount {
    font-size: 0.75rem;
  }

  .rate-row.total .rate-label {
    font-size: 0.8rem;
  }

  .rate-row.total .rate-amount {
    font-size: 0.9rem;
  }
}

/* Lottie Loading Overlay - Glassmorphism Bubble */
.lottie-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lottie-loading-overlay.active {
  display: flex;
}

.lottie-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 2.5rem;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#lottieAnimationContainer {
  width: 200px;
  height: 200px;
  display: flex;
  /* <-- IMPORTANT */
  align-items: center;
  /* <-- IMPORTANT */
  justify-content: center;
  /* <-- IMPORTANT */
}



/* Theme-Matched Modal Design */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20000 !important;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg);
  border-radius: var(--radius, 12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: var(--border);
  transform: rotate(90deg);
}

.modal-header-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark, var(--primary)) 100%);
  padding: 1.5rem 1.75rem;
  border-radius: var(--radius, 12px) var(--radius, 12px) 0 0;
  color: white;
}

.modal-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
}

.modal-body {
  padding: 1.25rem;
  background: var(--bg);
}

.info-card,
.money-card,
.details-card {
  background: var(--surface);
  border-radius: var(--radius, 12px);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title i {
  font-size: 0.9rem;
  color: var(--primary);
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.modal-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.modal-row.highlight {
  background: var(--primary-light, rgba(33, 128, 141, 0.1));
  margin: 0 -0.5rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  border-bottom: none;
}

.modal-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending {
  background: var(--warning-light, #fff3cd);
  color: var(--warning, #856404);
}

.status-completed,
.status-success {
  background: var(--success-light, #d4edda);
  color: var(--success, #155724);
}

.status-rejected,
.status-failed {
  background: var(--danger-light, #f8d7da);
  color: var(--danger, #721c24);
}

.status-processing {
  background: var(--info-light, #d1ecf1);
  color: var(--info, #0c5460);
}

.amount-highlight {
  font-size: 1.5rem !important;
  color: var(--success, #28a745) !important;
  font-weight: 700 !important;
}

.fee-amount {
  color: var(--danger, #dc3545) !important;
}

.modal-details-list {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.modal-row.small {
  padding: 0.4rem 0;
  font-size: 0.85rem;
}

.modal-row.small .modal-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-row.small .modal-value {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-primary);
}

/* Scrollbar Styling */
.modal-dialog::-webkit-scrollbar {
  width: 6px;
}

.modal-dialog::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 10px;
}

.modal-dialog::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.modal-dialog::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.step span {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.2;
  max-width: 100px;
  text-align: center !important;
}

.step-connector {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--border-color), var(--primary));
  margin: 0 12px;
}

.currency-icon-img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.currency-icon-wrapper {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--border-color);
}

.currency-option.active .currency-icon-wrapper {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.payout-method-icon {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.payout-method-card:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

/* ============================================
   NOTIFICATION PERMISSION MODAL
   ============================================ */

.notification-modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 450px;
  width: 90%;
  box-shadow: var(--shadow);
  position: relative;
  text-align: center;
}

.notification-icon-container {
  margin-bottom: 1.5rem;
}

.notification-bell-animation {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: notificationPulse 2s infinite;
}

.notification-bell-animation i {
  font-size: 2.5rem;
  color: white;
  animation: bellRing 1s ease-in-out infinite;
}

.notification-modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.notification-modal-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.notification-features {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.feature-item:last-child {
  margin-bottom: 0;
}

.feature-item i {
  color: var(--success);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notification-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-enable-notifications {
  box-shadow: 0 4px 15px rgba(33, 128, 141, 0.3);
}

.btn-enable-notifications:hover {
  box-shadow: 0 6px 20px rgba(33, 128, 141, 0.4);
}

.btn-maybe-later {
  background: transparent;
  border: 2px solid transparent;
}

.btn-maybe-later:hover {
  background: var(--bg);
  border-color: transparent;
}

.notification-privacy {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
}

.notification-privacy i {
  color: var(--success);
}

/* Animations */
@keyframes notificationPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes bellRing {

  0%,
  100% {
    transform: rotate(0deg);
  }

  10%,
  30% {
    transform: rotate(-10deg);
  }

  20%,
  40% {
    transform: rotate(10deg);
  }

  50% {
    transform: rotate(0deg);
  }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .notification-modal-dialog {
    padding: 2rem 1.5rem;
  }

  .notification-modal-title {
    font-size: 1.5rem;
  }

  .notification-bell-animation {
    width: 70px;
    height: 70px;
  }

  .notification-bell-animation i {
    font-size: 2rem;
  }
}