/* Account Dropdown Styles */

/* ═══════════════════════════════════════════════════════════
   Header Actions Wrapper — holds balance btn + account btn
   ═══════════════════════════════════════════════════════════ */
.header-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════
   Balance Button
   ═══════════════════════════════════════════════════════════ */
.balance-wrapper {
  position: relative;
}

.balance-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(139, 92, 246, 0.10);
  border: 1.5px solid rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  padding: 6px 11px 6px 9px;
  cursor: pointer;
  color: #7c3aed;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.22s ease;
  min-height: 34px;
  white-space: nowrap;
  line-height: 1;
}

.balance-btn:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.18);
}

.balance-coin-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #8b5cf6;
}

.balance-btn-text {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.balance-credits-num {
  font-size: 13px;
  font-weight: 700;
  color: #5b21b6;
  letter-spacing: -0.3px;
}

.balance-credits-label {
  font-size: 10px;
  font-weight: 500;
  color: #8b5cf6;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.balance-usd-badge {
  font-size: 10px;
  font-weight: 600;
  color: #059669;
  background: rgba(5, 150, 105, 0.10);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 1px;
}

.balance-chevron {
  color: #8b5cf6;
  opacity: 0.7;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════
   Balance Dropdown
   ═══════════════════════════════════════════════════════════ */
.balance-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 300px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.13), 0 2px 8px rgba(139, 92, 246, 0.08);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
  overflow: hidden;
}

.balance-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* When chevron parent dropdown is open */
.balance-dropdown.show ~ .balance-btn .balance-chevron,
#balanceBtn .balance-chevron {
  transition: transform 0.2s ease;
}

.balance-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(109, 40, 217, 0.02));
}

.balance-dropdown-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(109, 40, 217, 0.08));
  border: 1.5px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.balance-dropdown-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.balance-dropdown-subtitle {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  margin-top: 1px;
}

.balance-stats-card {
  margin: 12px 12px 8px 12px;
  background: linear-gradient(135deg, #faf5ff, #f5f3ff);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: 10px;
  padding: 12px 14px;
}

.balance-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.balance-stat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.balance-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #5b21b6;
  letter-spacing: -0.4px;
}

.balance-usd-green {
  color: #059669;
}

.balance-stat-divider {
  height: 1px;
  background: rgba(139, 92, 246, 0.12);
  margin: 6px 0;
}

/* ─── Top-up / Stripe section ─── */
.balance-topup-section {
  padding: 10px 12px 14px 12px;
}

.balance-topup-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.balance-stripe-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 48px;
}

.balance-stripe-wrap stripe-buy-button {
  width: 100%;
}

