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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #1e293b;
  background-color: #f8fafc;
}

/* Navigation */
.nav {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  height: 50px;
  width: auto;
}

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

.user-name {
  font-weight: 600;
  color: #334155;
}

/* Buttons */
.btn-primary {
  /* Initial State: White background, Blue border, Blue text */
  background: white; 
  color: #3C3979; 
  border: 2px solid #3C3979; 
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  /* Hover State: Red background, White text, Red border */
  background: #DC3545; 
  color: white; 
  border: 2px solid #DC3545; 
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(60, 57, 121, 0.3); 
}

.btn-secondary {
  background: white;
  color: #3C3979;
  border: 2px solid #3C3979;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-full {
  width: 100%;
}

/* Hero Section */
.hero {
  /* Consistent Blue for Gradient */
  background: linear-gradient(135deg, #3C3979 0%, #3C3979 50%, #3C3979 100%);
  color: white;
  padding: 6rem 2rem;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

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

.highlight {
  color: #DC3545;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.95;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Features Section */
.features {
  padding: 5rem 2rem;
  background: white;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 3rem;
  color: #1e293b;
}

.features-grid {
  /* 4 containers in one flexible line, no scroller */
  display: grid;
  grid-template-columns: repeat(4, 1fr); 
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  background: #f8fafc;
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-color: #3C3979; 
}

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

.feature-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #3C3979; 
}

.feature-card p {
  color: #64748b;
  line-height: 1.7;
}

/* CTA Section */
.cta {
  /* Consistent Blue for Gradient */
  background: linear-gradient(135deg, #3C3979 0%, #3C3979 100%);
  color: white;
  padding: 5rem 2rem;
  text-align: center;
}

.cta h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.cta p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Footer */
.footer {
  background: #1e293b;
  color: white;
  padding: 2rem;
  text-align: center;
}

/* Auth Pages */
.auth-container {
  min-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column; 
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-back-link {
  color: #3C3979; 
  text-decoration: none;
  font-weight: 600;
  display: block; 
  text-align: left;
  max-width: 450px; 
  margin: 0 auto 1rem auto; 
  /* FIXED: Adjusted padding to 0.5rem to move text left, aligning with the card's outer edge */
  padding-left: 0; 
  transition: color 0.2s ease;
}

.auth-back-link:hover {
  color: #DC3545; 
  text-decoration: underline;
}

.auth-card {
  background: white;
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 450px;
}

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1e293b;
  text-align: center;
}

.auth-subtitle {
  color: #64748b;
  text-align: center;
  margin-bottom: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: #334155;
}

.form-group input,
.form-group select {
  padding: 0.875rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3C3979; 
  box-shadow: 0 0 0 3px rgba(60, 57, 121, 0.1); 
}

.error-message {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: #64748b;
}

.auth-footer a {
  color: #3C3979; 
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Dashboard */
.dashboard-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.dashboard-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.mcq-question {
    font-weight: 600;
    margin-bottom: 10px;
}

.mcq-options {
    margin-left: 10px;
}

.mcq-option {
    padding: 6px 0;
}

.mcq-instruction {
    margin-top: 10px;
    font-style: italic;
    color: #333;
}

.mcq-warning {
    color: red;
    font-weight: bold;
}

.mcq-output h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.mcq-output h3 {
    font-size: 16px;
    margin-top: 12px;
}

.mcq-output hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 12px 0;
}

.mcq-output {
    line-height: 1.6;
}

.mcq-output strong {
    color: #1f3c88;
}

.tab-btn:hover {
  color: #3C3979; 
}

.tab-btn.active {
  color: #3C3979; 
  border-bottom-color: #3C3979; 
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Chat Interface */
.chat-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  height: 600px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  max-width: 80%;
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.message-content {
  padding: 1rem;
  border-radius: 12px;
}

.chat-message.user .message-content {
  background: #3C3979; 
  color: white;
}

.chat-message.assistant .message-content {
  background: #f1f5f9;
  color: #1e293b;
}

.chat-input-container {
  padding: 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 1rem;
}

.chat-input-container input {
  flex: 1;
  padding: 0.875rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
}

.chat-input-container input:focus {
  outline: none;
  border-color: #3C3979; 
}

/* Profile */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.profile-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.profile-card h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: #1e293b;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.info-item label {
  font-weight: 600;
  color: #334155;
}

.info-item span {
  color: #64748b;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #3C3979; 
  margin-bottom: 0.5rem;
}

.stat-card p {
  color: #64748b;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Assessments */
.assessments-container {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.assessments-container h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: #1e293b;
}

.assessments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.assessment-card {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.assessment-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.75rem;
}

.assessment-header h3 {
  color: #1e293b;
  font-size: 1.25rem;
}

.assessment-score {
  background: #3C3979; 
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1.1rem;
}

.assessment-date {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.assessment-details {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.assessment-user {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Admin specific */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.user-header h3 {
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.user-header p {
  color: #64748b;
  font-size: 0.875rem;
}

.user-badge {
  background: #3C3979; 
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.user-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: #64748b;
}

.chats-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.chat-section {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-section h3 {
  color: #3C3979; 
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.chat-item {
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.chat-question {
  margin-bottom: 0.75rem;
  color: #1e293b;
}

.chat-answer {
  color: #334155;
  margin-bottom: 0.5rem;
}

.chat-time {
  font-size: 0.75rem;
  color: #94a3b8;
}

.no-data {
  text-align: center;
  color: #64748b;
  padding: 3rem;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

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

  .auth-card {
    padding: 2rem;
  }

  .chat-container {
    height: 500px;
  }

  .chat-message {
    max-width: 90%;
  }
  
  .chat-message a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.chat-message a:hover {
    color: #1d4ed8;
}

}