/* CSS Variables */
:root {
  --primary: #1a1a2e;
  --primary-light: #4a4a6a;
  --accent: #8b0000;
  --accent-light: #b22222;
  --accent-dark: #660000;
  --success: #2e7d32;
  --warning: #ed6c02;
  --error: #d32f2f;
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-light: #fafafa;
  --text: #1a1a1a;
  --text-light: #555555;
  --text-muted: #888888;
  --border: #e0e0e0;
  --border-dark: #cccccc;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  scroll-behavior: smooth;
}

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

/* App Container */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 45px;
  height: 45px;
  color: var(--accent-light);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-main {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* Section Header */
.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.section-header p {
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  font-size: 1rem;
}

/* Upload Grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Upload Card */
.upload-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}

.card-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

/* Upload Zone */
.upload-zone {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 2px dashed var(--border);
  margin: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(139, 0, 0, 0.03);
}

.upload-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--accent);
}

.upload-icon svg {
  width: 100%;
  height: 100%;
}

.upload-main {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Preview Container */
.preview-container {
  position: relative;
  padding: 1rem;
}

.preview-container img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #f8f8f8;
}

.remove-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--error);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.remove-btn:hover {
  transform: scale(1.1);
}

.remove-btn svg {
  width: 16px;
  height: 16px;
}

/* Subject Info */
.subject-info {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.subject-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.info-field input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.info-field input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Analyze Button */
.analyze-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 350px;
  margin: 0 auto 2rem;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.analyze-btn:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(139, 0, 0, 0.4);
}

.analyze-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

/* Benefits Box */
.benefits-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow);
}

.benefits-box h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.benefits-box ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.benefits-box li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

.benefits-box li::before {
  content: '•';
  color: var(--accent);
  font-weight: bold;
}

/* Loading Section */
.loading-section {
  text-align: center;
  padding: 4rem 2rem;
}

.loading-content {
  max-width: 450px;
  margin: 0 auto;
}

.loading-animation {
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
}

.pen-writing svg {
  width: 100%;
  height: 100%;
  color: var(--accent);
}

.pen {
  animation: write 2s ease-in-out infinite;
}

.writing-line {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-line 2s ease-in-out infinite;
}

@keyframes write {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(8px, 8px) rotate(3deg); }
}

@keyframes draw-line {
  0% { stroke-dashoffset: 40; }
  50%, 100% { stroke-dashoffset: 0; }
}

.loading-content h2 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 2rem;
  color: var(--primary);
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  opacity: 0.4;
  transition: all 0.3s ease;
}

.step.active {
  opacity: 1;
  background: rgba(139, 0, 0, 0.05);
  border-left: 3px solid var(--accent);
}

.step.completed {
  opacity: 1;
}

.step.completed .step-icon {
  background: var(--success);
}

.step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ========== REPORT STYLES ========== */

.results-section {
  animation: fadeIn 0.5s ease;
}

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

.report-container {
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  max-width: 850px;
  margin: 0 auto;
}

/* Report Header */
.report-header {
  border-bottom: 3px solid var(--accent);
}

.report-branding {
  display: flex;
  align-items: stretch;
}

.brand-left {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}

.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.65rem;
  letter-spacing: 2px;
  font-weight: 500;
  white-space: nowrap;
}

.brand-center {
  flex: 1;
  padding: 1.5rem 2rem;
}

.report-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-style: italic;
  color: var(--primary);
  margin-bottom: 1rem;
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 2rem;
}

.meta-row {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.meta-label {
  font-weight: 600;
  color: var(--text);
}

.meta-value {
  color: var(--text-light);
}

.brand-right {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--border);
}

