/* =========================================================
   AxisVPN Mini App - Isolated Hero & Header Elements
   ========================================================= */

/* Hero Top Purple Section (Home, Services, Analytics, Profile) */
.hero-purple-section {
  background: linear-gradient(145deg, #1E1035 0%, #351368 45%, #5B21B6 100%);
  padding: calc(26px + var(--tg-total-safe-top, 0px)) 18px 48px 18px;
  border-radius: 0 0 32px 32px;
  box-shadow: 0 12px 36px -4px rgba(91, 33, 182, 0.28);
  position: relative;
  overflow: visible;
  z-index: 1;
}

.profile-purple-hero {
  padding-bottom: 58px;
}

.hero-purple-section::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.25) 0%, rgba(109, 40, 217, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-purple-section::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.22) 0%, rgba(91, 33, 182, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Live Global Network Grid Canvas */
.hero-network-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0 0 32px 32px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.62;
  mix-blend-mode: screen;
  transform: translateZ(0);
  will-change: transform;
  contain: strict;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.92) 75%, rgba(0,0,0,0.4) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.92) 75%, rgba(0,0,0,0.4) 100%);
}

.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
  margin-top: 4px;
}

/* Vertical Profile Group: Avatar directly above dynamic greeting headline */
.hero-profile-vertical-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.hero-avatar-large {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 0 0 3px rgba(139, 92, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.45rem;
  font-weight: 800;
  overflow: hidden;
  position: relative;
}

.hero-avatar-large.with-img {
  padding: 0;
  background: #1E1035;
}

.avatar-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar-initial-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: inherit;
  color: inherit;
  pointer-events: none;
}

/* Avatar Dropdown Wrapper & Interactive States */
.hero-avatar-dropdown-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero-avatar-large {
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease, border-color 0.24s ease;
  user-select: none;
}

.hero-avatar-dropdown-container:hover .hero-avatar-large {
  transform: scale(1.06);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hero-avatar-dropdown-container:active .hero-avatar-large {
  transform: scale(0.96);
}

/* Mini indicator chevron on avatar */
.avatar-dropdown-badge-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #7C3AED;
  border: 2px solid #1E1035;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
  pointer-events: none;
}

.hero-avatar-dropdown-container.is-open .avatar-dropdown-badge-dot {
  transform: rotate(180deg);
  background: #EC4899;
}

/* =========================================================
   Fixed Root Portal Overlay for Profile Dropdown
   ========================================================= */
.profile-dropdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.profile-dropdown-overlay.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

/* Glassmorphism Floating Profile Popover / Dropdown Menu (White Subtle Accent Surface) */
.profile-dropdown-menu {
  position: fixed;
  top: calc(76px + var(--tg-total-safe-top, 0px));
  right: 18px;
  width: 260px;
  max-width: calc(100vw - 36px);
  background: 
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.045) 0%, transparent 60%),
    radial-gradient(circle at 0% 100%, rgba(245, 158, 11, 0.035) 0%, transparent 60%),
    linear-gradient(160deg, #FFFFFF 0%, #FAF8FF 60%, #FFFDF8 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 16px -2px rgba(124, 58, 237, 0.08), 0 0 0 1px rgba(124, 58, 237, 0.06);
  padding: 8px;
  z-index: 1000000;
  box-sizing: border-box;
  transform-origin: top right;
  transform: scale(0.9) translateY(-10px);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}

[dir="ltr"] .profile-dropdown-menu {
  right: auto;
  left: 18px;
  transform-origin: top left;
}

.profile-dropdown-overlay.is-open .profile-dropdown-menu {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Header inside Dropdown */
.profile-dropdown-header {
  padding: 8px 8px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
  margin-bottom: 6px;
}

.profile-dropdown-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.profile-dropdown-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-color-headline, #0F172A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-handle {
  font-size: 0.74rem;
  color: var(--text-color, #64748B);
  font-weight: 600;
}

.profile-dropdown-handle-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 2px 6px;
  margin-top: 2px;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.05);
  border: 1px solid rgba(124, 58, 237, 0.1);
  transition: all 0.16s ease;
  user-select: none;
  width: fit-content;
  color: var(--text-color, #64748B);
}

.profile-dropdown-handle-row:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.22);
  color: var(--text-color-headline, #0F172A);
}

.profile-dropdown-handle-row:active {
  transform: scale(0.96);
}

.profile-dropdown-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.8;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.profile-dropdown-handle-row:hover .profile-dropdown-copy-btn {
  opacity: 1;
  transform: scale(1.12);
}

[data-theme="dark"] .profile-dropdown-handle-row {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color, #94A3B8);
}

[data-theme="dark"] .profile-dropdown-handle-row:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-color-headline, #E1E1E1);
}

/* Menu Items List */
.profile-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 8px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-color-headline, #1E293B);
  font-size: 0.83rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  transition: background 0.18s ease, transform 0.14s ease, color 0.18s ease;
  box-sizing: border-box;
}

[dir="ltr"] .profile-dropdown-item {
  text-align: left;
}

