/* ============================================================
   Fukangheng iOS Apps — Main Stylesheet
   ============================================================ */

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

:root {
  --primary:   #0a2540;
  --accent:    #2563eb;
  --accent2:   #38bdf8;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --text:      #1e293b;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --radius:    16px;
  --shadow:    0 4px 24px rgba(10,37,64,.10);
  --transition: .22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

img { display: block; max-width: 100%; }
a  { color: var(--accent); text-decoration: none; }

/* ============================================================
   LANGUAGE BAR
   ============================================================ */
#lang-bar {
  background: var(--primary);
  padding: 10px 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

#lang-bar label {
  color: #cbd5e1;
  font-size: .82rem;
  margin-right: 10px;
  letter-spacing: .04em;
}

#lang-select {
  background: rgba(255,255,255,.12);
  color: #f1f5f9;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  padding: 5px 12px 5px 8px;
  font-size: .88rem;
  cursor: pointer;
  outline: none;
  transition: background var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23cbd5e1' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

#lang-select:hover { background-color: rgba(255,255,255,.2); }
#lang-select option { background: #1e293b; color: #f1f5f9; }

/* ============================================================
   HERO / COMPANY HEADER
   ============================================================ */
#hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a5f 55%, #1d4ed8 100%);
  color: #fff;
  text-align: center;
  padding: 80px 24px 90px;
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
}

#hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -.01em;
}

#hero .company-en {
  font-size: clamp(.75rem, 1.8vw, .95rem);
  color: rgba(255,255,255,.65);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 24px;
  font-weight: 400;
}

#hero p.tagline {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  color: rgba(255,255,255,.85);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ============================================================
   APPS SECTION
   ============================================================ */
#apps {
  padding: 72px 24px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

#apps .section-title {
  text-align: center;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

#apps .section-sub {
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 48px;
}

/* App cards grid */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.app-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  user-select: none;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(10,37,64,.16);
}

.app-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12), var(--shadow);
}

.app-card__icon {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}

.app-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.app-card__tagline {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
}

.app-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: .04em;
}

/* ============================================================
   APP DETAIL PANEL
   ============================================================ */
#app-detail-wrapper {
  overflow: hidden;
  transition: max-height .45s cubic-bezier(.4,0,.2,1), opacity .35s ease;
  max-height: 0;
  opacity: 0;
}

#app-detail-wrapper.open {
  max-height: 2000px;
  opacity: 1;
}

#app-detail {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  position: relative;
  border-top: 4px solid var(--accent);
}

#app-detail-close {
  position: absolute;
  top: 16px; right: 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--muted);
  line-height: 1;
  transition: color var(--transition);
}
#app-detail-close:hover { color: var(--text); }

#app-detail-content { /* dynamic inject target */ }

/* Detail content styles (injected from apps/*.html) */
.detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.detail-icon {
  width: 72px; height: 72px;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  object-fit: cover;
  flex-shrink: 0;
}

.detail-header-text h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.detail-header-text p {
  font-size: .9rem;
  color: var(--muted);
}

.detail-body { font-size: .95rem; line-height: 1.75; color: var(--text); }
.detail-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.feature-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
  margin-bottom: 12px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: .88rem;
}

.feature-list li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Screenshots strip */
.screenshots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-top: 16px;
  scroll-snap-type: x mandatory;
}

.screenshots::-webkit-scrollbar { height: 4px; }
.screenshots::-webkit-scrollbar-track { background: var(--border); border-radius: 4px; }
.screenshots::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 4px; }

.screenshots img {
  height: 280px;
  width: auto;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  flex-shrink: 0;
  scroll-snap-align: start;
  object-fit: cover;
}

/* Privacy badge */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .82rem;
  font-weight: 600;
  margin-top: 14px;
}

/* Pricing tag */
.pricing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.pricing .price-tag {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  padding: 4px 14px;
  border-radius: 999px;
}

.pricing .price-note {
  font-size: .82rem;
  color: var(--muted);
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  background: var(--primary);
  color: rgba(255,255,255,.75);
  padding: 48px 24px 32px;
  margin-top: 72px;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.footer-col h4 {
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.footer-col p, .footer-col a {
  font-size: .85rem;
  line-height: 1.9;
  color: rgba(255,255,255,.65);
}

.footer-col a:hover { color: var(--accent2); }

.footer-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.1);
  max-width: 900px;
  margin: 32px auto 20px;
}

.footer-copy {
  text-align: center;
  font-size: .78rem;
  color: rgba(255,255,255,.4);
  max-width: 900px;
  margin: 0 auto;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.spinner::after {
  content: '';
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  #hero { padding: 56px 20px 64px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  #app-detail { padding: 24px 18px; }
  .detail-header { flex-direction: column; align-items: flex-start; }
  .screenshots img { height: 200px; }
}

@media (max-width: 400px) {
  .app-cards { grid-template-columns: 1fr; }
}
