/* =====================================================
   UTRADE PAGE — CSS
   Pixel-matched to the client reference design.
   ===================================================== */

/* ── Variables ──────────────────────────────────────── */
:root {
  --green-primary:   #157948;
  --green-dark:      #0e5c37;
  --green-light:     #29a066;
  --yellow-btn:      #febb02;
  --blue-card:       #2095df;
  --blue-card-dark:  #1a7ec0;
  --white:           #ffffff;
  --text-dark:       #1a1a1a;
  --text-muted:      #777777;
  --text-green:      #29a066;
  --text-red:        #e63946;
  --border-light:    #eeeeee;
  --bg-top:          #6db995;
  --bg-bottom:       #e8edea;
  --shadow-card:     0 4px 20px rgba(0,0,0,0.10);
  --radius-card:     20px;
  --radius-btn:      25px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(to bottom, var(--bg-top) 0%, var(--bg-bottom) 45%, var(--bg-bottom) 100%);
  min-height: 100vh;
  color: var(--text-dark);
}

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
.ut-header {
  background-color: var(--green-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

/* Logo */
.ut-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.ut-logo-text {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
}

.ut-logo-u {
  color: var(--yellow-btn);
}

/* Nav */
.ut-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.ut-nav-link {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
}

.ut-nav-link:hover { opacity: 0.8; }

.ut-logout-btn {
  background-color: var(--yellow-btn);
  color: var(--text-dark);
  padding: 8px 22px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.ut-logout-btn:hover {
  background-color: #e5a800;
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════
   PAGE LAYOUT
══════════════════════════════════════════════════════ */
.ut-layout {
  display: flex;
  gap: 20px;
  padding: 22px 36px 30px;
  max-width: 1380px;
  margin: 0 auto;
  align-items: flex-start;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.ut-sidebar {
  width: 210px;
  min-width: 210px;
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  box-shadow: var(--shadow-card);
  position: relative;
}

/* User profile */
.ut-user-profile {
  text-align: center;
  margin-bottom: 18px;
}

.ut-avatar {
  width: 56px;
  height: 56px;
  background: #eeeeee;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

.ut-avatar svg {
  width: 30px;
  height: 30px;
}

.ut-username {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sidebar buttons */
.ut-sidebar-btn {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-btn);
  border: 2px solid var(--green-primary);
  background: var(--white);
  color: var(--green-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  line-height: 1.3;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 10px;
  display: block;
}

.ut-sidebar-btn:hover {
  background: rgba(21,121,72,0.06);
}

.ut-sidebar-btn--active {
  background: var(--green-primary);
  color: var(--white);
  border-color: var(--green-primary);
  font-size: 0.82rem;
  padding: 14px 12px;
}

.ut-sidebar-btn--active:hover {
  background: var(--green-dark);
}

/* Locked feature area */
.ut-locked-area {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding-bottom: 2px;
}

/* Loyalty box */
.ut-loyalty-box {
  background: var(--green-primary);
  color: var(--white);
  border-radius: 16px;
  padding: 16px 14px;
  text-align: center;
  margin-top: 4px;
  margin-bottom: 2px;
}

.ut-loyalty-title {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.9;
}

.ut-loyalty-value {
  font-size: 1rem;
  font-weight: 700;
}

/* Assistance button */
.ut-assistance-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  border: 1.5px solid var(--green-primary);
  background: var(--white);
  color: var(--green-primary);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  margin-top: 14px;
  transition: background 0.2s;
}

.ut-assistance-btn:hover {
  background: rgba(21,121,72,0.06);
}

/* ══════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════ */
.ut-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

/* ── Top Row ─────────────────────────────────────── */
.ut-top-row {
  display: flex;
  gap: 18px;
  height: 250px;
}

/* ── Portfolio Card (Blue) ──────────────────────── */
.ut-portfolio-wrap {
  flex: 1.2;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.ut-portfolio-card {
  width: 100%;
  height: 100%;
  background: var(--blue-card);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

/* Subtle inner glow */
.ut-portfolio-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}

.ut-portfolio-info {
  flex: 1;
  min-width: 0;
}

.ut-welcome-text {
  font-size: 0.72rem;
  opacity: 0.85;
  margin-bottom: 2px;
}

.ut-portfolio-username {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.ut-fund-label {
  font-size: 0.68rem;
  opacity: 0.8;
  margin-bottom: 2px;
}

.ut-fund-value {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.ut-withdraw-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.65);
  color: var(--white);
  padding: 7px 13px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  margin-top: 4px;
}

.ut-withdraw-btn:hover {
  background: rgba(255,255,255,0.12);
}

/* Pie section */
.ut-pie-section {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-shrink: 0;
}

.ut-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ut-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
}

.ut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ut-pie-canvas-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.ut-pie-canvas-wrap canvas {
  display: block;
}

.ut-pie-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  line-height: 1.3;
  pointer-events: none;
  width: 65px;
}

/* ── Market Summary ─────────────────────────────── */
.ut-market-summary {
  flex: 1;
  background: #131722;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ut-market-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #2a2e39;
}

.ut-market-title {
  color: #d1d4dc;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ut-market-actions {
  display: flex;
  gap: 8px;
}

.ut-market-action-icon {
  color: #5d6673;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 3px;
  transition: color 0.15s;
}

.ut-market-action-icon:hover { color: #d1d4dc; }

.ut-tradingview-wrap {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.ut-tradingview-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

/* ══════════════════════════════════════════════════════
   TABLE SECTION
══════════════════════════════════════════════════════ */
.ut-table-wrap {
  position: relative;
  border-top: 1px solid var(--border-light);
  padding-top: 6px;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.ut-table-inner { position: relative; }

.ut-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

/* Tabs */
.ut-tabs {
  display: flex;
  gap: 24px;
}

.ut-tab {
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  padding-bottom: 10px;
  margin-bottom: -11px;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  user-select: none;
}

.ut-tab--active {
  color: var(--blue-card);
  border-bottom-color: var(--blue-card);
}

.ut-tab:hover:not(.ut-tab--active) { color: #555; }

/* Edit button */
.ut-edit-btn {
  background: transparent;
  border: 1.5px solid var(--blue-card);
  color: var(--blue-card);
  padding: 5px 14px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.ut-edit-btn:hover {
  background: rgba(32,149,223,0.07);
}

/* Table */
.ut-table-scroll {
  overflow-x: auto;
}

#ut-portfolio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

#ut-portfolio-table th {
  text-align: left;
  padding: 10px 8px;
  color: var(--text-dark);
  font-weight: 700;
  border-bottom: 1.5px solid var(--border-light);
  white-space: nowrap;
  font-size: 0.78rem;
}

#ut-portfolio-table td {
  padding: 11px 8px;
  color: var(--text-dark);
  border-bottom: 1px solid #f5f5f5;
  white-space: nowrap;
}

#ut-portfolio-table tbody tr:last-child td {
  font-weight: 700;
  border-bottom: none;
  border-top: 1.5px solid var(--border-light);
}

.ut-td-green { color: var(--text-green); font-weight: 600; }
.ut-td-red   { color: var(--text-red);   font-weight: 600; }

/* Empty state */
.ut-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.ut-empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.ut-empty-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; color: #666; }
.ut-empty-sub   { font-size: 0.78rem; }

/* ══════════════════════════════════════════════════════
   LOCK OVERLAY
══════════════════════════════════════════════════════ */
.ut-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(254, 187, 2, 0.86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
  text-align: center;
  padding: 20px 16px;
  backdrop-filter: blur(1.5px);
  /* Hidden by default (no balance = locked = shown) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.ut-lock-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.ut-lock-icon {
  width: 44px;
  height: 50px;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}

.ut-lock-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #157948;
  max-width: 200px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════
   DEMO TOGGLE (floating dev button)
══════════════════════════════════════════════════════ */
.ut-demo-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background 0.2s, transform 0.15s;
}

.ut-demo-toggle:hover {
  background: #2d2d4e;
  transform: translateY(-2px);
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .ut-layout { padding: 16px 18px 24px; }
  .ut-top-row { height: auto; flex-direction: column; }
  .ut-market-summary { min-height: 220px; }
  .ut-portfolio-wrap { min-height: 220px; }
}

@media (max-width: 860px) {
  .ut-header { padding: 12px 18px; }
  .ut-nav { gap: 14px; }
  .ut-nav-link { font-size: 0.72rem; }
  .ut-layout { flex-direction: column; padding: 12px; }
  .ut-sidebar { width: 100%; min-width: unset; }
  .ut-main { padding: 16px 14px; }
  .ut-pie-section { flex-direction: column; align-items: center; }
}

@media (max-width: 600px) {
  .ut-nav { display: none; }
}
