/**
 * Moneyverse November 18 Unified Design System (v2026.11.20.1 Authority)
 * Palette: Deep Navy (#0C1020), Surface (#151D32), Brand Violet (#9C83FF), Secondary Blue (#64B7FF)
 */

:root {
  --mv-bg-base: #0C1020;
  --mv-bg-surface: #151D32;
  --mv-bg-surface-elevated: #1C2642;
  --mv-bg-surface-translucent: rgba(21, 29, 50, 0.85);
  
  --mv-brand-violet: #9C83FF;
  --mv-brand-violet-hover: #B4A0FF;
  --mv-brand-violet-glow: rgba(156, 131, 255, 0.25);
  --mv-brand-violet-subtle: rgba(156, 131, 255, 0.12);
  
  --mv-accent-blue: #64B7FF;
  --mv-accent-blue-hover: #82C5FF;
  
  --mv-text-primary: #E9F1FF;
  --mv-text-secondary: #A8BCD8;
  --mv-text-muted: #627594;
  --mv-text-highlight: #FFFFFF;
  
  --mv-border-subtle: rgba(156, 131, 255, 0.18);
  --mv-border-surface: rgba(255, 255, 255, 0.08);
  --mv-border-focus: #9C83FF;
  
  --mv-status-success: #4ADE80;
  --mv-status-danger: #FB7185;
  --mv-status-warning: #FBBF24;
  
  --mv-font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --mv-font-mono: 'JetBrains Mono', monospace;
  
  --mv-radius-sm: 8px;
  --mv-radius-md: 12px;
  --mv-radius-lg: 16px;
  --mv-radius-full: 9999px;
  
  --mv-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --mv-shadow-glow: 0 0 25px rgba(156, 131, 255, 0.2);
}

/* Global resets & typography */
html, body {
  margin: 0;
  padding: 0;
  background-color: var(--mv-bg-base);
  color: var(--mv-text-primary);
  font-family: var(--mv-font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

/* Base Surfaces & Cards */
.mv-card {
  background: var(--mv-bg-surface);
  border: 1px solid var(--mv-border-subtle);
  border-radius: var(--mv-radius-md);
  box-shadow: var(--mv-shadow-card);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mv-card:hover {
  border-color: rgba(156, 131, 255, 0.35);
  box-shadow: var(--mv-shadow-glow);
}

.mv-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--mv-border-surface);
  padding-bottom: 12px;
}

.mv-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--mv-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.mv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--mv-font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--mv-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 44px;
  border: 1px solid transparent;
}

.mv-btn-primary {
  background: linear-gradient(135deg, var(--mv-brand-violet), #7C5CFC);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(156, 131, 255, 0.3);
}

.mv-btn-primary:hover {
  background: linear-gradient(135deg, var(--mv-brand-violet-hover), #8F72FF);
  box-shadow: 0 6px 20px rgba(156, 131, 255, 0.45);
  transform: translateY(-1px);
}

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

.mv-btn-secondary:hover {
  background: #253356;
  border-color: var(--mv-brand-violet);
  color: #FFFFFF;
}

.mv-btn-accent {
  background: linear-gradient(135deg, var(--mv-accent-blue), #3B82F6);
  color: #FFFFFF;
}

.mv-btn-accent:hover {
  background: linear-gradient(135deg, var(--mv-accent-blue-hover), #60A5FA);
}

/* Forms & Inputs */
.mv-input, .mv-select, .mv-textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(12, 16, 32, 0.85);
  border: 1px solid var(--mv-border-subtle);
  border-radius: var(--mv-radius-sm);
  color: var(--mv-text-primary);
  font-family: var(--mv-font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

.mv-input:focus, .mv-select:focus, .mv-textarea:focus {
  border-color: var(--mv-border-focus);
  box-shadow: 0 0 0 3px var(--mv-brand-violet-glow);
}

.mv-input-mono {
  font-family: var(--mv-font-mono);
}

/* Badges & Tags */
.mv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--mv-radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.mv-badge-violet {
  background: var(--mv-brand-violet-subtle);
  color: var(--mv-brand-violet);
  border-color: rgba(156, 131, 255, 0.3);
}

.mv-badge-success {
  background: rgba(74, 222, 128, 0.12);
  color: var(--mv-status-success);
  border-color: rgba(74, 222, 128, 0.3);
}

.mv-badge-danger {
  background: rgba(251, 113, 133, 0.12);
  color: var(--mv-status-danger);
  border-color: rgba(251, 113, 133, 0.3);
}

/* Tables */
.mv-table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--mv-radius-sm);
  border: 1px solid var(--mv-border-surface);
}

.mv-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.mv-table th {
  background: var(--mv-bg-surface-elevated);
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mv-text-secondary);
  border-bottom: 1px solid var(--mv-border-surface);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mv-table td {
  padding: 14px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--mv-border-surface);
  color: var(--mv-text-primary);
}

.mv-table tr:hover td {
  background: rgba(156, 131, 255, 0.04);
}

/* Emergency Maintenance Banner */
.mv-service-banner {
  background: linear-gradient(90deg, #7C2D12 0%, #9A3412 100%);
  color: #FED7AA;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 1px solid rgba(251, 146, 60, 0.4);
  position: sticky;
  top: 0;
  z-index: 1000;
  text-align: center;
}

.mv-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FB923C;
  animation: mv-pulse 1.8s infinite;
}

@keyframes mv-pulse {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.7); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 6px rgba(251, 146, 60, 0); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Header & Nav */
.mv-header {
  height: 64px;
  background: var(--mv-bg-surface-translucent);
  border-bottom: 1px solid var(--mv-border-subtle);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 41px; /* below banner */
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.mv-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #FFFFFF;
  text-decoration: none;
}

.mv-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--mv-brand-violet), var(--mv-accent-blue));
  border-radius: var(--mv-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #FFFFFF;
}

