/* ============================================
   TKOC VIRAL COACH - Stylesheet
   Brand: Violet gradient on White (#9A4CFF → #D7B8FF)
   ============================================ */

/* --- CSS Variables --- */
:root {
  --purple-primary: #9A4CFF;
  --purple-dark: #7B2DFF;
  --purple-light: #B47AFF;
  --purple-bg: #F3ECFF;
  --purple-glow: rgba(154, 76, 255, 0.18);
  --purple-subtle: rgba(154, 76, 255, 0.06);

  --bg-main: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-section: #FAFAFA;
  --bg-input: #F7F7F9;

  --text-primary: #1A1A2E;
  --text-secondary: #555568;
  --text-muted: #8E8EA0;
  --text-white: #FFFFFF;

  --border-light: #E8E8EE;
  --border-card: #EBEBF0;

  --score-critical: #EF4444;
  --score-below: #F59E0B;
  --score-average: #EAB308;
  --score-strong: #22C55E;
  --score-viral: #10B981;

  --green-bg: #ECFDF5;
  --green-border: #A7F3D0;
  --green-text: #065F46;

  --orange-bg: #FFF7ED;
  --orange-border: #FED7AA;
  --orange-text: #9A3412;

  --blue-bg: #EFF6FF;
  --blue-border: #BFDBFE;
  --blue-text: #1E40AF;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --shadow-purple: 0 4px 20px rgba(154, 76, 255, 0.25);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  width: 100%;
  max-width: 720px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--purple-primary);
}

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

.logo-fallback {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-crown {
  width: 32px;
  height: 26px;
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--purple-primary);
}

.logo-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: -4px;
}

/* --- Screens --- */
.screen {
  display: none;
  width: 100%;
  max-width: 720px;
  padding: 0 20px 40px;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-card);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* --- Email Gate Card --- */
.email-card {
  text-align: center;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--purple-bg);
  color: var(--purple-primary);
  margin-bottom: 20px;
}

.card-icon svg {
  width: 32px;
  height: 32px;
}

.email-card h2 {
  font-size: 26px;
}

/* --- Form --- */
.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus {
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 3px var(--purple-glow);
}

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

/* Input with icon */
.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 42px;
}

.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

.form-error {
  color: var(--score-critical);
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

.form-error.visible {
  display: block;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-xs);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--purple-primary);
  color: var(--text-white);
  box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
  background: var(--purple-dark);
  box-shadow: 0 6px 24px rgba(154, 76, 255, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--purple-bg);
  color: var(--purple-primary);
  border: 1px solid rgba(154, 76, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(154, 76, 255, 0.12);
}

.btn-full {
  width: 100%;
  margin-top: 8px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 16px;
}

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

/* --- Upload Zone --- */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-section);
  margin-bottom: 16px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--purple-primary);
  background: var(--purple-subtle);
  box-shadow: 0 0 0 4px var(--purple-glow);
}

.drop-zone.dragover {
  transform: scale(1.01);
}

.upload-icon {
  width: 56px;
  height: 56px;
  color: var(--purple-primary);
  margin-bottom: 12px;
}

.drop-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drop-subtext {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.drop-formats {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
}

/* --- Video Preview --- */
.video-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.video-preview video {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  background: #000;
}

.preview-info {
  flex: 1;
  text-align: left;
}

.preview-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.preview-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Analyzing Screen --- */
.analyzing-card {
  text-align: center;
}

.analyzing-animation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
}

