/* ═══════════════════════════════════════════════════════════════════════════
   WALLETS.CSS — Portofolio Aset · Option A (Hero + list)
   Mobile-first, FINKU dark theme
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Container ──────────────────────────────────────────────────────── */
.wallets-page {
  padding: 16px 16px 80px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.wallets-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wallets-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.2;
}

.wallets-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.wallets-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}

.btn-sm {
  font-size: 12px !important;
  padding: 8px 14px !important;
  border-radius: 10px !important;
}

.w-btn-transfer {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.w-btn-transfer .w-svg {
  width: 16px;
  height: 16px;
}

.w-btn-deposito {
  background: var(--accent-yellow) !important;
  color: #111 !important;
  border: none !important;
  font-weight: 600;
}

.w-excel-wrap {
  position: relative;
}

.w-excel-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 999;
  min-width: 220px;
  padding: 6px 0;
  text-align: left;
}

.w-excel-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.w-excel-dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.w-excel-dropdown .w-excel-import {
  color: var(--accent-green);
}

.w-excel-sep {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* ── Hero (Likuid first) ─────────────────────────────────────────────────── */
.wallets-hero,
.wallets-total-banner {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  background: linear-gradient(135deg, rgba(0, 217, 139, 0.14) 0%, rgba(59, 130, 246, 0.08) 100%);
  border: 1px solid rgba(0, 217, 139, 0.28);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.wallets-hero-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
  min-width: 0;
}

.wallets-hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex: 0 1 auto;
}

.wallets-hero-locked {
  text-align: right;
}

.wallets-hero-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.wallets-total-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wallets-total-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.wallets-label-liquid {
  color: var(--accent-green);
}

.wallets-label-locked {
  color: var(--accent-yellow) !important;
}

.wallets-total-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-green);
  font-family: monospace;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.wallets-value-locked {
  font-size: 18px !important;
  color: var(--accent-yellow) !important;
}

.w-btn-ai {
  min-width: 96px;
}

/* ── Main Grid ───────────────────────────────────────────────────────────── */
.wallets-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .wallets-main-grid {
    grid-template-columns: 1.35fr 0.75fr;
    align-items: start;
  }
}

.wallets-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.wallets-section-locked-head {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid rgba(245, 158, 11, 0.25);
}

.wallets-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wallets-section-label .w-svg {
  width: 14px;
  height: 14px;
}

.w-toggle-empty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  min-height: 36px;
}

.w-toggle-empty input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-green);
}

/* ── List rows (Option A) ────────────────────────────────────────────────── */
.wallets-cards-grid,
.wallets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wcard,
.wrow {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 12px 12px 14px;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}

.wrow:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.wrow-locked {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.28);
}

.wrow-coinjar {
  border-color: rgba(0, 217, 139, 0.28);
}

.wrow-zero {
  opacity: 0.72;
}

.wcard-accent {
  position: absolute;
  top: 8px;
  left: 0;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
}

.wrow-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1.5px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  margin-left: 4px;
}

.wrow-icon-locked {
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--accent-yellow);
}

.w-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.w-svg-sm {
  width: 16px;
  height: 16px;
}

.wrow-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.wcard-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
}

.wcard-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wcard-name-locked {
  color: var(--accent-yellow);
}

.w-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 100px;
  flex-shrink: 0;
}

.w-badge-roundup {
  background: rgba(0, 217, 139, 0.18);
  color: var(--accent-green);
  border: 1px solid rgba(0, 217, 139, 0.35);
}

.wcard-estimate {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.wcard-balance {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: monospace;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  min-width: 7.5ch;
}

.wcard-balance-locked {
  color: var(--accent-yellow);
}

/* ── ⋯ Menu (touch-friendly, not hover-only) ─────────────────────────────── */
.wcard-actions,
.wrow-menu-wrap {
  position: relative;
  display: flex;
  flex-shrink: 0;
  opacity: 1;
}

.wcard-btn,
.wcard-menu-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 10px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.wcard-menu-btn:hover,
.wcard-menu-btn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.wcard-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 40;
  padding: 6px;
}

.wcard-menu.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wcard-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 11px 12px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.wcard-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.wcard-menu-item .w-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.wcard-menu-danger {
  color: #EF4444;
}

/* legacy transfer CTA kept for hooks but unused in list UI */
.wcard-transfer {
  display: none;
}