/* ─── Package info card ─── */
.balance-package-card {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1.5px solid rgba(139, 92, 246, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.balance-package-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.balance-package-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.balance-package-name {
  font-size: 12px;
  font-weight: 700;
  color: #4c1d95;
}

.balance-package-tagline {
  font-size: 10px;
  color: #7c3aed;
  font-weight: 500;
  opacity: 0.85;
}

.balance-package-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.balance-package-price {
  font-size: 18px;
  font-weight: 800;
  color: #5b21b6;
  letter-spacing: -0.5px;
  line-height: 1;
}

.balance-package-credits {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: rgba(5, 150, 105, 0.10);
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ─── How credits work section ─── */
.balance-info-section {
  border-top: 1px solid #f3f4f6;
  margin: 0 0 2px 0;
}

.balance-info-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-align: left;
  transition: color 0.15s ease;
}

.balance-info-toggle:hover {
  color: #8b5cf6;
}

.balance-info-toggle .info-chevron {
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.balance-info-body {
  padding: 0 12px 12px 12px;
}

/* Credits tier table */
.credits-tier-table {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.credits-tier-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr;
  gap: 4px;
  padding: 7px 10px;
  font-size: 11px;
  border-bottom: 1px solid #f3f4f6;
  align-items: center;
}

.credits-tier-row:last-child {
  border-bottom: none;
}

.credits-tier-header {
  background: #f9fafb;
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 10px;
}

.tier-highlight {
  background: rgba(139, 92, 246, 0.04);
}

.tier-label {
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  display: inline-block;
}

.tier-small    { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.tier-standard { background: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }
.tier-long     { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.tier-credits {
  font-weight: 700;
  color: #374151;
}

.tier-cost {
  font-size: 10px;
  color: #6b7280;
}

.credits-info-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10px;
  color: #9ca3af;
  line-height: 1.5;
  padding: 6px 8px;
  background: #f9fafb;
  border-radius: 6px;
}

.credits-info-note svg {
  color: #8b5cf6;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   Mobile responsiveness
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .balance-btn {
    padding: 5px 8px 5px 7px;
    gap: 5px;
    min-height: 30px;
    border-radius: 10px;
  }
  .balance-credits-num {
    font-size: 12px;
  }
  .balance-credits-label {
    display: none;
  }
  .balance-usd-badge {
    display: none !important;
  }
  .balance-coin-icon {
    width: 15px;
    height: 15px;
  }
  .balance-dropdown {
    right: auto;
    left: 0;
    min-width: 280px;
  }
}

@media (max-width: 480px) {
  .balance-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: unset;
    width: 100%;
    border-radius: 14px 14px 0 0;
    transform: translateY(100%);
    max-height: 75vh;
    overflow-y: auto;
  }
  .balance-dropdown.show {
    transform: translateY(0);
  }
}

.account-dropdown {
    position: relative;
}

.dropdown-content {
    position: fixed;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
    transition: all 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 4px 8px;
}

.dropdown-item:hover {
    background: #f9fafb;
    color: #8b7cf6;
}

.dropdown-item.active {
    background: #f3f4f6;
    color: #8b7cf6;
    font-weight: 600;
}

.dropdown-item svg {
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

/* Account button styling - not logged in */
.account-btn {
  background: linear-gradient(135deg,#8b5cf6,#7c3aed);
  color:#fff;
  border:0;
  border-radius:12px;
  padding:7px 7px;
  font-weight:600;
  font-size:10px;
  cursor:pointer;
  transition:all .25s ease;
  box-shadow:0 4px 12px rgba(139,92,246,.25);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  min-width:96px;
}
.account-btn:hover {
  background: linear-gradient(135deg,#7c3aed,#6d28d9);
  transform: translateY(-1px) scale(1.02);
  box-shadow:0 6px 16px rgba(124,58,237,.30);
}

/* Account button styling - when wallet connected */
.account-btn.connected {
  padding:7px 7px;
  font-size:10px;
}

/* Mobile: make the purple wallet pill smaller and truncatable */
@media (max-width: 768px) {
  .account-btn {
    padding: 7px 7px;
    font-size: 10px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 62vw;
    white-space: nowrap;
    min-height:28px;
    min-width:96px;
  }
  .account-btn.connected {
    padding: 7px 7px;
    font-size: 10px;
  }
  #accountBtnText {
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: bottom;
  }
  /* Hide token count on small screens to save space */
  #creditsDisplay {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .account-btn {
    padding: 6px 6px;
    font-size: 10px;
    border-radius: 10px;
    max-width: 58vw;
    min-height:26px;
    min-width:88px;
  }
  .account-btn.connected {
    padding: 6px 6px;
    font-size: 10px;
  }
  #accountBtnText {
    max-width: 36vw;
  }
}

/* === Brand Primary Button (同 Daily Check-in 风格) === */
.btn-primary {
  background: linear-gradient(135deg,#8b5cf6,#7c3aed);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 600;
  transition: transform .2s ease, box-shadow .2s ease;
  box-shadow: 0 4px 12px rgba(124,58,237,.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124,58,237,.32);
}

/* 标题里的小图标（gift）与文字对齐（当前未使用，保留以兼容旧标记） */
.icon-inline {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 6px;
  position: relative;
  top: -1px;
}

/* 任务项里的图标容器允许放 <img> */
.task-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  margin-right: 10px;
}
.task-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@media (max-width: 768px) {
    .dropdown-content {
        max-height: 80vh;
        border-radius: 12px 12px 0 0;
        padding-bottom: 20px;
    }
}

/* 对于较大的屏幕，保持原来的下拉样式 */
@media (min-width: 769px) {
    .dropdown-content {
        position: absolute;
        top: 100%;
        bottom: auto;
        left: auto;
        right: 0;
        min-width: 320px;
        max-width: 400px;
        border-radius: 8px;
        transform: translateY(-10px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        max-height: 70vh;
        margin-top: 8px;
    }
    
    .dropdown-content.show {
        transform: translateY(0);
    }
}
