/* Import Inter font - must be at the top */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========================================
   TX Trading - Common Styles
   Shared CSS for all pages
======================================== */

/* CSS Variables - Match React index.css exactly */
:root {
  /* Light Theme Colors - Deep Teal/Cyan theme */
  --background: 180 15% 97%;
  --foreground: 180 40% 10%;
  --muted: 175 15% 94%;
  --muted-foreground: 175 15% 40%;
  --popover: 0 0% 100%;
  --popover-foreground: 180 40% 10%;
  --card: 0 0% 100%;
  --card-foreground: 180 40% 10%;
  --border: 175 20% 88%;
  --input: 175 20% 88%;
  --primary: 175 70% 30%;
  --primary-foreground: 0 0% 100%;
  --secondary: 175 20% 94%;
  --secondary-foreground: 180 40% 10%;
  --accent: 175 70% 30%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 75% 55%;
  --destructive-foreground: 0 0% 100%;
  --ring: 175 70% 30%;å
  --radius: 0.75rem;

  /* Auth gradient tokens */
  --auth-gradient-start: 180 75% 15%;
  --auth-gradient-mid: 175 70% 25%;
  --auth-gradient-end: 170 80% 40%;
}

/* Dark Theme - Match React dark mode exactly */
body.dark {
  --background: 180 40% 6%;
  --foreground: 175 20% 95%;
  --muted: 180 30% 15%;
  --muted-foreground: 175 20% 60%;
  --popover: 180 35% 10%;
  --popover-foreground: 175 20% 95%;
  --card: 180 35% 10%;
  --card-foreground: 175 20% 95%;
  --border: 180 30% 18%;
  --input: 180 30% 18%;
  --primary: 170 75% 45%;
  --primary-foreground: 180 40% 6%;
  --secondary: 180 30% 15%;
  --secondary-foreground: 175 20% 95%;
  --accent: 180 30% 15%;
  --accent-foreground: 175 20% 95%;
  --destructive: 0 60% 40%;
  --destructive-foreground: 175 20% 95%;
  --ring: 170 75% 45%;

  /* Auth gradient tokens */
  --auth-gradient-start: 180 75% 8%;
  --auth-gradient-mid: 175 70% 20%;
  --auth-gradient-end: 170 80% 35%;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
}


/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

/* ========================================
   Navbar Styles
======================================== */
.navbar {
  height: 64px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-content {
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

/* Logo icon with auth gradient - matches React */
.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    hsl(var(--auth-gradient-start)) 0%,
    hsl(var(--auth-gradient-mid)) 50%,
    hsl(var(--auth-gradient-end)) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
}

.logo-text {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-link:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

/* Active nav link - matches React: bg-primary/10 text-primary */
.nav-link.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

/* Theme Toggle */
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
body.dark .theme-toggle .sun-icon { display: block; }
body.dark .theme-toggle .moon-icon { display: none; }

/* Language Selector */
.language-selector {
  position: relative;
}

.language-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.language-btn:hover {
  background: hsl(var(--muted));
}

.lang-flag {
  font-size: 16px;
}

.lang-code {
  font-weight: 500;
}

.language-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 160px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
}

.language-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  color: hsl(var(--foreground));
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.language-option:hover {
  background: hsl(var(--muted));
}

.language-option.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.language-option .lang-name {
  flex: 1;
}

.language-option .check-icon {
  color: hsl(var(--primary));
}

/* User Avatar & Dropdown */
.user-dropdown {
  position: relative;
}

.avatar-btn {
  padding: 4px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.avatar-btn:hover {
  background: hsl(var(--muted));
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsl(var(--primary) / 0.1);
  border: 2px solid hsl(var(--primary) / 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary));
}

.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 200px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
}

.user-dropdown:hover .user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}

.user-menu-item:hover {
  background: hsl(var(--muted));
}

.user-menu-item.logout {
  color: hsl(var(--destructive));
}

.user-menu-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 8px 0;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 160px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
}

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

.dropdown-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: hsl(var(--muted));
}

/* Responsive utilities */
.desktop-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: flex; }
  .logo-text { display: none; }
}

/* ========================================
   Main Layout
======================================== */
.main-container {
  display: flex;
}

/* ========================================
   Sidebar Styles
======================================== */
.sidebar {
  min-height: calc(100vh - 64px);
  width: 305px;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
  transition: width 0.3s;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 64px;
}