.profile-dropdown-item:hover {
  background: rgba(124, 58, 237, 0.065);
  color: var(--primary-1, #6D28D9);
}

.profile-dropdown-item:active {
  transform: scale(0.98);
  background: rgba(124, 58, 237, 0.12);
}

/* Direct Polished Monochrome SVG Icon */
.profile-dropdown-item-icon {
  width: 18px;
  height: 18px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-color, #64748B);
  opacity: 0.85;
  transition: transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.profile-dropdown-item:hover .profile-dropdown-item-icon {
  transform: scale(1.12);
  color: var(--primary-1, #6D28D9);
  opacity: 1;
}

[data-theme="dark"] .profile-dropdown-item-icon {
  color: var(--text-color, #94A3B8);
}

[data-theme="dark"] .profile-dropdown-item:hover .profile-dropdown-item-icon {
  color: var(--text-color-headline, #E1E1E1);
}

.profile-dropdown-item-text {
  flex: 1;
  white-space: nowrap;
}

/* Language & Theme Switcher Rows in Dropdown */
.profile-dropdown-lang-row,
.profile-dropdown-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 8px;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease;
  box-sizing: border-box;
}

.profile-dropdown-lang-row:hover,
.profile-dropdown-theme-row:hover {
  background: rgba(124, 58, 237, 0.065);
}

.profile-dropdown-lang-left,
.profile-dropdown-theme-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Capsule Pill Toggle Switch (Language Switch) */
.lang-switch-capsule {
  position: relative;
  width: 68px;
  height: 32px;
  background: #64748B;
  border-radius: 9999px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  direction: ltr !important;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: background 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.lang-switch-capsule.is-en {
  background: linear-gradient(135deg, #7C3AED, #6D28D9);
}

.lang-switch-capsule.is-fa {
  background: linear-gradient(135deg, #475569, #334155);
}

.lang-switch-label {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  z-index: 1;
  letter-spacing: 0.5px;
  user-select: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.lang-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 26px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.2s ease;
}

.lang-thumb-badge {
  font-size: 0.7rem;
  font-weight: 900;
  color: #334155;
  letter-spacing: 0.3px;
  transition: color 0.25s ease;
}

.lang-switch-capsule.is-en .lang-switch-thumb {
  transform: translateX(34px);
}
.lang-switch-capsule.is-en .lang-thumb-badge {
  color: #7C3AED;
}

.lang-switch-capsule.is-fa .lang-switch-thumb {
  transform: translateX(0);
}
.lang-switch-capsule.is-fa .lang-thumb-badge {
  color: #475569;
}

/* Capsule Pill Toggle Switch (Theme Switch - Sun / Moon) */
.theme-switch-capsule {
  position: relative;
  width: 68px;
  height: 32px;
  background: #64748B;
  border-radius: 9999px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  direction: ltr !important;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: background 0.32s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-switch-capsule.is-light {
  background: linear-gradient(135deg, #F59E0B, #D97706);
}

.theme-switch-capsule.is-dark {
  background: linear-gradient(135deg, #1E1B4B, #312E81);
}

.theme-switch-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  user-select: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 26px;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.34s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

/* Light mode thumb is on left (over Sun) */
.theme-switch-capsule.is-light .theme-switch-thumb {
  transform: translateX(0);
  background: #FFFFFF;
  color: #D97706;
}

/* Dark mode thumb is on right (over Moon) */
.theme-switch-capsule.is-dark .theme-switch-thumb {
  transform: translateX(34px);
  background: #0F172A;
  color: #818CF8;
}

/* Dark Mode Dropdown Overrides */
[data-theme="dark"] .profile-dropdown-menu {
  background: 
    radial-gradient(circle at 100% 0%, rgba(112, 38, 238, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 0% 100%, rgba(30, 136, 229, 0.06) 0%, transparent 60%),
    linear-gradient(160deg, #1A1A22 0%, #15151D 60%, #121218 100%);
  border: 1px solid rgba(112, 38, 238, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 4px 16px -2px rgba(112, 38, 238, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .profile-dropdown-item {
  color: #E2E8F0;
}

[data-theme="dark"] .profile-dropdown-item:hover {
  background: rgba(112, 38, 238, 0.18);
  color: #FFFFFF;
}

[data-theme="dark"] .profile-dropdown-lang-row:hover,
[data-theme="dark"] .profile-dropdown-theme-row:hover {
  background: rgba(112, 38, 238, 0.16);
}

[data-theme="dark"] .profile-dropdown-item-icon {
  background: rgba(255, 255, 255, 0.08);
}

.profile-dropdown-divider {
  height: 1px;
  background: rgba(124, 58, 237, 0.08);
  margin: 4px 6px;
}

.hero-profile-name-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-greeting-tag {
  font-size: 0.88rem;
  font-weight: 700;
  color: #E9D5FF;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-radius: 0;
  border: none;
  backdrop-filter: none;
  letter-spacing: 0.2px;
}

.hero-weather-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.28));
  animation: weatherIconFloat 4.5s ease-in-out infinite;
}

@keyframes weatherIconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04); }
}

.hero-greeting-title {
  font-size: 1.52rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  letter-spacing: -0.2px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.hero-username-highlight {
  font-size: 1.55rem;
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F3FF 45%, #DDD6FE 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  display: inline-block;
  filter: drop-shadow(0 2px 8px rgba(139, 92, 246, 0.45));
}

.hero-dear-tag {
  font-size: 1.15rem;
  font-weight: 700;
  color: #E9D5FF;
  opacity: 0.92;
}

.hero-profile-subtitle {
  font-size: 0.74rem;
  color: #C4B5FD;
  font-weight: 500;
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  letter-spacing: 0.3px;
}

.profile-hero-top-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 8px;
}

/* App Header (Legacy fallback) */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface-white);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-frost-purple);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-brand);
}

.brand-logo-svg {
  display: flex;
  align-items: center;
  justify-content: center;
}
