/* ============================================================
   COIN BNB - Main Frontend CSS
   ============================================================ */

/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --primary:      #1a6cff;
  --primary-dark: #0d4ecc;
  --success:      #00c851;
  --danger:       #ff3547;
  --warning:      #ffb400;
  --dark-bg:      #0d1117;
  --dark-card:    #161b22;
  --dark-border:  #30363d;
  --text-primary: #f0f6fc;
  --text-muted:   #8b949e;
  --nav-height:   60px;
  --header-height:56px;
}

/* --- Reset & Base --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  padding-bottom: calc(var(--nav-height) + 10px);
  font-size: 14px;
}

a { text-decoration: none; color: inherit; }
a:hover { color: var(--primary); }

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  background: var(--dark-bg);
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(26,108,255,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0,200,81,0.08) 0%, transparent 40%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Animated chart lines in background */
.auth-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('../images/bg-login.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.1;
  z-index: 0;
}

.auth-card {
  background: #1e2534;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

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

.auth-logo img {
  height: 48px;
}

.auth-logo .site-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

.auth-title {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}

/* Auth form inputs */
.auth-input-group {
  position: relative;
  margin-bottom: 16px;
}

.auth-input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  z-index: 2;
}

.auth-input-group input,
.auth-input-group select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #fff;
  padding: 13px 14px 13px 42px;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

.auth-input-group input::placeholder {
  color: var(--text-muted);
}

.auth-input-group input:focus,
.auth-input-group select:focus {
  border-color: var(--primary);
  background: rgba(26,108,255,0.08);
}

.auth-input-group select option {
  background: #1e2534;
  color: #fff;
}

