:root {
  /* Brand Colors */
  --primary-color: #4f46e5;
  /* Indigo 600 */
  --primary-hover: #4338ca;
  /* Indigo 700 */
  --secondary-color: #64748b;
  /* Slate 500 */
  --bg-color: #f8fafc;
  /* Slate 50 */
  --surface-color: #ffffff;
  /* White */
  --text-main: #1e293b;
  /* Slate 800 */
  --text-secondary: #64748b;
  /* Slate 500 */
  --border-color: #e2e8f0;
  /* Slate 200 */
  --success-color: #10b981;
  /* Emerald 500 */
  --danger-color: #ef4444;
  /* Red 500 */

  /* Spacing & Layout */
  --container-width: 1200px;
  --header-height: 70px;

  /* Effects */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

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

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Layout */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navbar */
.navbar {
  height: var(--header-height);
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-size: 1rem;
}

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

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

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--border-color);
  color: var(--text-main);
}

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

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-danger {
  color: var(--danger-color);
  background: transparent;
  padding: 0.5rem;
}

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

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
}

.upload-area {
  border: 3px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem;
  margin-top: 2rem;
  background: white;
  transition: border-color 0.2s;
  cursor: pointer;
  position: relative;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary-color);
  background: #fdfdff;
}

#fileInput {
  display: none;
}

.preview-container img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Test Interface */
.test-stage {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.countdown {
  font-size: 8rem;
  font-weight: 800;
  color: var(--primary-color);
}

.flash-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.flash-container img {
  max-width: 90%;
  max-height: 90vh;
  /* width: 100%;  REMOVED to prevent upscaling */
  object-fit: contain;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  border-radius: var(--radius-md);
}

.feedback-form {
  max-width: 500px;
  width: 100%;
  text-align: left;
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-main);
}

textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-height: 80px;
  font-family: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid var(--primary-color);
  border-color: transparent;
}

/* Star Rating */
.star-rating {
  display: flex;
  gap: 0.5rem;
  font-size: 2rem;
  color: var(--border-color);
  cursor: pointer;
}

.star-rating span {
  transition: color 0.1s;
}

.star-rating span.active,
.star-rating span:hover {
  color: #fbbf24;
  /* Amber 400 */
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

.test-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: transform 0.2s;
}

.test-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
}

.card-content {
  padding: 1.5rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Dashboard Stats */
.stats-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-box {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1.2;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .stats-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Navbar Mobile Tweak */
  .nav-links a[href="#why-important"] {
    display: none;
  }

  .navbar .btn-secondary {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

.feedback-details {
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.feedback-details.open {
  display: block;
}

.feedback-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Active Tests List */
.test-list-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.test-list-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

/* Badges */
.badge {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Suggestions */
.suggestion-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  justify-content: center;
}

.modal {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.link-box {
  background: #f1f5f9;
  padding: 1rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  word-break: break-all;
  font-family: monospace;
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* Why Section Styles */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 1rem;
}

.feature-list {
  list-style: none;
  margin-top: 1rem;
}

.feature-list li {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

/* Testimonials */
.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.testimonial-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.testimonial-header {
  margin-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.75rem;
}

.expert-name {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
}

.expert-role {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.testimonial-text {
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.6;
  font-style: italic;
  flex-grow: 1;
}

.source-link {
  display: block;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--primary-color);
  text-align: right;
  font-weight: 600;
}

.expert-quote {
  font-size: 1.25rem;
  text-align: center;
  margin-bottom: 2rem;
}

/* Responsive updates */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 1rem;
  }

  /* Fix for thumbnail going out of canvas */
  .upload-area {
    padding: 1.5rem;
    /* Reduced from 3rem */
  }

  .stats-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .grid-2-col {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  h1 {
    font-size: 2rem;
  }

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