/* ============================================================
   huanleai.com - Global Styles (global.css)
   Theme: Fun Kids / AI Story Platform
   ============================================================ */

:root {
  /* Brand Colors */
  --orange: #FF6B35;
  --orange-dark: #E55A2B;
  --orange-light: #FFF3EE;
  --vip-gold: #F59E0B;
  --vip-gold-light: #FEF3C7;
  --purple: #8B5CF6;
  --purple-light: #EDE9FE;
  --green: #10B981;
  --green-light: #D1FAE5;
  --red: #EF4444;
  
  /* Neutrals */
  --white: #FFFFFF;
  --bg: #F8F9FB;
  --bg-card: #FFFFFF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  
  /* Skeleton */
  --skeleton: #E5E7EB;
  --skeleton-shine: #F3F4F6;
  
  /* Layout */
  --max-width: 1200px;
  --header-height: 56px;
  --bottom-tab-height: 60px;
  --card-radius: 16px;
  --card-padding: 12px;
  --card-ratio: 3/4;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-btn: 0 4px 16px rgba(255,107,53,0.4);
  
  /* Font */
  --font: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Container */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shine) 50%, var(--skeleton) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--card-radius);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  aspect-ratio: 3/4;
  border-radius: var(--card-radius);
}
.skeleton-text {
  height: 16px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

/* Skeleton Grid */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px;
}
@media (min-width: 768px) {
  .skeleton-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 24px; font-weight: 600;
  font-size: 14px; gap: 6px; transition: all 0.2s; white-space: nowrap;
}
.btn-primary { background: var(--orange); color: var(--white); box-shadow: var(--shadow-btn); }
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); }
.btn-outline { border: 2px solid var(--orange); color: var(--orange); background: transparent; }
.btn-outline:hover { background: var(--orange-light); }
.btn-gold { background: linear-gradient(135deg, #F59E0B, #FCD34D); color: #7C2D12; font-weight: 700; }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 28px; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */
.top-nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.nav-inner {
  display: flex; align-items: center; gap: 12px;
  max-width: var(--max-width); margin: 0 auto;
  height: var(--header-height);
}
.nav-logo {
  display: flex; align-items: center; gap: 6px;
  font-size: 18px; font-weight: 800; color: var(--orange);
  white-space: nowrap; flex-shrink: 0;
}
.nav-logo img { width: 32px; height: 32px; border-radius: 8px; }
.nav-search {
  flex: 1; min-width: 0; position: relative; max-width: 400px;
}
.nav-search input {
  width: 100%; height: 36px; padding: 0 16px 0 36px;
  border: 2px solid var(--border); border-radius: 20px;
  background: var(--bg); font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.nav-search input:focus { border-color: var(--orange); }
.nav-search .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 16px; pointer-events: none;
}
.nav-tags {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  flex-shrink: 0; -webkit-overflow-scrolling: touch;
}
.nav-tags::-webkit-scrollbar { display: none; }
.nav-tag {
  padding: 6px 14px; border-radius: 16px; font-size: 13px;
  white-space: nowrap; background: var(--bg); color: var(--text-secondary);
  transition: all 0.2s; font-weight: 500;
}
.nav-tag:hover, .nav-tag.active { background: var(--orange-light); color: var(--orange); }
.nav-login-btn { flex-shrink: 0; }
.nav-login-btn .btn { padding: 6px 18px; font-size: 13px; }

/* Mobile nav adjustments */
@media (max-width: 767px) {
  .nav-inner { gap: 8px; padding: 0 4px; }
  .nav-logo { font-size: 15px; }
  .nav-logo img { width: 26px; height: 26px; }
  .nav-tags { max-width: 35vw; }
  .nav-tag { padding: 4px 10px; font-size: 12px; }
  .nav-search { max-width: 180px; }
  .nav-search input { height: 32px; font-size: 12px; }
}

/* ============================================================
   BANNER CAROUSEL
   ============================================================ */
.banner-section { padding: 16px; max-width: var(--max-width); margin: 0 auto; }
.banner-carousel {
  position: relative; border-radius: var(--card-radius); overflow: hidden;
  background: linear-gradient(135deg, #FFF7ED, #FEF3C7);
  aspect-ratio: 16/6; min-height: 140px;
}
@media (min-width: 768px) { .banner-carousel { aspect-ratio: 16/5; } }
.banner-slide {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 24px 32px; opacity: 0; transition: opacity 0.5s; cursor: pointer;
}
.banner-slide.active { opacity: 1; }
.banner-content { flex: 1; }
.banner-tag {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 600; margin-bottom: 8px;
}
.banner-tag.new { background: var(--orange); color: var(--white); }
.banner-tag.free { background: var(--green); color: var(--white); }
.banner-title {
  font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px;
}
.banner-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.banner-image { width: 120px; height: 120px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.banner-image .emoji { font-size: 80px; }
.banner-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.banner-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border);
  transition: all 0.3s;
}
.banner-dot.active { background: var(--orange); width: 24px; border-radius: 4px; }

@media (max-width: 767px) {
  .banner-section { padding: 12px; }
  .banner-slide { padding: 16px; }
  .banner-title { font-size: 16px; }
  .banner-image .emoji { font-size: 50px; }
  .banner-image { width: 80px; height: 80px; }
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px; max-width: var(--max-width); margin: 0 auto;
}
.section-title { font-size: 18px; font-weight: 700; }
.section-more { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 2px; }

/* ============================================================
   CATEGORY TABS (HORIZONTAL SCROLL)
   ============================================================ */
.cat-tabs-wrapper {
  padding: 8px 16px; max-width: var(--max-width); margin: 0 auto;
}
.cat-tabs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; padding-bottom: 4px;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 8px 18px; border-radius: 20px; font-size: 14px; font-weight: 500;
  white-space: nowrap; background: var(--white); color: var(--text-secondary);
  border: 1px solid var(--border); transition: all 0.2s; flex-shrink: 0;
}
.cat-tab:hover, .cat-tab.active { background: var(--orange); color: var(--white); border-color: var(--orange); }

/* Filter tags (auto-wrap version) */
.filter-tags {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0;
}
.filter-tag {
  padding: 6px 16px; border-radius: 16px; font-size: 13px;
  background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.filter-tag:hover, .filter-tag.active { background: var(--purple); color: var(--white); border-color: var(--purple); }

/* ============================================================
   CARD GRID
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px 16px;
  max-width: var(--max-width);
  margin: 0 auto;
}
@media (min-width: 768px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 0 0 16px; }
}

/* ============================================================
   SECTION DIVIDER
   ============================================================ */
.section-divider {
  height: 8px; background: var(--bg); max-width: var(--max-width); margin: 8px auto;
}

/* ============================================================
   FLOATING BENEFIT BUTTON
   ============================================================ */
.float-benefit {
  position: fixed; right: 16px; bottom: 80px; z-index: 998;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), #FF8C5A);
  box-shadow: 0 4px 20px rgba(255,107,53,0.5);
  display: flex; align-items: center; justify-content: center;
  animation: floatPulse 2s infinite; cursor: pointer;
}
.float-benefit span { font-size: 24px; }
@keyframes floatPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@media (min-width: 768px) {
  .float-benefit { right: 24px; bottom: 40px; }
}

/* ============================================================
   BOTTOM TAB BAR (MOBILE)
   ============================================================ */
.bottom-tabs {
  display: flex;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
  background: var(--white); border-top: 1px solid var(--border);
  height: var(--bottom-tab-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: 10px; color: var(--text-muted);
  transition: color 0.2s; position: relative;
}
.bottom-tab.active { color: var(--orange); }
.bottom-tab .tab-icon { font-size: 22px; }
.bottom-tab .tab-badge {
  position: absolute; top: 2px; right: calc(50% - 20px);
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: var(--white); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

/* Spacer for bottom tab */
.bottom-spacer { height: var(--bottom-tab-height); padding-bottom: env(safe-area-inset-bottom, 0); }

/* Hide bottom tabs on desktop */
@media (min-width: 768px) {
  .bottom-tabs { display: none; }
  .bottom-spacer { display: none; }
  .mobile-only { display: none !important; }
}
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-content { padding: 16px; max-width: var(--max-width); margin: 0 auto; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }

/* ============================================================
   PROFILE / MY PAGE STYLES
   ============================================================ */
.profile-header-card {
  background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
  border-radius: var(--card-radius); padding: 24px;
  text-align: center; margin-bottom: 16px;
}
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--orange-light); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; font-size: 32px; }
.profile-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.profile-vip-badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; background: var(--vip-gold-light); color: #92400E; font-weight: 600; }
.profile-menu { background: var(--white); border-radius: var(--card-radius); overflow: hidden; margin-bottom: 12px; }
.profile-menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border-light);
  font-size: 15px; transition: background 0.2s;
}
.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item:hover { background: var(--bg); }
.profile-menu-item .left { display: flex; align-items: center; gap: 10px; }
.profile-menu-item .icon { font-size: 20px; width: 24px; text-align: center; }
.profile-menu-item .arrow { color: var(--text-muted); }

