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

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-input: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #e8364e;
  --accent-hover: #d42a42;
  --accent-gradient: linear-gradient(135deg, #667eea, #e8364e);
  --border-color: #2a2a2a;
  --success: #22c55e;
  --tiktok: #000000;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 800px;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: white;
}

.header-logo-text {
  font-size: 16px;
  font-weight: 600;
}

.lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.lang-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

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

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 36px;
  color: white;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(232, 54, 78, 0.3);
}

.hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.hero-description {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== Features Section ===== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(232, 54, 78, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 20px;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== How It Works ===== */
.how-it-works {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

.how-it-works h2 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

.step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.step-number {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  margin-top: 2px;
}

.step-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Get Started Section ===== */
.get-started {
  background: var(--bg-secondary);
  padding: 48px 24px;
  margin-top: 40px;
}

.get-started-inner {
  max-width: 500px;
  margin: 0 auto;
  min-height: 420px;
}

.get-started h2 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ===== App States ===== */
.app-state {
  display: none;
}

.app-state.active {
  display: block;
}

/* -- Login State -- */
.login-state {
  text-align: center;
  padding: 20px 0;
}

.login-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.btn-tiktok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  max-width: 320px;
}

.btn-tiktok:hover {
  background: #e8e8e8;
}

.btn-tiktok svg {
  flex-shrink: 0;
}

.login-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
  line-height: 1.5;
}

/* -- Connected State -- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  margin-bottom: 24px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.disconnected {
  background: var(--text-muted);
}

.status-text {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.file-upload:hover {
  border-color: var(--text-muted);
}

.file-upload.has-file {
  border-color: var(--success);
  border-style: solid;
  background: rgba(34, 197, 94, 0.05);
}

.file-upload-text {
  font-size: 13px;
  color: var(--text-muted);
}

.file-upload.has-file .file-upload-text {
  color: var(--text-secondary);
}

.file-upload-icon {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.file-upload.has-file .file-upload-icon {
  color: var(--success);
}

.file-upload input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-info {
  display: none;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-upload.has-file .file-info {
  display: block;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--accent);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-group label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  height: 46px;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

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

.btn-primary.loading {
  position: relative;
  color: transparent;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* -- Success State -- */
.success-state {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-icon svg {
  color: var(--success);
}

.success-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* -- Logout Button -- */
.logout-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 16px;
  transition: color 0.2s;
  background: none;
  border: none;
}

.logout-link:hover {
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

.footer a {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 8px;
}

.footer a:hover {
  color: var(--text-secondary);
}

.footer-separator {
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Legal Pages ===== */
.legal-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 24px;
}

.legal-page h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.legal-page h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
}

.legal-page p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.7;
}

.legal-page ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-page li {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hero {
    padding: 40px 16px 24px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero-icon {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  .step {
    padding: 16px;
  }

  .get-started {
    padding: 32px 16px;
  }

  .legal-page {
    padding: 16px 16px 40px;
  }
}