/* ── Empty ───────────────────────────────────────────────────────────────── */
.wallets-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 14px;
  border: 1px dashed var(--border-color);
  border-radius: 14px;
}

.wallets-empty-inline {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 4px 4px;
}

/* ── Mutation ────────────────────────────────────────────────────────────── */
.mutation-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
}

.mutation-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
}

.mutation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.mutation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  gap: 12px;
}

.mutation-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mutation-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue, #3B82F6);
  border-radius: 50%;
  flex-shrink: 0;
}

.mutation-icon .w-svg {
  width: 16px;
  height: 16px;
}

.mutation-details {
  min-width: 0;
}

.mutation-details h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mutation-details p {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

.mutation-amount {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-blue, #3B82F6);
  flex-shrink: 0;
}

.btn-mutations-expand {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn-mutations-expand:hover {
  border-color: rgba(0, 217, 139, 0.4);
  color: var(--accent-green);
}

/* ── Stats ───────────────────────────────────────────────────────────────── */
.wallet-stats-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

.stats-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stats-stack {
  display: flex;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 14px;
  gap: 2px;
}

.stats-stack-seg {
  height: 100%;
  min-width: 3px;
  border-radius: 2px;
}

.stat-bar-container {
  margin-bottom: 10px;
}

.stat-bar-rest .stat-bar-header {
  opacity: 0.75;
}

.stat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  gap: 8px;
}

.stat-bar-header span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-bar-header span:last-child {
  flex-shrink: 0;
  font-size: 11px;
}

.stat-bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── AI (on-demand) ──────────────────────────────────────────────────────── */
.ai-analysis-card {
  background: linear-gradient(145deg, rgba(0, 217, 139, 0.07) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid rgba(0, 217, 139, 0.2);
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
}

.ai-analysis-card.ai-collapsed .ai-content {
  opacity: 0.85;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.ai-badge {
  background: rgba(0, 217, 139, 0.2);
  color: var(--accent-green);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-content {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  word-break: break-word;
  overflow-wrap: break-word;
}

.ai-placeholder {
  color: var(--text-muted) !important;
}

.ai-content p { margin: 0 0 8px; }
.ai-content p:last-child { margin: 0; }
.ai-content ul { padding-left: 18px; margin: 0 0 8px; }
.ai-content li { margin-bottom: 4px; }

/* ── Modal Backdrop ──────────────────────────────────────────────────────── */
.wallet-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: backdropIn 0.18s ease;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wallet-modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

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

.wallet-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
  border-radius: 20px 20px 0 0;
}

.wallet-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.wallet-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.wallet-modal-body {
  padding: 20px;
}

.wm-field {
  margin-bottom: 16px;
}

.wm-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.wm-arrow {
  text-align: center;
  font-size: 20px;
  color: var(--accent-green);
  margin: -4px 0 8px;
  font-weight: 700;
}

.wm-color-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wm-color-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.wm-color-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.wm-color-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 4px 2px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.wm-color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.wm-color-name {
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  max-width: 64px;
  color: var(--text-muted);
}

.wm-color-swatch:hover .wm-color-dot {
  transform: scale(1.12);
}

.wm-color-swatch.active .wm-color-dot {
  border-color: #fff;
  transform: scale(1.15);
}

.wm-color-swatch.active .wm-color-name {
  color: var(--text-primary);
  font-weight: 600;
}

body.light-mode .wm-color-swatch.active .wm-color-dot {
  border-color: #0F0F1A;
  box-shadow: 0 0 0 2px rgba(15, 15, 26, 0.2);
}

.wm-color-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.wm-color-custom-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.wm-color-custom-input {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.wm-color-selected-name {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

.wm-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.wm-actions .btn {
  flex: 1;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wallets-page {
    padding: 12px 12px 100px;
  }
  .wallets-title {
    font-size: 18px;
  }
  .wallets-total-value {
    font-size: 24px;
  }
  .wallets-hero,
  .wallets-total-banner {
    padding: 14px 14px;
    flex-direction: column;
  }
  .wallets-hero-side {
    align-items: stretch;
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
  .wallets-hero-locked {
    text-align: left;
  }
  .wcard-balance {
    font-size: 15px;
  }
  .wallets-header-actions .btn {
    min-height: 44px;
  }
  .wcard-name {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

@media (max-width: 768px) {
  .wallets-header-actions .btn {
    min-height: 44px;
  }
}

.wallets-col-left,
.wallets-col-right {
  display: flex;
  flex-direction: column;
  gap: 0;
}
