/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --success: #059669;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--gray-900);
  line-height: 1.6;
  background: #fff;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER ===== */
.header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--gray-900);
}

.logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav a {
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gray-900);
}

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}

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

.btn-text {
  background: transparent;
  color: var(--primary);
  padding: 8px 12px;
}

.btn-text:hover {
  text-decoration: underline;
}

.btn-large {
  padding: 14px 32px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

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

/* ===== HERO ===== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
  color: var(--gray-900);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--gray-700);
  margin-bottom: 32px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-note {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* ===== APP AREA ===== */
.app-area {
  padding: 40px 0 80px;
  background: var(--gray-50);
  min-height: 60vh;
}

.step {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.step-number {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.step h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  transition: all 0.2s ease;
  background: var(--gray-50);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--gray-700);
}

.upload-hint {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.file-info {
  margin-top: 20px;
  padding: 16px;
  background: #ecfdf5;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.validation-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.validation-box ul {
  margin: 8px 0 0 18px;
}

.validation-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.validation-box.warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.validation-box.ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 20px;
}

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

.select, .input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  transition: border-color 0.15s;
}

.select:focus, .input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 6px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  cursor: pointer;
}

.checkbox-item:hover {
  background: var(--gray-100);
}

.checkbox-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.columns-grid, .config-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
}

@media (min-width: 640px) {
  .columns-grid, .config-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== RESULTS ===== */
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.chart-container {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  height: 380px;
}

.table-container {
  overflow-x: auto;
  margin-bottom: 32px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

tr:last-child td {
  border-bottom: none;
}

.pro-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.pro-banner h3 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.pro-banner p {
  color: var(--gray-700);
  margin-bottom: 20px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== FEATURES & PRICING ===== */
.section {
  padding: 70px 0;
}

.section-alt {
  background: var(--gray-50);
}

.section h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.feature-card {
  background: white;
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 auto 16px;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.feature-card p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  max-width: 700px;
  margin: 0 auto;
}

.price-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  position: relative;
}

.price-card-pro {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.price-card h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.price {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--gray-900);
}

.price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-500);
}

.price-card ul {
  list-style: none;
  margin-bottom: 28px;
  text-align: left;
}

.price-card li {
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.95rem;
}

.price-card li:before {
  content: "✓ ";
  color: var(--success);
  font-weight: 700;
}

/* ===== FOOTER ===== */
.footer {
  padding: 32px 0;
  text-align: center;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 0.9rem;
}

.footer a,
.legal-content a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover,
.legal-content a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-top: 8px;
}

.legal-page {
  padding: 48px 0 80px;
  background: var(--gray-50);
}

.legal-content {
  background: #fff;
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  max-width: 800px;
}

.legal-content h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.legal-updated {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.legal-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 28px;
}

.legal-content h2 {
  font-size: 1.2rem;
  margin: 28px 0 10px;
}

.legal-content ul {
  margin: 8px 0 16px 20px;
}

.legal-content li {
  margin-bottom: 8px;
}

.book-layout {
  display: grid;
  gap: 28px;
  align-items: start;
}

@media (min-width: 800px) {
  .book-layout {
    grid-template-columns: 280px 1fr;
  }
}

.book-cover {
  width: 100%;
  max-width: 280px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.book-text {
  margin: 0;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-content h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.modal-content > p {
  color: var(--gray-500);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.9rem;
  }
  
  .hero {
    padding: 50px 0 40px;
  }
  
  .header-content {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 0 12px;
  }

  .nav.open {
    display: flex;
  }

  .nav a,
  .nav .btn {
    display: block;
    text-align: center;
    padding: 10px 12px;
  }
  
  .step {
    padding: 24px 18px;
  }
  
  .chart-container {
    height: 280px;
  }
}