.profile-section-title {
  font-size: 14px; color: var(--text-muted); font-weight: 600;
  padding: 16px 0 8px;
}
.profile-history-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.profile-history-item {
  background: var(--white); border-radius: 12px; padding: 12px;
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}

/* ============================================================
   VIP PAGE
   ============================================================ */
.vip-hero {
  background: linear-gradient(135deg, #1F2937, #374151);
  border-radius: var(--card-radius); padding: 32px 24px; text-align: center;
  color: var(--white); margin-bottom: 20px;
}
.vip-hero .crown { font-size: 48px; margin-bottom: 8px; }
.vip-hero h2 { font-size: 24px; margin-bottom: 4px; }
.vip-hero p { color: var(--vip-gold); font-size: 14px; }
.vip-plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
@media (min-width: 768px) { .vip-plans { grid-template-columns: repeat(4, 1fr); } }
.vip-plan {
  background: var(--white); border-radius: var(--card-radius); padding: 20px 16px;
  text-align: center; border: 2px solid var(--border); position: relative;
  transition: all 0.2s; cursor: pointer;
}
.vip-plan:hover { border-color: var(--vip-gold); }
.vip-plan.recommended { border-color: var(--vip-gold); box-shadow: 0 0 0 2px var(--vip-gold-light); }
.vip-plan .badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--vip-gold); color: #7C2D12; padding: 2px 12px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}
.vip-plan .name { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.vip-plan .price { font-size: 28px; font-weight: 800; color: var(--orange); }
.vip-plan .price small { font-size: 14px; }
.vip-plan .period { font-size: 12px; color: var(--text-muted); }
.vip-benefits {
  background: var(--white); border-radius: var(--card-radius); padding: 20px;
  margin-bottom: 20px;
}
.vip-benefits h3 { font-size: 16px; margin-bottom: 12px; }
.vip-benefit-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.vip-benefit-item .check { color: var(--green); font-size: 18px; }

/* ============================================================
   PLAYER PAGE
   ============================================================ */
.player-hero {
  display: flex; gap: 20px; padding: 20px; background: var(--white);
  border-radius: var(--card-radius); margin-bottom: 16px;
}
.player-cover {
  width: 140px; height: 140px; border-radius: var(--card-radius);
  flex-shrink: 0; background: var(--purple-light);
  display: flex; align-items: center; justify-content: center; font-size: 64px;
}
.player-info { flex: 1; }
.player-info h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.player-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.player-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.player-tag { padding: 3px 10px; border-radius: 10px; font-size: 11px; background: var(--bg); color: var(--text-secondary); }
.player-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.player-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.player-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; background: var(--white); border-radius: var(--card-radius) var(--card-radius) 0 0; overflow: hidden; }
.player-tab {
  padding: 12px 20px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.2s; cursor: pointer;
}
.player-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.episode-list { background: var(--white); border-radius: 0 0 var(--card-radius) var(--card-radius); overflow: hidden; }
.episode-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  font-size: 14px; transition: background 0.2s;
}
.episode-item:hover { background: var(--bg); }
.episode-item .num { width: 28px; color: var(--text-muted); }
.episode-item .title { flex: 1; }
.episode-item .duration { color: var(--text-muted); font-size: 12px; }

