/* ===== PikVue Shop - Global Styles ===== */
:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: #A29BFE;
  --accent: #00B894;
  --accent-dark: #00A383;
  --bg: #F8F9FD;
  --bg-card: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-muted: #B2BEC3;
  --border: #E9ECF0;
  --shadow: 0 2px 16px rgba(108, 92, 231, 0.08);
  --shadow-lg: 0 8px 32px rgba(108, 92, 231, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
  --max-width: 1200px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

/* ===== Layout ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.95);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo svg {
  width: 28px;
  height: 28px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-switch {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
}

.lang-switch:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  background: linear-gradient(135deg, #6C5CE7 0%, #A29BFE 50%, #00B894 100%);
  color: white;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Categories ===== */
.categories {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.cat-btn:hover, .cat-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== Product Grid ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding: 0 0 60px;
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--border);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-cover-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.product-cover-placeholder.ebook { background: linear-gradient(135deg, #fd79a8, #e84393); }
.product-cover-placeholder.video { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.product-cover-placeholder.tool { background: linear-gradient(135deg, #00b894, #55efc4); }

.product-info {
  padding: 20px;
}

.product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.product-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}

.product-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-sm {
  padding: 6px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Product Detail Page ===== */
.product-detail {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 24px;
}

.product-detail-header {
  text-align: center;
  margin-bottom: 32px;
}

.product-detail-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.detail-cover-placeholder {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}

.product-detail h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.product-detail .price {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 800;
  margin: 16px 0;
}

.product-detail .description {
  font-size: 1.05rem;
  color: var(--text-light);
  line-height: 1.8;
  margin-bottom: 32px;
}

/* Purchase form */
.purchase-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.purchase-box h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ===== Download Page ===== */
.download-page {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
  padding: 0 24px;
}

.download-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 48px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.download-card .icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.download-card h2 {
  margin-bottom: 12px;
}

.download-card .delivery-content {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 24px 0;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  word-break: break-all;
  border: 1px solid var(--border);
}

.delivery-content a {
  color: var(--primary);
  font-weight: 600;
}

.download-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-error {
  background: #ffeef0;
  color: #d63031;
  border: 1px solid #fab1a0;
}

.alert-success {
  background: #edfff5;
  color: #00b894;
  border: 1px solid #55efc4;
}

.alert-info {
  background: #eef0ff;
  color: #6c5ce7;
  border: 1px solid #a29bfe;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal h2 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .products-grid {
    grid-template-columns: 1fr;
  }
  .header .container {
    padding: 0 16px;
  }
  .product-detail h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 48px 16px 40px;
  }
  .hero h1 {
    font-size: 1.5rem;
  }
  .categories {
    gap: 8px;
  }
  .cat-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}
