/* ===================================================================
   WalierWorld Portal Design System & Styles
   =================================================================== */

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette */
  --bg-canvas: #080c14;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #151f38;
  --bg-surface-hover: #1a2745;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-focus: #38bdf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* App Specific Accent Colors */
  --accent-vencer: #f59e0b;
  --accent-vencer-subtle: rgba(245, 158, 11, 0.12);
  --accent-vencer-border: rgba(245, 158, 11, 0.35);

  --accent-memora: #10b981;
  --accent-memora-subtle: rgba(16, 185, 129, 0.12);
  --accent-memora-border: rgba(16, 185, 129, 0.35);

  --accent-blockbook: #818cf8;
  --accent-blockbook-subtle: rgba(129, 140, 248, 0.12);
  --accent-blockbook-border: rgba(129, 140, 248, 0.35);

  --accent-receipts: #38bdf8;
  --accent-receipts-subtle: rgba(56, 189, 248, 0.12);
  --accent-receipts-border: rgba(56, 189, 248, 0.35);

  /* Layout & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-hover: 0 24px 48px -6px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-medium);
  
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle Ambient Surface Vignette */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(129, 140, 248, 0.04) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.portal-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* ===================================================================
   Header Section
   =================================================================== */

.header-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 40px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Environment Switcher */
.env-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
}

.env-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 8px;
}

.env-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}

.env-btn:hover {
  color: var(--text-primary);
}

.env-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.env-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Title & Subtitle */
.hero-title {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.15;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 640px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

/* Status Pill Strip */
.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-memora);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-memora);
}

.status-divider {
  color: var(--border-medium);
}

/* ===================================================================
   Application Grid
   =================================================================== */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-bottom: 48px;
}

.app-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth), background-color var(--transition-smooth);
  overflow: hidden;
}

.app-card:hover {
  transform: translateY(-4px);
  background-color: var(--bg-surface-elevated);
  box-shadow: var(--shadow-hover);
}

.app-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 4px;
}

/* App Header Row */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.app-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  transition: transform var(--transition-smooth);
}

.app-card:hover .app-icon-wrapper {
  transform: scale(1.06);
}

.app-icon-svg {
  width: 26px;
  height: 26px;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  letter-spacing: 0.02em;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Card Typography */
.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 22px;
  flex-grow: 1;
}

/* App Features List */
.features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  list-style: none;
}

.feature-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* Card Action Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.action-link {
  font-size: 0.92rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap var(--transition-fast);
}

.app-card:hover .action-link {
  gap: 10px;
}

.action-link svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.app-card:hover .action-link svg {
  transform: translateX(3px);
}

.subdomain-badge {
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-muted);
}

/* ===================================================================
   Card Theme Specializations
   =================================================================== */

/* Vencer */
.card-vencer .app-icon-wrapper {
  background: var(--accent-vencer-subtle);
  color: var(--accent-vencer);
}
.card-vencer .category-tag {
  background: var(--accent-vencer-subtle);
  color: var(--accent-vencer);
  border: 1px solid var(--accent-vencer-border);
}
.card-vencer .action-link {
  color: var(--accent-vencer);
}
.card-vencer:hover {
  border-color: var(--accent-vencer-border);
}

/* Memora */
.card-memora .app-icon-wrapper {
  background: var(--accent-memora-subtle);
  color: var(--accent-memora);
}
.card-memora .category-tag {
  background: var(--accent-memora-subtle);
  color: var(--accent-memora);
  border: 1px solid var(--accent-memora-border);
}
.card-memora .action-link {
  color: var(--accent-memora);
}
.card-memora:hover {
  border-color: var(--accent-memora-border);
}

/* BlockBook */
.card-blockbook .app-icon-wrapper {
  background: var(--accent-blockbook-subtle);
  color: var(--accent-blockbook);
}
.card-blockbook .category-tag {
  background: var(--accent-blockbook-subtle);
  color: var(--accent-blockbook);
  border: 1px solid var(--accent-blockbook-border);
}
.card-blockbook .action-link {
  color: var(--accent-blockbook);
}
.card-blockbook:hover {
  border-color: var(--accent-blockbook-border);
}

/* Receipts */
.card-receipts .app-icon-wrapper {
  background: var(--accent-receipts-subtle);
  color: var(--accent-receipts);
}
.card-receipts .category-tag {
  background: var(--accent-receipts-subtle);
  color: var(--accent-receipts);
  border: 1px solid var(--accent-receipts-border);
}
.card-receipts .action-link {
  color: var(--accent-receipts);
}
.card-receipts:hover {
  border-color: var(--accent-receipts-border);
}

/* ===================================================================
   Footer Section
   =================================================================== */

.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.footer-link-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  transition: var(--transition-fast);
}

.footer-link-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.footer-link-btn:focus-visible {
  outline: 2px solid var(--border-focus);
}

/* ===================================================================
   Toast Notification
   =================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-hover);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===================================================================
   Modal Dialog for Keyboard Shortcuts
   =================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.shortcuts-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-hover);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.shortcut-key {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8rem;
  min-width: 24px;
  text-align: center;
}

.modal-close-btn {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 10px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--bg-surface-hover);
}

/* ===================================================================
   Responsive Breakpoints
   =================================================================== */

@media (max-width: 860px) {
  .apps-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .portal-wrapper {
    padding: 32px 16px 48px;
  }

  .app-card {
    padding: 24px;
  }

  .top-bar {
    flex-direction: row;
    gap: 16px;
  }
}

@media (max-width: 540px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .brand-badge {
    justify-content: center;
  }

  .env-switcher {
    justify-content: center;
  }

  .status-strip {
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
  }

  .status-divider {
    display: none;
  }

  .portal-footer {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
}

/* ===================================================================
   Portal Mandatory Login Gate
   =================================================================== */
.portal-login-gate {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background-color: var(--bg-canvas);
  background: 
    radial-gradient(circle at 50% 30%, rgba(56, 189, 248, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 85% 85%, rgba(129, 140, 248, 0.04) 0%, transparent 50%),
    var(--bg-canvas);
  position: relative;
  z-index: 1;
}

.portal-login-gate .login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 24px 48px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 2;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-logo {
  display: inline-flex;
  margin-bottom: 12px;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 6px 0 14px;
  line-height: 1.4;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.login-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fb7185;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

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

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

.form-input {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.btn-login-submit {
  width: 100%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #080c14;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 8px;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.btn-login-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}



/* Signed in User Pill in Portal Header */
.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-pill-btn:hover {
  border-color: #f43f5e;
}

.signout-text {
  color: var(--text-muted);
  font-size: 0.75rem;
}