.report-logo {
  width: 50px;
  height: 50px;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

/* Report Sections */
.report-section {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
}

.section-title {
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
}

.part-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.section-title h2 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

.section-intro {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
}

.section-intro p {
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: italic;
}

.section-intro em {
  color: var(--primary);
  font-weight: 500;
}

/* Profile Content */
.profile-content {
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  line-height: 1.8;
}

.profile-content p {
  margin-bottom: 1rem;
  text-align: justify;
}

.profile-subsection {
  margin-top: 1.5rem;
}

.profile-subsection h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Traits Chart */
.traits-chart {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trait-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.trait-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.trait-bar-container {
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.trait-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 100%);
  border-radius: 12px;
  transition: width 0.5s ease;
}

.trait-score {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

.trait-description {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--text-light);
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* Tree Analysis Content */
.tree-analysis-content {
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  line-height: 1.8;
}

.symbolism-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.symbolism-item {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
}

.symbolism-element {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.symbolism-interpretation {
  font-size: 0.9rem;
  color: var(--text-light);
}

.confidence-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 10px;
  margin-left: 0.5rem;
}

.confidence-high {
  background: rgba(46, 125, 50, 0.1);
  color: var(--success);
}

.confidence-medium {
  background: rgba(237, 108, 2, 0.1);
  color: var(--warning);
}

.confidence-low {
  background: rgba(136, 136, 136, 0.1);
  color: var(--text-muted);
}

/* Combined Content */
.combined-content {
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  line-height: 1.8;
}

.theme-card {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

.theme-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.evidence-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.evidence-col {
  padding: 0.75rem;
  background: white;
  border-radius: var(--radius);
}

.evidence-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.evidence-text {
  font-size: 0.9rem;
}

.theme-interpretation {
  font-style: italic;
  color: var(--text-light);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Career & Growth Content */
.career-growth-content {
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  line-height: 1.8;
}

.career-section,
.growth-section {
  margin-bottom: 2rem;
}

.career-section h4,
.growth-section h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.career-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.career-tag {
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
}

.work-style-box {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
}

.growth-item {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
  margin-bottom: 1rem;
}

.growth-area {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.growth-insight {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.growth-suggestion {
  font-size: 0.9rem;
  color: var(--success);
  font-weight: 500;
}

.strengths-box {
  margin-top: 1.5rem;
}

.strengths-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.strength-tag {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Report Footer */
.report-footer {
  padding: 2rem;
  background: var(--bg-light);
}

.disclaimer-box {
  padding: 1rem;
  background: white;
  border-radius: var(--radius);
  border-left: 4px solid var(--warning);
  margin-bottom: 1.5rem;
}

.disclaimer-box h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 0.5rem;
}

.disclaimer-box p {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.6;
}

.footer-meta {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.report-timestamp {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* Report Actions */
.report-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 2rem;
  background: white;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

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

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

.new-btn {
  background: white;
  color: var(--accent);
  border: 2px solid var(--accent);
}

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

/* Error Section */
.error-section {
  text-align: center;
  padding: 4rem 2rem;
}

.error-content {
  max-width: 400px;
  margin: 0 auto;
}

.error-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.5rem;
  color: var(--error);
}

.error-icon svg {
  width: 100%;
  height: 100%;
}

.error-content h2 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 1rem;
  color: var(--primary);
}

.error-content p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.retry-btn {
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--primary);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
}

/* Print Styles */
@media print {
  .header,
  .footer,
  .report-actions {
    display: none !important;
  }

  .main {
    padding: 0;
    max-width: none;
  }

  .report-container {
    box-shadow: none;
    max-width: none;
  }

  .report-section {
    page-break-inside: avoid;
  }

  body {
    background: white;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .section-header h1 {
    font-size: 1.75rem;
  }

  .report-branding {
    flex-direction: column;
  }

  .brand-left {
    width: 100%;
    height: 30px;
  }

  .vertical-text {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .brand-right {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .report-meta {
    grid-template-columns: 1fr;
  }

  .trait-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .trait-bar-container {
    order: 2;
  }

  .trait-score {
    order: 1;
    text-align: left;
  }

  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .report-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    justify-content: center;
  }
}

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