.btn-auth {
  width: 100%;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.btn-auth:hover  { background: var(--primary-dark); }
.btn-auth:active { transform: scale(0.99); }

.auth-link {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-link a {
  color: var(--primary);
  font-weight: 600;
}

.auth-error {
  background: rgba(255,53,71,0.15);
  border: 1px solid rgba(255,53,71,0.3);
  border-radius: 8px;
  color: #ff6b6b;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-success {
  background: rgba(0,200,81,0.15);
  border: 1px solid rgba(0,200,81,0.3);
  border-radius: 8px;
  color: #00c851;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ============================================================
   TOP HEADER (Frontend)
   ============================================================ */
.top-header {
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.top-header .logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-header .logo img {
  height: 32px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* ============================================================
   QUICK ACTION BUTTONS (Home page top row)
   ============================================================ */
.quick-actions {
  display: flex;
  justify-content: space-around;
  padding: 16px 12px 10px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: transform 0.1s, box-shadow 0.2s;
}

.quick-btn:hover { transform: translateY(-2px); }
.quick-btn:active { transform: scale(0.97); }

.quick-btn .icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.quick-btn.recharge   .icon-circle { background: rgba(26,108,255,0.1);  color: var(--primary);  }
.quick-btn.withdraw   .icon-circle { background: rgba(255,165,0,0.12); color: #ff8c00; }
.quick-btn.support    .icon-circle { background: rgba(0,200,81,0.12);  color: var(--success);  }

.quick-btn.recharge  { color: var(--primary);  }
.quick-btn.withdraw  { color: #ff8c00; }
.quick-btn.support   { color: var(--success);  }

/* ============================================================
   COIN LIST TABLE
   ============================================================ */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: #8a9bb0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px 6px;
  background: #fff;
}

.coin-table-wrap {
  background: #fff;
  overflow-x: auto;
}

.coin-table {
  width: 100%;
  border-collapse: collapse;
}

.coin-table thead th {
  background: #f8f9fc;
  color: #8a9bb0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f4;
  white-space: nowrap;
}

.coin-table tbody tr {
  border-bottom: 1px solid #f5f7fa;
  cursor: pointer;
  transition: background 0.15s;
}

.coin-table tbody tr:hover {
  background: #f8f9ff;
}

.coin-table tbody td {
  padding: 13px 14px;
  vertical-align: middle;
}

.coin-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
}

.coin-icon-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.coin-name-text {
  font-weight: 600;
  font-size: 14px;
  color: #1a202c;
}

.coin-symbol-text {
  font-size: 11px;
  color: #8a9bb0;
  margin-top: 1px;
}

.coin-price {
  font-weight: 600;
  font-size: 14px;
  color: #1a202c;
}

.change-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.change-badge.badge-up   { background: rgba(0,200,81,0.12);  color: #00a843; }
.change-badge.badge-down { background: rgba(255,53,71,0.12); color: #e62b3c; }

/* ============================================================
   BOTTOM NAVIGATION BAR
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #fff;
  border-top: 1px solid #e8ecf0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 8px;
  z-index: 999;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  height: var(--nav-height);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  color: #111;
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: color 0.2s;
  cursor: pointer;
  min-width: 50px;
  text-align: center;
}

.nav-item i {
  font-size: 20px;
  transition: transform 0.2s;
}

.nav-item:hover      { color: #222; }
.nav-item:hover i    { transform: translateY(-2px); }
.nav-item.active     { color: #111; }
.nav-item.active i   { transform: translateY(-2px); }

/* ============================================================
   BLUE BANNER (Account / Assets pages)
   ============================================================ */
.blue-banner {
  background: linear-gradient(135deg, #1a6cff 0%, #0d4ecc 100%);
  color: #fff;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.blue-banner::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.blue-banner::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.banner-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  object-fit: cover;
}

.banner-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.9;
}

.banner-balance {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.banner-label {
  font-size: 12px;
  opacity: 0.8;
}

/* ============================================================
   MENU LIST (Account page)
   ============================================================ */
.menu-list {
  background: #fff;
  border-radius: 12px;
  margin: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #f5f7fa;
  cursor: pointer;
  text-decoration: none;
  color: #2c3e50;
  transition: background 0.15s;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:hover      { background: #f8f9ff; }

.menu-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 14px;
  flex-shrink: 0;
}

.menu-item-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.menu-item-arrow {
  color: #c0c9d6;
  font-size: 18px;
}

/* ============================================================
   CARD (General)
   ============================================================ */
.bnb-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  margin: 12px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.bnb-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #8a9bb0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* ============================================================
   ASSETS TABLE
   ============================================================ */
.asset-table {
  width: 100%;
  border-collapse: collapse;
}

.asset-table tr {
  border-bottom: 1px solid #f5f7fa;
}

.asset-table tr:last-child { border-bottom: none; }

.asset-table td {
  padding: 12px 4px;
  font-size: 14px;
}

.asset-table td:last-child {
  text-align: right;
  color: var(--success);
  font-weight: 600;
}

/* ============================================================
   FORM STYLES
   ============================================================ */
.form-section {
  padding: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: #2c3e50;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,108,255,0.1);
}

.btn-primary-full {
  width: 100%;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary-full:hover { background: var(--primary-dark); }

/* ============================================================
   MARKET PAGE
   ============================================================ */
.market-header {
  background: #0d1117;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.duration-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: #0d1117;
  overflow-x: auto;
  scrollbar-width: none;
}

.duration-tabs::-webkit-scrollbar { display: none; }

.duration-tab {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  background: transparent;
}

.duration-tab.active,
.duration-tab:hover {
  background: #ff8c00;
  border-color: #ff8c00;
  color: #fff;
}

.coin-selector {
  background: #161b22;
  border: 1px solid #30363d;
  color: #f0f6fc;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.coin-selector option { background: #161b22; }

#tradingview_chart {
  width: 100%;
  min-height: 400px;
}

.trade-actions {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
}

.btn-buy-up, .btn-buy-down {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-buy-up   { background: var(--success); color: #fff; }
.btn-buy-down { background: var(--danger);  color: #fff; }

.btn-buy-up:hover   { opacity: 0.9; }
.btn-buy-down:hover { opacity: 0.9; }
.btn-buy-up:active,
.btn-buy-down:active { transform: scale(0.98); }

/* Trade History */
.trade-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.trade-history-table th {
  background: #f8f9fc;
  padding: 8px 10px;
  text-align: left;
  color: #8a9bb0;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

.trade-history-table td {
  padding: 10px;
  border-bottom: 1px solid #f5f7fa;
}

/* ============================================================
   TRADE POPUP / DRAWER
   ============================================================ */
.trade-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  animation: fadeIn 0.2s ease;
}

.trade-overlay.active { display: block; }

.trade-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  z-index: 1001;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trade-drawer.active { transform: translateY(0); }

.drawer-handle {
  width: 40px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin: 0 auto 20px;
}

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 20px;
}

.direction-indicator {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.direction-indicator.up   { background: rgba(0,200,81,0.12);  color: #00a843; }
.direction-indicator.down { background: rgba(255,53,71,0.12); color: #e62b3c; }

.amount-quick-btns {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.amount-quick-btn {
  flex: 1;
  background: #f0f4ff;
  border: 1px solid #d0dbff;
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.amount-quick-btn:hover { background: var(--primary); color: #fff; }

.trade-notes {
  background: #fff9e6;
  border: 1px solid #ffe082;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 16px;
}

.trade-notes p {
  font-size: 12px;
  color: #7a6000;
  margin-bottom: 4px;
  padding-left: 14px;
  position: relative;
}

.trade-notes p::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #ff8c00;
}

.trade-notes p:last-child { margin-bottom: 0; }

/* Balance display in drawer */
.balance-display {
  background: #f8f9fc;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.balance-display .label { color: #8a9bb0; }
.balance-display .value { font-weight: 700; color: var(--primary); }

/* ============================================================
   ORDERS PAGE
   ============================================================ */
.page-header {
  background: linear-gradient(135deg, #1a6cff, #0d4ecc);
  color: #fff;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.orders-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
}

.orders-tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #8a9bb0;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.orders-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.orders-content {
  background: #fff;
}

.order-card {
  border-bottom: 1px solid #f5f7fa;
  padding: 14px 16px;
}

.order-card:last-child { border-bottom: none; }

.order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.order-row:last-child { margin-bottom: 0; }

.order-label { color: #8a9bb0; }
.order-value { font-weight: 500; color: #2c3e50; }

.profit-positive { color: var(--success); font-weight: 700; }
.profit-negative { color: var(--danger);  font-weight: 700; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #8a9bb0;
}

.empty-state i {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ============================================================
   WITHDRAW PAGE
   ============================================================ */
.withdraw-info-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px;
  background: #f8f9fc;
}

.info-box {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.info-box .label {
  font-size: 11px;
  color: #8a9bb0;
  margin-bottom: 4px;
}

.info-box .value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.animate-in { animation: slideUp 0.3s ease forwards; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 576px) {
  .auth-card { padding: 28px 20px; }
  .blue-banner { padding: 18px 16px; }
  .banner-balance { font-size: 22px; }
}

@media (min-width: 768px) {
  body { max-width: 480px; margin: 0 auto; }
  
  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-success-bnb { color: var(--success) !important; }
.text-danger-bnb  { color: var(--danger)  !important; }
.text-primary-bnb { color: var(--primary) !important; }
.fw-700 { font-weight: 700 !important; }
.mt-page { margin-top: 16px; }