.mv-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mv-nav-link {
  color: var(--mv-text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--mv-radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mv-nav-link:hover, .mv-nav-link.active {
  color: #FFFFFF;
  background: rgba(156, 131, 255, 0.12);
}

.mv-nav-link.active {
  border-bottom: 2px solid var(--mv-brand-violet);
  border-radius: var(--mv-radius-sm) var(--mv-radius-sm) 0 0;
}

/* Language Selector */
.mv-lang-selector {
  position: relative;
  display: inline-block;
}

.mv-lang-btn {
  background: var(--mv-bg-surface-elevated);
  border: 1px solid var(--mv-border-subtle);
  border-radius: var(--mv-radius-sm);
  color: var(--mv-text-primary);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}

.mv-lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--mv-bg-surface);
  border: 1px solid var(--mv-border-subtle);
  border-radius: var(--mv-radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  min-width: 140px;
  padding: 6px 0;
  display: none;
  z-index: 1050;
  backdrop-filter: blur(16px);
}

.mv-lang-dropdown.show {
  display: block;
}

.mv-lang-option {
  padding: 8px 16px;
  color: var(--mv-text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.mv-lang-option:hover, .mv-lang-option.active {
  background: rgba(156, 131, 255, 0.15);
  color: #FFFFFF;
}

/* Floating Support/Chat Button (56x56px, Bottom-Right) */
.mv-floating-chat-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mv-brand-violet) 0%, #6D28D9 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.45), 0 0 15px rgba(156, 131, 255, 0.3);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

.mv-floating-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(109, 40, 217, 0.6), 0 0 25px rgba(156, 131, 255, 0.5);
}

.mv-floating-chat-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Floating Chat Panel (Desktop & Mobile) */
.mv-chat-modal {
  position: fixed;
  bottom: 100px;
  right: 32px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--mv-bg-surface);
  border: 1px solid var(--mv-border-subtle);
  border-radius: var(--mv-radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(156, 131, 255, 0.15);
  display: none;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.mv-chat-modal.open {
  display: flex;
  animation: mv-slide-up 0.25s ease-out;
}

@keyframes mv-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.mv-chat-header {
  padding: 16px 20px;
  background: var(--mv-bg-surface-elevated);
  border-bottom: 1px solid var(--mv-border-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mv-chat-tabs {
  display: flex;
  gap: 8px;
  background: rgba(12, 16, 32, 0.6);
  padding: 4px;
  border-radius: var(--mv-radius-sm);
  border: 1px solid var(--mv-border-surface);
}

.mv-chat-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--mv-text-secondary);
  border: none;
  background: transparent;
  transition: all 0.2s ease;
}

.mv-chat-tab.active {
  background: var(--mv-brand-violet);
  color: #FFFFFF;
}

.mv-chat-close {
  background: transparent;
  border: none;
  color: var(--mv-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mv-chat-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.mv-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mv-chat-footer {
  padding: 14px 20px;
  background: var(--mv-bg-surface-elevated);
  border-top: 1px solid var(--mv-border-surface);
}

/* Mobile Bottom Navigation (Visible on < 768px) */
.mv-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--mv-bg-surface-translucent);
  border-top: 1px solid var(--mv-border-subtle);
  backdrop-filter: blur(16px);
  z-index: 980;
  padding: 0 8px;
  align-items: center;
  justify-content: space-around;
}

.mv-mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--mv-text-secondary);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  width: 20%;
  height: 100%;
}

.mv-mobile-nav-item.active, .mv-mobile-nav-item:hover {
  color: var(--mv-brand-violet);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mv-header {
    padding: 0 16px;
    height: 56px;
  }
  .mv-nav-links {
    display: none; /* replaced by mobile nav */
  }
  .mv-mobile-nav {
    display: flex;
  }
  .mv-floating-chat-btn {
    bottom: 80px; /* Above 64px mobile nav + 16px clearance */
    right: 16px;
  }
  .mv-chat-modal {
    bottom: 146px;
    right: 16px;
    width: calc(100vw - 32px);
    height: 480px;
  }
  body {
    padding-bottom: 74px; /* clearance for mobile nav */
  }
}

/* Responsive Language Switcher & Auth Header Protection */
.mv-lang-container {
  display: inline-flex !important;
  align-items: center !important;
  position: relative !important;
  flex-shrink: 0 !important;
}
.mv-lang-btn {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 11px !important;
  padding: 4px 8px !important;
  min-height: 30px !important;
  flex-shrink: 0 !important;
}
#auth-action-container {
  display: inline-flex !important;
  align-items: center !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}
#auth-action-container a, 
#auth-action-container button {
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  font-size: 11px !important;
  padding: 4px 10px !important;
  min-height: 30px !important;
  flex-shrink: 0 !important;
}
@media (max-width: 1023px) {
  .mv-floating-chat-btn {
    bottom: 76px !important;
    right: 16px !important;
  }
}

/* A native modal keeps keyboard focus inside the access panel. */
#mv-floating-chat-modal{inset:auto 20px calc(90px + env(safe-area-inset-bottom)) auto;margin:0;padding:0;height:auto;max-height:calc(100dvh - 130px);overflow:auto;border:1px solid var(--mv-border-color)}
#mv-floating-chat-modal::backdrop{background:rgba(0,0,0,.5)}
#mv-floating-chat-modal h2{font-size:1rem;margin:0}
#mv-floating-chat-modal .mv-chat-body a{min-height:44px;display:flex;align-items:center;justify-content:center}
@media(max-width:480px){#mv-floating-chat-modal{left:12px;right:12px;width:auto}}