.sidebar-header {
  padding: 12px;
  display: flex;
  justify-content: flex-end;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.sidebar-toggle .chevron-right { display: none; }
.sidebar.collapsed .sidebar-toggle .chevron-left { display: none; }
.sidebar.collapsed .sidebar-toggle .chevron-right { display: block; }

.sidebar-nav {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Sidebar item - parent menu without children (like overview, settings) */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.sidebar-item:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

/* Active state for items without children - solid primary background */
.sidebar-item.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.25);
}

/* Active state for collapsible parent items - light primary background */
.sidebar-collapsible > .sidebar-item.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  box-shadow: none;
}

.sidebar-collapsible > .sidebar-item.active svg {
  color: hsl(var(--primary));
}

.sidebar.collapsed .sidebar-item {
  padding: 12px;
  justify-content: center;
}

.sidebar.collapsed .sidebar-item-text,
.sidebar.collapsed .collapse-chevron {
  display: none;
}

/* Collapsible Menu */
.sidebar-collapsible .collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-collapsible.open .collapsible-content {
  max-height: 500px;
}

.sidebar-collapsible .collapse-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.sidebar-collapsible.open .collapse-chevron {
  transform: rotate(180deg);
}

.collapsible-content {
  margin-left: 16px;
  margin-top: 4px;
  padding-left: 16px;
  border-left: 2px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Sidebar sub-item - matches React: rounded-lg py-3 */
.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.sidebar-subitem:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.5);
}

/* Active sub-item - bg-primary/10 text-primary font-medium */
.sidebar-subitem.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-weight: 500;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
}

/* ========================================
   Content Area
======================================== */
.content {
  flex: 1;
  padding: 24px;
  overflow: auto;
  background: linear-gradient(135deg, hsl(var(--background)), hsl(var(--muted) / 0.2));
  min-height: calc(100vh - 64px);
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

/* ========================================
   Toast Notification
======================================== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 14px;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.success {
  background: hsl(142 76% 36%);
  color: white;
}

.toast.error {
  background: hsl(var(--destructive));
  color: white;
}

/* ========================================
   Card Component
======================================== */
.card {
  background: hsl(var(--card) / 0.8);
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.card-header {
  padding: 10px 24px;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.card-title svg {
  color: hsl(var(--primary));
}

.card-content {
  padding: 24px;
}

/* ========================================
   Form Elements
======================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.form-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-input {
  flex: 1;
}

/* Select */
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s;
}

.form-select:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.form-select option {
  background: hsl(var(--card));
  color: hsl(var(--foreground));
}

body.dark .form-select option {
  background: hsl(var(--card));
  color: hsl(var(--foreground));
}

.deposit-address-inline-form .form-input,
.deposit-address-inline-form .form-select {
  border-color: transparent;
  background: hsl(var(--card));
  border-radius: 999px;
}

.deposit-address-inline-form .form-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.deposit-address-inline-form .btn {
  border-radius: 999px;
  padding-inline: 20px;
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
  background: hsl(174 71% 36%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.3);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* ========================================
   Page Header
======================================== */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;

}

.page-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: hsl(var(--primary) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary));
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.page-desc {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  margin-top: 4px;
}

/* ========================================
   Alert/Notice
======================================== */
.alert {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.alert-warning {
  background: hsl(38 92% 50% / 0.1);
  border: 1px solid hsl(38 92% 50% / 0.2);
}

.alert-icon {
  flex-shrink: 0;
  color: hsl(38 92% 50%);
}

.alert-title {
  font-size: 14px;
  font-weight: 500;
  color: hsl(38 92% 50%);
  margin-bottom: 4px;
}

.alert-list {
  list-style: none;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

.alert-list li {
  margin-bottom: 4px;
}

/* ========================================
   Pagination
======================================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;

}

.pagination-info {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pagination .page,
.pagination .first,
.pagination .last,
.pagination .prev,
.pagination .next {
  display: inline-flex;
}

.pagination a,
.pagination span.current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  background: hsl(var(--card));
  transition: all 0.2s;
}

.pagination a:hover {
  background: hsl(var(--muted));
  border-color: hsl(var(--muted-foreground) / 0.3);
}

.pagination span.current {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  font-weight: 500;
}

.pagination span.gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  color: hsl(var(--muted-foreground));
}

@media (max-width: 768px) {
  .pagination-bar {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .pagination-buttons {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   Modal
======================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

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

.modal {
  background: hsl(var(--card));
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: hsl(var(--foreground));
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ========================================
   Action Buttons
======================================== */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-buttons form,
.action-buttons .button_to {
  margin: 0;
  display: inline-flex;
}
