/* ====================================================
   Question Solver AI — Complete Stylesheet
   File: public/style.css
   ==================================================== */

/* ---------- CSS Variables / Theme ---------- */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-2: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  --radius: 1rem;
  --transition: 0.3s ease;
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* ---------- Glass Effect ---------- */
.glass-card,
.glass-nav,
.glass-sidebar,
.glass-topbar {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-size: 0.95rem;
  white-space: nowrap;
}

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

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

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary-hero {
  background: var(--gradient-1);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: 1rem;
}

.btn-primary-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--glass-bg);
}

.btn-secondary-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: 1rem;
}

.btn-outline-nav {
  border: 1px solid var(--glass-border);
  background: transparent;
}

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

.btn-primary-full {
  width: 100%;
  background: var(--gradient-1);
  color: white;
  justify-content: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  padding: 0.4rem;
  border-radius: 0.5rem;
  transition: background var(--transition);
}

.btn-icon:hover {
  background: var(--glass-bg);
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1200px;
  z-index: 100;
  padding: 0.75rem 2rem;
  border-radius: 5rem;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.3rem;
}

.logo-icon {
  font-size: 1.6rem;
}

.logo-accent {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--accent);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-menu-btn span {
  width: 25px;
  height: 3px;
  background: var(--text-primary);
  border-radius: 2px;
}

/* ---------- Hero Section ---------- */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-top: 5rem;
}

.hero-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  z-index: 0;
}

.hero-orb-1 {
  width: 40rem;
  height: 40rem;
  background: #a5b4fc;
  top: -10rem;
  right: -5rem;
}

.hero-orb-2 {
  width: 30rem;
  height: 30rem;
  background: #67e8f9;
  bottom: -5rem;
  left: -5rem;
}

.hero-orb-3 {
  width: 20rem;
  height: 20rem;
  background: #c084fc;
  top: 50%;
  left: 30%;
}

.hero-container {
  max-width: 900px;
  text-align: center;
  z-index: 1;
  padding: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.5rem 1.2rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}

.hero-title {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.gradient-text {
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 3rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.hero-preview-card {
  max-width: 500px;
  margin: 0 auto;
  padding: 1.5rem;
  text-align: left;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.preview-dots {
  display: flex;
  gap: 4px;
}

.preview-dots span {
  width: 8px;
  height: 8px;
  background: #cbd5e1;
  border-radius: 50%;
}

.preview-question {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-style: italic;
}

.preview-answer {
  font-size: 0.9rem;
}

/* ---------- Sections ---------- */
.section-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-badge {
  display: inline-block;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.3rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
}

/* ---------- Features ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  padding: 2rem;
  transition: transform var(--transition);
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* ---------- Formats ---------- */
.formats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.format-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-weight: 500;
}

.formats-note {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-secondary);
}

/* ---------- How It Works ---------- */
.steps-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.step-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 2rem;
  flex: 1;
  min-width: 250px;
  text-align: center;
}

.step-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.step-connector {
  width: 60px;
  height: 2px;
  background: var(--glass-border);
  align-self: center;
  margin: 0 -0.5rem;
}

/* ---------- Testimonials ---------- */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.testimonial-card {
  padding: 2rem;
}

.testimonial-stars {
  color: #fbbf24;
  margin-bottom: 1rem;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.author-avatar {
  width: 40px;
  height: 40px;
  background: var(--gradient-1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

/* ---------- FAQ ---------- */
.faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.faq-item {
  margin-bottom: 0.75rem;
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1rem;
}

.faq-answer {
  padding: 0 1.5rem 1.5rem;
  color: var(--text-secondary);
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-chevron {
  transition: transform 0.3s;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

/* ---------- CTA ---------- */
.cta-section {
  padding: 5rem 2rem;
}

.cta-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  padding: 3rem;
}

.cta-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--glass-border);
  padding: 2rem;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

/* ---------- Auth Pages ---------- */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-primary);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.auth-logo {
  display: block;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  font-size: 1.5rem;
}

.auth-card {
  padding: 2rem;
}

.auth-card h1 {
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
}

.input-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.otp-timer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.auth-error {
  color: #ef4444;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  min-height: 1.5em;
}

.auth-loader {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

/* ---------- App Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand a {
  font-weight: 700;
  font-size: 1.3rem;
}

.sidebar-nav {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-item.active,
.nav-item:hover {
  background: var(--glass-bg);
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
}

.usage-badge {
  background: var(--glass-bg);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  display: inline-block;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-menu {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  min-width: 150px;
  box-shadow: var(--glass-shadow);
  z-index: 10;
}

.profile-dropdown a,
.profile-dropdown button {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: 0.5rem;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background: var(--glass-bg);
}

/* ---------- Workspace (Dashboard) ---------- */
.workspace {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.question-input-card {
  padding: 2rem;
}

.question-input-card textarea {
  width: 100%;
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  resize: vertical;
  font-family: inherit;
}

.file-upload-area {
  margin: 1rem 0;
  border: 2px dashed var(--glass-border);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.file-upload-area:hover {
  border-color: var(--accent);
}

.browse-link {
  color: var(--accent);
  font-weight: 500;
}

.file-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.file-preview iframe {
  width: 100%;
  height: 300px;
  border: none;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.error-message {
  color: #ef4444;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* ---------- Loaders ---------- */
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
}

/* ---------- Skeleton Loader ---------- */
.skeleton-line {
  height: 1rem;
  background: var(--glass-bg);
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
}

.skeleton-line.wide {
  width: 80%;
}

.skeleton-line.medium {
  width: 60%;
}

.skeleton-line.short {
  width: 40%;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-success {
  border-left: 4px solid #10b981;
}

/* ---------- Answer Board Styles ---------- */
.answer-container {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.answer-board {
  padding: 2rem;
}

.board-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  border-left: 5px solid var(--accent);
  padding-left: 1rem;
}

.steps-board {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.step-card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  display: flex;
  padding: 1.25rem;
  transition: all var(--transition);
}

.step-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.step-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 40px;
  text-align: center;
  margin-right: 1rem;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-body h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.step-body p {
  color: var(--text-secondary);
  margin: 0 0 0.8rem 0;
  line-height: 1.6;
}

.formula-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  font-family: 'Courier New', monospace;
  font-weight: 500;
  color: var(--accent);
  display: inline-block;
  font-size: 0.95rem;
}

.final-answer-card {
  background: var(--gradient-1);
  color: white;
  padding: 1.5rem;
  border-radius: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.final-label {
  font-size: 1rem;
  margin-right: 0.5rem;
  opacity: 0.9;
}

.board-summary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-top: 1.5rem;
  color: var(--text-primary);
  font-style: italic;
}

.answer-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* ---------- History ---------- */
.history-container {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.history-search input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-preview {
  cursor: pointer;
  flex: 1;
}

.delete-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.2rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

/* ---------- Profile ---------- */
.profile-container {
  max-width: 500px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.profile-card {
  padding: 2rem;
  text-align: center;
}

.profile-avatar {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.stats-grid {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 0.75rem;
    overflow-x: auto;
    height: auto;
    position: static;
  }

  .sidebar-nav {
    flex-direction: row;
    margin-top: 0;
  }

  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .nav-links {
    display: none;
  }

  .nav-links.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1rem;
    gap: 0.75rem;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .steps-container {
    flex-direction: column;
  }

  .step-connector {
    width: 2px;
    height: 30px;
    align-self: center;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }
}