/* Mobile player */
@media (max-width: 767px) {
  .player-hero { flex-direction: column; align-items: center; text-align: center; padding: 16px; }
  .player-cover { width: 120px; height: 120px; }
  .player-tabs { overflow-x: auto; scrollbar-width: none; }
  .player-tabs::-webkit-scrollbar { display: none; }
  .player-tab { padding: 10px 14px; font-size: 13px; white-space: nowrap; }
}

/* ============================================================
   FLOATING PLAYER BALL
   ============================================================ */
.float-player {
  position: fixed; right: 16px; bottom: 80px; z-index: 997;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--white); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; animation: floatPulse 3s infinite;
}
.float-player img { width: 100%; height: 100%; object-fit: cover; }
.float-player .play-icon {
  position: absolute; font-size: 20px; color: var(--orange);
}

/* ============================================================
   QUICK LISTEN PAGE
   ============================================================ */
.quick-listen-hero {
  background: linear-gradient(135deg, var(--purple-light), #FCE7F3);
  border-radius: var(--card-radius); padding: 24px; text-align: center;
  margin-bottom: 16px;
}
.quick-listen-hero .icon { font-size: 48px; margin-bottom: 8px; }
.quick-listen-hero h2 { font-size: 20px; margin-bottom: 4px; }
.quick-listen-hero p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.quick-listen-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 32px; border-radius: 28px;
  background: var(--purple); color: var(--white); font-size: 16px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(139,92,246,0.4); transition: all 0.2s;
}
.quick-listen-btn:hover { transform: scale(1.05); }
.now-playing-bar {
  background: var(--white); border-radius: var(--card-radius); padding: 16px;
  margin-bottom: 16px; display: flex; align-items: center; gap: 12px;
}
.now-playing-bar .cover { width: 48px; height: 48px; border-radius: 10px; background: var(--purple-light); flex-shrink: 0; }
.now-playing-bar .info { flex: 1; }
.now-playing-bar .info .title { font-size: 14px; font-weight: 600; }
.now-playing-bar .info .progress { font-size: 12px; color: var(--text-muted); }
.now-playing-bar .progress-bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px;
  overflow: hidden; max-width: 200px;
}
.now-playing-bar .progress-bar .fill { height: 100%; background: var(--purple); border-radius: 2px; }

/* ============================================================
   RESPONSIVE UTILITIES
   ============================================================ */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
  .container { padding: 0 24px; }
  .card-grid { padding: 0 24px 16px; }
  .section-header { padding: 16px 24px 8px; }
  .cat-tabs-wrapper { padding: 8px 24px; }
  .banner-section { padding: 16px 24px; }
}
