/* ===== CSS Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark Mode Palette */
  --primary-color: #a855f7; /* Purple */
  --primary-glow: #a855f780;
  --secondary-color: #3b82f6; /* Blue */
  --accent-pink: #ec4899;
  --bg-dark: #0f172a;
  --bg-darker: #020617;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-glass: rgba(255, 255, 255, 0.1);
  --bg-glass: rgba(15, 23, 42, 0.6);

  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --font-heading: "Hind Siliguri", "Bangla", sans-serif;
  --font-body: "Hind Siliguri", sans-serif;

  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 999px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Animated Background ===== */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-darker);
}

.blob {
  position: absolute;
  filter: blur(80px);
  opacity: 0.6;
  animation: float 20s infinite alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: var(--primary-color);
  animation-delay: 0s;
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: var(--secondary-color);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%;
  left: 40%;
  width: 400px;
  height: 400px;
  background: var(--accent-pink);
  animation-delay: -10s;
}

.glass-overlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(60px);
  background: rgba(2, 6, 23, 0.3);
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(50px, 50px) scale(1.1);
  }
}

/* ===== Utilities ===== */
.container {
  max-width: 600px; /* Mobile first focus */
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* ===== Header ===== */
.header {
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 20px var(--primary-glow);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.lang-btn,
.history-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.lang-btn:hover,
.history-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* ===== Hero Section ===== */
.hero-container {
  padding-top: 40px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.hero {
  text-align: center;
  padding: 40px 20px;
}

.hero-icon {
  margin-bottom: 20px;
  color: var(--accent-pink);
  filter: drop-shadow(0 0 15px var(--accent-pink));
}

.hero-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--primary-color);
  margin-bottom: 20px;
  font-weight: 500;
}

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

.pulse-anim {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(168, 85, 247, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
  }
}

/* ===== Buttons ===== */
.btn {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:active {
  transform: scale(0.95);
}

/* ===== Quiz Section (Story Style) ===== */
.quiz-section {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-darker);
  display: none; /* Toggled by JS */
  padding-top: 20px;
}

.quiz-section.active {
  display: flex;
  flex-direction: column;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.quiz-container {
  max-width: 500px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Story Progress Bar */
.story-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 20px;
}

.progress-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-pink));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-text {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Question Card */
.quiz-form-story {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 40px;
}

.question-card {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.q-content {
  animation: fadeScale 0.4s ease forwards;
}

@keyframes fadeScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.question-text-lg {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 40px;
  line-height: 1.4;
  color: #fff;
}

/* Option Buttons (Big, Touch-Friendly) */
.options-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-btn:hover,
.option-btn:active {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary-color);
}

.option-btn.selected {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.option-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.option-btn.selected .option-circle {
  background: #fff;
  border-color: #fff;
}

/* Quiz Controls */
.quiz-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
}

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

.hint-text {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ===== Result Section (Dark Mode) ===== */
.result-header h2 {
  font-size: 28px;
  color: var(--text-primary);
}
.score-circle {
  background: conic-gradient(
    var(--success-color) 0%,
    rgba(255, 255, 255, 0.1) 0%
  );
}
.score-circle::before {
  background: var(--bg-dark);
}
.score-circle span {
  color: var(--success-color);
}

/* Hide sections by default */
.section {
  display: none;
}
.section.active {
  display: block;
  animation: fadeIn 0.4s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
  }
  .question-text-lg {
    font-size: 20px;
  }
  .option-btn {
    padding: 14px;
    font-size: 15px;
  }
}

/* Utility for hidden elements */
.hidden {
  display: none !important;
}
/* ===== Result Section (Glassmorphism & Dark Mode Update) ===== */
.result-header {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.result-icon {
    stroke: var(--primary-color);
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.score-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.score-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto 15px;
    border-radius: 50%;
    /* Gradient set inline by JS, but base defaults here */
    background: conic-gradient(var(--success-color) 0%, rgba(255,255,255,0.1) 0%); 
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 110px;
    height: 110px;
    background: var(--bg-darker);
    border-radius: 50%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.score-circle span {
    position: relative;
    font-size: 32px;
    font-weight: 700;
    z-index: 2;
}

.score-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 10px;
}

/* Analysis & Charts */
.analysis-card, .chart-card, .category-analysis-card, .partner-type-card, .recommendations-card, .download-card, .share-card, .share-link-card {
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    color: var(--text-primary);
}

.analysis-card h3, .chart-card h3, .category-analysis-card h3, .partner-type-card h3, .recommendations-card h3, .download-card h3, .share-card h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-icon {
    fill: var(--primary-color); /* Some icons use fill, some stroke. Adjust based on svg */
    width: 18px; 
    height: 18px;
}

/* Fix Chart Visibility in Dark Mode */
.chart-container canvas {
    background: rgba(255,255,255,0.03); /* Slight contrast background */
    border-radius: 8px;
    padding: 10px;
}

/* Partner Type & Recommendations */
.partner-type-result h4 {
    font-size: 20px;
    color: var(--warning-color);
    margin-bottom: 8px;
}

.recommendations-list {
    list-style: none;
    padding: 0;
}

.recommendations-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommendations-list li::before {
    content: "⚡"; /* Bolt icon bullet */
    color: var(--warning-color);
    font-size: 14px;
}

.recommendations-list li:last-child {
    border-bottom: none;
}

/* Download & Share Buttons */
.download-buttons, .share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.download-btn, .share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    color: white;
    transition: transform 0.2s;
}

.download-btn:hover, .share-btn:hover {
    transform: translateY(-2px);
}

.download-btn.pdf { background: #ef4444; } /* Red */
.download-btn.image { background: #3b82f6; } /* Blue */

.share-btn.facebook { background: #1877f2; }
.share-btn.whatsapp { background: #25d366; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.copy { background: #64748b; }

.share-link-box {
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: var(--radius-md);
    margin-top: 10px;
}

#shareLinkInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.btn-generate {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

/* Result Disclaimer */
.disclaimer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255,0,0,0.1);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.warning-icon {
    fill: var(--danger-color);
}

/* ===== History Section ===== */
.history-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

.history-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-left h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-item-left p {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-score {
    font-size: 18px;
    font-weight: 700;
}

.history-actions {
    margin-top: 20px;
    text-align: center;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 13px;
}

.btn-danger-outline:hover {
    background: var(--danger-color);
    color: white;
}

/* ===== Modals (Name Input, etc) ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.2);
}

.modal-content h3 {
    font-size: 22px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

.form-control {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    background: rgba(255,255,255,0.1);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2000;
    transition: 0.3s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success-color); color: #fff; }
.toast.error { background: var(--danger-color); color: #fff; }

/* Result Actions Buttons */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.result-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* Category Analysis Bars (Missing styles) */
.category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
}
.category-item strong { color: var(--text-primary); }
.category-item span { color: var(--text-secondary); }

/* Navigation Icons */
.btn svg, .share-btn svg, .download-btn svg {
    width: 16px; 
    height: 16px;
    fill: currentColor; 
}
/* Some icons use stroke, need to be specific if icons are mixed */
.btn-secondary svg { fill: white; }

/* Partner Types Grid (Home Section) */
.partner-types h3 { 
    text-align:center; margin-bottom: 20px; color: var(--primary-color);
}
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}
.type-item {
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    display: flex;
    gap: 15px;
    align-items: start;
}
.type-number {
    background: var(--primary-color);
    color: white;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
    flex-shrink: 0;
}
.type-content h4 { font-size: 16px; color: var(--text-primary); margin-bottom: 4px; }
.type-content p { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }

/* Info Cards (Home) */
.info-cards {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.info-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}
.card-icon {
    width: 32px; height: 32px;
    margin-bottom: 10px;
    fill: var(--secondary-color);
}
.info-card h3 { font-size: 16px; margin-bottom: 5px; color: var(--text-primary); }
.info-card p { font-size: 12px; color: var(--text-secondary); }

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(59, 130, 246, 0.2));
    border: 1px solid var(--primary-glow);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    margin-bottom: 40px;
}
.cta-section h3 { font-size: 20px; margin-bottom: 10px; }
.cta-section p { margin-bottom: 20px; color: var(--text-secondary); }