.crown-pulse {
  width: 60px;
  height: 48px;
  color: var(--purple-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

.crown-pulse-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 28px 0;
  padding: 0 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.step.active {
  color: var(--purple-primary);
  font-weight: 600;
}

.step.completed {
  color: var(--score-strong);
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex-shrink: 0;
  transition: all var(--transition);
}

.step.active .step-dot {
  background: var(--purple-primary);
  border-color: var(--purple-primary);
  box-shadow: 0 0 0 4px var(--purple-glow);
}

.step.completed .step-dot {
  background: var(--score-strong);
  border-color: var(--score-strong);
}

.fun-fact {
  background: var(--purple-bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fun-fact strong {
  color: var(--purple-primary);
  display: block;
  margin-bottom: 4px;
}

/* --- Results Screen --- */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Score Hero */
.score-hero {
  text-align: center;
  background: linear-gradient(135deg, var(--purple-bg) 0%, #FFFFFF 100%);
  border: 1px solid rgba(154, 76, 255, 0.12);
}

.gauge-container {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 200px;
  margin: 16px 0;
}

.main-gauge {
  width: 100%;
  height: 100%;
}

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-label .gauge-score {
  display: block;
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.gauge-label .gauge-tier {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

/* Platform Scores */
.platform-scores {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
}

.platform-score {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.platform-icon {
  width: 22px;
  height: 22px;
  color: var(--text-secondary);
}

.platform-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.platform-value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

/* --- Dimensions Grid --- */
.dimensions-card {
  padding-bottom: 16px;
}

.dimensions-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 16px;
}

.dimension-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.dimension-row:last-child {
  border-bottom: none;
}

.dimension-row:hover {
  background: var(--purple-subtle);
  margin: 0 -16px;
  padding: 14px 16px;
  border-radius: var(--radius-xs);
}

.dimension-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dimension-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.dimension-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.dimension-score-num {
  font-size: 16px;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

.dimension-bar-wrap {
  flex: 1;
  max-width: 200px;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 12px;
}

.dimension-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.dimension-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.dimension-detail.open {
  max-height: 300px;
  padding-top: 12px;
}

.dimension-detail-inner {
  background: var(--bg-section);
  border-radius: var(--radius-xs);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.detail-explanation {
  margin-bottom: 10px;
}

.detail-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--purple-bg);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  color: var(--purple-dark);
  font-weight: 500;
}

.detail-suggestion::before {
  content: '💡';
  flex-shrink: 0;
}

/* --- Feedback Cards --- */
.feedback-card {
  padding: 24px;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.feedback-header svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.feedback-header h3 {
  margin: 0;
}

.feedback-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
}

.feedback-list li::before {
  flex-shrink: 0;
  font-size: 16px;
}

/* Strengths card */
.strengths-card {
  border-left: 4px solid var(--score-strong);
}

.strengths-card .feedback-header svg {
  color: var(--score-strong);
}

.strengths-card li {
  background: var(--green-bg);
  color: var(--green-text);
}

.strengths-card li::before {
  content: '✅';
}

/* Improvements card */
.improvements-card {
  border-left: 4px solid var(--score-below);
}

.improvements-card .feedback-header svg {
  color: var(--score-below);
}

.improvements-card li {
  background: var(--orange-bg);
  color: var(--orange-text);
}

.improvements-card li::before {
  content: '⚠️';
}

/* Quick Wins card */
.quickwins-card {
  border-left: 4px solid #6366F1;
}

.quickwins-card .feedback-header svg {
  color: #6366F1;
}

.quickwins-card li {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.quickwins-card li::before {
  content: '⚡';
}

/* Prediction card */
.prediction-card {
  border-left: 4px solid var(--purple-primary);
}

.prediction-card .feedback-header svg {
  color: var(--purple-primary);
}

.prediction-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

/* --- Error Screen --- */
.error-card {
  text-align: center;
}

.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #FEF2F2;
  color: var(--score-critical);
  margin-bottom: 16px;
}

.error-icon svg {
  width: 32px;
  height: 32px;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .header {
    padding: 16px;
  }

  .screen {
    padding: 0 12px 32px;
  }

  .card {
    padding: 24px 20px;
  }

  .card h2 {
    font-size: 20px;
  }

  .platform-scores {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .platform-score {
    width: 100%;
    justify-content: center;
  }

  .gauge-container {
    width: 160px;
    height: 160px;
  }

  .gauge-label .gauge-score {
    font-size: 38px;
  }

  .dimension-bar-wrap {
    max-width: 120px;
  }
}

@media (min-width: 640px) {
  .email-card {
    max-width: 480px;
    margin: 0 auto;
  }

  .upload-card {
    max-width: 560px;
    margin: 0 auto;
  }

  .analyzing-card {
    max-width: 520px;
    margin: 0 auto;
  }
}

/* --- Results Disclaimer --- */
.results-disclaimer {
  text-align: center;
  padding: 24px 20px;
  background: var(--bg-section);
  border-radius: var(--radius);
  border: 1px dashed var(--border-light);
}

.disclaimer-icon {
  margin-bottom: 10px;
}

.disclaimer-crown {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.4;
}

.results-disclaimer p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto 10px;
}

.results-disclaimer p strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.disclaimer-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--purple-light);
  opacity: 0.7;
}

/* --- Utility --- */
[hidden] {
  display: none !important;
}
