/* ─────────────────────────────────────────────────
   VARO Web Companion — Theme & Components
   Matches app/src/config/theme.ts exactly
   ───────────────────────────────────────────────── */

/* Google Fonts loaded in index.html */

:root {
  /* Brand colors */
  --gold: #E8A838;
  --dark: #0A0E1A;
  --cuba-red: #CC0D0D;
  --cuba-blue: #002A5C;

  /* UI colors */
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;

  /* Spacing (matches theme.ts) */
  --xs: 4px;
  --sm: 8px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --xxl: 48px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Fonts */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

/* ── Reset ─────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────── */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Logo & Branding ───────────────────────── */

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--md);
  padding: var(--xxl) 0 var(--lg);
}

.logo-coin {
  width: 80px;
  height: 80px;
}

.logo-wordmark {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.15em;
}

.tagline {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

/* ── Cards ─────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--lg);
  margin-bottom: var(--md);
}

.card-sm {
  padding: var(--md);
}

/* ── Buttons ───────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--md) var(--lg);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: var(--dark);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: var(--sm) var(--md);
  font-size: 0.875rem;
}

.btn-icon {
  width: auto;
  padding: var(--sm) var(--md);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--gold);
}

/* ── Inputs ────────────────────────────────── */

.input-group {
  margin-bottom: var(--md);
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--xs);
}

.input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: var(--md);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--gold);
}

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

/* ── Balance Display ───────────────────────── */

.balance-section {
  text-align: center;
  padding: var(--lg) 0;
}

.balance-varo {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.balance-varo .asset-code {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: var(--xs);
}

.balance-xlm {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: var(--xs);
}

.balance-fiat {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--xs);
}

/* ── Address Display ───────────────────────── */

.address-bar {
  display: flex;
  align-items: center;
  gap: var(--sm);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: var(--sm) var(--md);
  margin-bottom: var(--md);
}

.address-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-feedback {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

/* ── Tabs ──────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: var(--md);
}

.tab {
  flex: 1;
  padding: var(--md) var(--sm);
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-body);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ── Transaction History ───────────────────── */

.tx-list {
  list-style: none;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: var(--md);
  padding: var(--md) 0;
  border-bottom: 1px solid var(--card-border);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.tx-icon.sent {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.tx-icon.received {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.tx-details {
  flex: 1;
  min-width: 0;
}

.tx-counterparty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-memo {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tx-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.tx-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
  text-align: right;
  white-space: nowrap;
}

.tx-amount.sent {
  color: var(--error);
}

.tx-amount.received {
  color: var(--success);
}

/* ── QR Code ───────────────────────────────── */

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--md);
  padding: var(--lg) 0;
}

.qr-canvas-wrapper {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: var(--md);
  display: inline-block;
}

/* ── Price Ticker ──────────────────────────── */

.ticker {
  display: flex;
  justify-content: center;
  gap: var(--lg);
  padding: var(--md) 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: var(--xs);
}

.ticker-label {
  color: var(--text-muted);
}

.ticker-value {
  color: var(--text-secondary);
}

/* ── Language Toggle ───────────────────────── */

.lang-toggle {
  position: fixed;
  top: var(--md);
  right: var(--md);
  z-index: 100;
}

.lang-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  padding: var(--xs) var(--sm);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.lang-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ── Request View ──────────────────────────── */

.request-header {
  text-align: center;
  padding: var(--lg) 0;
}

.request-amount {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.request-memo {
  color: var(--text-secondary);
  margin-top: var(--sm);
}

/* ── Loading & Empty States ────────────────── */

.loading {
  text-align: center;
  padding: var(--xxl) 0;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--card-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: var(--xl) 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.error-state {
  text-align: center;
  padding: var(--lg);
  color: var(--error);
  font-size: 0.875rem;
}

/* ── Footer ────────────────────────────────── */

.footer {
  margin-top: auto;
  padding: var(--lg) 0 var(--md);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--gold);
}

/* ── Utility ───────────────────────────────── */

.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }
.mt-sm { margin-top: var(--sm); }
.mt-md { margin-top: var(--md); }
.mt-lg { margin-top: var(--lg); }
.mb-md { margin-bottom: var(--md); }
.gap-sm { gap: var(--sm); }
.flex-row { display: flex; align-items: center; }

.hidden { display: none !important; }

/* ── Responsive ────────────────────────────── */

@media (max-width: 480px) {
  .app {
    padding: var(--sm);
  }

  .balance-varo {
    font-size: 2rem;
  }
}
