/* Bitsphere-inspired Dark Theme with Futuristic Digital Touch */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark futuristic palette inspired by Bitsphere */
  --primary: #0066ff;
  --primary-light: #3b82f6;
  --primary-dark: #0052cc;
  
  --secondary: #00d4ff;
  --accent: #06b6d4;
  --accent-glow: #00d4ff;
  
  /* Danger & Success */
  --danger: #ff3366;
  --success: #00d966;
  
  /* Dark backgrounds */
  --background: #0a0e27;
  --surface: #141829;
  --surface-light: #1a1f3a;
  --surface-lighter: #21273f;
  
  /* Text colors */
  --text-primary: #e8eef7;
  --text-secondary: #9ba3c1;
  --text-tertiary: #6b7599;
  
  /* Borders & Effects */
  --border: #2a3154;
  --border-light: #1f2642;
  --border-glow: #0066ff;
  
  /* Gradients - Futuristic */
  --gradient-primary: linear-gradient(135deg, #0066ff 0%, #00d4ff 100%);
  --gradient-secondary: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%);
  --gradient-accent: linear-gradient(135deg, #00d966 0%, #00d4ff 100%);
  --gradient-dark: linear-gradient(135deg, #141829 0%, #0a0e27 100%);
  
  /* Glow effects */
  --glow-blue: 0 0 20px rgba(0, 102, 255, 0.3);
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-danger: 0 0 20px rgba(255, 51, 102, 0.3);
  
  /* Shadows */
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 102, 255, 0.15);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.3px;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p, li, span, small {
  font-size: 1rem;
  line-height: 1.7;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  box-shadow: var(--glow-blue);
}

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

header {
  background: linear-gradient(180deg, var(--surface-light) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  background-color: rgba(20, 24, 41, 0.9);
}

header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  text-shadow: 0 0 30px rgba(0, 102, 255, 0.2);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 3rem;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  font-weight: 600;
  position: relative;
}

nav a::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
  box-shadow: var(--glow-blue);
}

nav a:hover {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(0, 102, 255, 0.5);
}

nav a:hover::before {
  width: 100%;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
}

section:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
  background: linear-gradient(135deg, var(--surface-lighter) 0%, var(--surface-light) 100%);
}

section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: -0.5px;
  position: relative;
  padding-bottom: 1rem;
}

section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
  box-shadow: var(--glow-blue);
}

section h3 {
  font-size: 1.4rem;
  margin: 2rem 0 1.25rem 0;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Form elements */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(0, 102, 255, 0.2);
  background: var(--surface-light);
}

/* Buttons */
.btn {
  padding: 0.875rem 2rem;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transition: left 0.3s ease;
  z-index: -1;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--glow-blue);
}

.btn-primary:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(0, 102, 255, 0.4);
}

.btn-success {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--glow-cyan);
}

.btn-success:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ff3366 0%, #ff6b9d 100%);
  color: white;
  box-shadow: var(--glow-danger);
}

.btn-danger:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(255, 51, 102, 0.4);
}

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

.btn-secondary:hover {
  background: var(--surface-light);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--glow-blue);
}

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

.balance-card {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(0, 102, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.balance-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
}

.balance-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px);
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--surface-lighter) 100%);
}

.balance-label {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.balance-amount {
  font-size: 2.25rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(0, 102, 255, 0.2);
}

.balance-symbol {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

thead {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

th {
  padding: 1.25rem 1rem;
  text-align: left;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:hover {
  background: var(--surface-light);
  transition: background 0.2s ease;
}

/* Transaction list */
.transaction-list {
  margin-top: 1rem;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.transaction-item:hover {
  background: var(--surface-light);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 2rem;
  padding-right: 2rem;
}

.transaction-type {
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.transaction-amount {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.05rem;
}

.transaction-time {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* Price display */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-top: 1rem;
}

.price-card {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.price-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.price-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px);
}

.price-symbol {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.price-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}

/* Form rows */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

/* Footer */
footer {
  background: linear-gradient(180deg, var(--surface) 0%, var(--background) 100%);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4rem;
}

/* Messages */
.message {
  padding: 1.25rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border-left: 4px solid;
  font-weight: 500;
}

.message.success {
  background: rgba(0, 217, 102, 0.1);
  border-left-color: var(--success);
  color: var(--success);
}

.message.error {
  background: rgba(255, 51, 102, 0.1);
  border-left-color: var(--danger);
  color: var(--danger);
}

/* Link styling */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-light);
  text-shadow: 0 0 10px rgba(0, 102, 255, 0.3);
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.5rem 0;
}

.back-link:hover {
  color: var(--primary);
  transform: translateX(-4px);
}

/* Selection color */
::selection {
  background: var(--primary);
  color: white;
}

/* Responsive */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  header h1 {
    font-size: 1.3rem;
    text-align: center;
  }

  nav {
    width: 100%;
  }

  nav ul {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
  }

  main {
    padding: 0 0.75rem;
    max-width: 100%;
  }

  section {
    padding: 1rem;
    margin: 1rem 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  section h2,
  section h3,
  section p,
  label {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .account-summary,
  .form-row,
  .price-grid,
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 1rem !important;
  }

  /* Global form fit */
  form,
  .form-group,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    padding: 0.75rem 0.85rem !important;
    font-size: 16px !important;
  }

  /* Global button fit */
  .button-group,
  div[style*="display: flex; gap: 1rem"],
  div[style*="display:flex; gap:1rem"],
  div[style*="display: flex; gap: 1.5rem"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .btn,
  .button-group .btn,
  .button-group a.btn,
  .button-group button,
  div[style*="display: flex; gap: 1rem"] .btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 46px !important;
    padding: 0.75rem 1rem !important;
    text-align: center !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.75rem;
  }

  nav ul {
    gap: 0.75rem;
  }

  nav a {
    font-size: 0.9rem;
  }

  main {
    padding: 0 0.5rem;
  }

  section {
    padding: 0.85rem;
    border-radius: 12px;
  }

  section h2 {
    font-size: 1.85rem;
  }

  .btn {
    font-size: 0.9rem !important;
    height: auto !important;
    min-height: 46px !important;
  }
}
