/* ========================================
   DevStore MVP - Main Stylesheet
   ======================================== */

/* CSS Variables */
:root {
  --color-primary: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #6366f1;
  --color-secondary: #0f172a;
  --color-accent: #06b6d4;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --max-width: 1200px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-secondary);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--color-primary);
}

.nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav a {
  color: var(--color-text-light);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--color-primary);
}

.nav .admin-link {
  color: var(--color-text-light);
  font-size: 0.8rem;
  opacity: 0.6;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
}

/* Main */
.main {
  flex: 1;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #1e1b4b 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero h1 span {
  color: var(--color-accent);
}

.hero p {
  font-size: 1.15rem;
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-sm:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-lg {
  padding: 14px 36px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

/* Pending download spinner */
.pending-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-success {
  background: var(--color-success);
  color: white;
}

/* Sections */
.section {
  padding: 60px 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--color-secondary);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.product-card-image {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-placeholder {
  color: rgba(255,255,255,0.8);
  font-size: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.product-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.product-card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  line-height: 1.3;
}

.product-card-body h3 a {
  color: var(--color-secondary);
}

.product-card-body h3 a:hover {
  color: var(--color-primary);
}

.product-card-body p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 16px;
  flex: 1;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-light);
}

.product-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-secondary);
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--color-surface);
  padding: 28px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--color-secondary);
}

.feature-card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* Newsletter */
.newsletter-box {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: 48px;
  border-radius: var(--radius-xl);
  text-align: center;
}

.newsletter-box h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.newsletter-box p {
  margin-bottom: 24px;
  opacity: 0.9;
}

.newsletter-form-lg {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

.newsletter-form-lg input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  outline: none;
}

.newsletter-form-lg .btn {
  white-space: nowrap;
}

.newsletter-note {
  font-size: 0.8rem;
  margin-top: 12px;
  opacity: 0.7;
}

/* Product Detail */
.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.product-detail-image {
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-placeholder {
  color: rgba(255,255,255,0.6);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.product-detail-info h1 {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--color-secondary);
}

.product-detail-price {
  margin: 16px 0;
}

.current-price {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-primary);
}

.currency-label {
  color: var(--color-text-light);
  margin-left: 8px;
  font-size: 1rem;
}

.product-detail-excerpt {
  color: var(--color-text-light);
  font-size: 1.05rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Purchase Form */
.purchase-form {
  background: var(--color-bg);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.purchase-form h4 {
  margin-bottom: 16px;
  font-size: 1.05rem;
  color: var(--color-secondary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-group small {
  display: block;
  margin-top: 4px;
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.purchase-message {
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 12px;
  font-size: 0.9rem;
}

.purchase-message.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.purchase-message.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.purchase-loading {
  text-align: center;
  padding: 20px;
  color: var(--color-text-light);
  font-size: 0.95rem;
}

.product-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-item {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.product-description-full {
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--color-border);
}

.product-description-full h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--color-secondary);
}

.description-content {
  line-height: 1.8;
  color: var(--color-text);
  max-width: 800px;
}

.description-content h3 {
  margin: 24px 0 12px;
  color: var(--color-secondary);
}

.description-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.description-content li {
  margin-bottom: 6px;
}

/* Related Products */
.related-products {
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--color-border);
}

.related-products h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--color-secondary);
}

/* Category Filters */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
  justify-content: center;
}

.filter-tag {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all 0.2s;
  text-decoration: none;
}

.filter-tag:hover,
.filter-tag.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Page Content */
.page-content {
  max-width: 800px;
  margin: 0 auto;
}

.page-content h1 {
  font-size: 2.2rem;
  margin-bottom: 32px;
  color: var(--color-secondary);
}

.page-title {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 32px;
  color: var(--color-secondary);
}

.content-card {
  background: var(--color-surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  line-height: 1.8;
}

.content-card h2 {
  margin-bottom: 16px;
  color: var(--color-secondary);
}

.content-card h3 {
  margin: 24px 0 12px;
  color: var(--color-secondary);
}

.content-card p {
  margin-bottom: 12px;
}

.content-card ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.content-card li {
  margin-bottom: 8px;
}

/* Download Page */
.download-page {
  max-width: 600px;
  margin: 0 auto;
}

.download-card {
  background: var(--color-surface);
  padding: 48px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.download-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.download-card h1 {
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: var(--color-secondary);
}

.download-card p {
  color: var(--color-text-light);
  margin-bottom: 12px;
}

.download-info {
  background: var(--color-bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin: 16px 0;
  display: inline-block;
}

.download-card .btn {
  margin: 20px 0;
}

.download-note {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* FAQ */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--color-surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

.faq-item h3 {
  font-size: 1.1rem;
  color: var(--color-secondary);
  margin-bottom: 8px;
}

.faq-item p {
  color: var(--color-text-light);
  line-height: 1.6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state h2,
.empty-state h3 {
  color: var(--color-secondary);
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--color-text-light);
  margin-bottom: 24px;
}

/* Footer */
.footer {
  background: var(--color-secondary);
  color: rgba(255,255,255,0.8);
  padding: 48px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h4 {
  color: white;
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-col p {
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer-col a {
  display: block;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: white;
}

.newsletter-form {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.newsletter-form input {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  background: rgba(255,255,255,0.15);
  color: white;
}

.newsletter-form input::placeholder {
  color: rgba(255,255,255,0.5);
}

.newsletter-form button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: var(--color-primary-dark);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero {
    padding: 48px 0;
  }

  .nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .product-detail-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .product-detail-image {
    min-height: 250px;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .newsletter-form-lg {
    flex-direction: column;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}