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

:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #3f8efc;
  --accent: #f72585;
  --success: #4cc9f0;
  --error: #f72585;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  font-family: 'Poppins', sans-serif;
  color: var(--dark);
  line-height: 1.6;
}

.container {
  background-color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 700px;
  overflow: hidden;
  position: relative;
}

/* Logo and Header */
.quiz-header-brand {
  padding: 1.2rem 2rem;
  background-color: var(--primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1.4rem;
}

.logo i {
  font-size: 1.8rem;
  margin-right: 0.8rem;
}

.portfolio-info a {
  color: white;
  font-size: 1.6rem;
  opacity: 0.9;
  transition: var(--transition);
}

.portfolio-info a:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* SCREENS */
.screen {
  display: none;
  padding: 0;
  text-align: center;
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* START SCREEN */
.start-content {
  padding: 3rem 2rem;
}

#start-screen h1 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: 700;
}

#start-screen p {
  color: var(--gray);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* Category selector styles */
.category-selector,
.difficulty-selector {
  background-color: rgba(67, 97, 238, 0.05);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.category-selector h3,
.difficulty-selector h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.category-selector h3 i,
.difficulty-selector h3 i {
  margin-right: 0.5rem;
}

.categories,
.difficulty-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.category-checkbox,
.difficulty-radio {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 20px;
  border: 1px solid var(--gray-light);
  cursor: pointer;
  transition: var(--transition);
}

.category-checkbox:hover,
.difficulty-radio:hover {
  background: var(--gray-light);
}

.category-checkbox input,
.difficulty-radio input {
  margin-right: 0.5rem;
}

.features {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  border-radius: var(--radius);
  background-color: rgba(67, 97, 238, 0.05);
  width: 30%;
  transition: var(--transition);
}

.feature:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(67, 97, 238, 0.1);
}

.feature i {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 0.8rem;
}

.feature span {
  font-size: 0.95rem;
  font-weight: 500;
}

/* QUIZ SCREEN */
.quiz-header {
  padding: 2rem 2rem 1.5rem;
  position: relative;
}

/* Fix for category badge overlapping with question */
.category-badge {
  position: absolute;
  top: 0.75rem;
  right: 2rem;
  background: var(--primary);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 5;
  /* Ensure it's above other elements */
}

#question-text {
  color: var(--dark);
  font-size: 1.6rem;
  margin-top: 1.5rem;
  /* Add space at the top for the badge */
  margin-bottom: 1.5rem;
  line-height: 1.4;
  font-weight: 600;
  position: relative;
  padding-right: 100px;
  /* Make space for the category badge */
}

.quiz-info {
  display: flex;
  justify-content: space-between;
  color: var(--gray);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.question-count,
.score-display {
  display: flex;
  align-items: center;
}

.quiz-info i {
  margin-right: 0.5rem;
  color: var(--primary);
}

.answers-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 2rem 2rem;
}

.answer-btn {
  background-color: white;
  color: var(--dark);
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  font-size: 1.05rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.answer-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background-color: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.answer-btn:hover {
  background-color: rgba(67, 97, 238, 0.05);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.answer-btn:hover::before {
  opacity: 1;
}

.answer-btn.correct {
  background-color: rgba(76, 201, 240, 0.1);
  border-color: var(--success);
  color: #037c9c;
}

.answer-btn.incorrect {
  background-color: rgba(247, 37, 133, 0.1);
  border-color: var(--error);
  color: #c30052;
}

.progress-container {
  padding: 0 2rem 2rem;
}

.progress-bar {
  height: 8px;
  background-color: var(--gray-light);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  width: 0%;
  transition: width 0.5s ease;
}

.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 0.9rem;
}

.timer i {
  margin-right: 0.5rem;
  color: var(--primary);
}

/* RESULT SCREEN */
.result-content {
  padding: 3rem 2rem;
}

.result-icon {
  font-size: 3.5rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

#result-screen h1 {
  color: var(--primary);
  margin-bottom: 2rem;
  font-weight: 700;
}

.result-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: rgba(67, 97, 238, 0.05);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

.score-number {
  font-size: 2.5rem;
  font-weight: bold;
}

#result-message {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
}

/* Analytics section */
.analytics-section {
  margin-bottom: 2rem;
  text-align: left;
}

.analytics-section h3 {
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.analytics-section h3 i {
  margin-right: 0.5rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.analytics-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.analytics-title {
  background: var(--primary);
  color: white;
  padding: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.analytics-content {
  padding: 1rem;
  font-size: 0.9rem;
  min-height: 100px;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.portfolio-callout {
  border-top: 1px solid var(--gray-light);
  padding-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--gray);
}

.portfolio-callout a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.portfolio-callout a:hover {
  text-decoration: underline;
}

button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

button i {
  margin-right: 0.5rem;
}

button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(67, 97, 238, 0.2);
}

#share-btn {
  background-color: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

#share-btn:hover {
  background-color: rgba(67, 97, 238, 0.1);
}

/* Analytics Bar Charts */
.analytics-item {
  margin-bottom: 0.8rem;
}

.analytics-label {
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.analytics-bar-container {
  height: 20px;
  background: var(--gray-light);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.analytics-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius: 10px;
  transition: width 1s ease-in-out;
}

.analytics-value {
  position: absolute;
  top: 0;
  right: 8px;
  font-size: 0.75rem;
  line-height: 20px;
  color: var(--dark);
  font-weight: 500;
}

/* Time Stats */
.time-stats {
  display: flex;
  justify-content: space-between;
  text-align: center;
  padding: 0.5rem;
}

.time-stat {
  padding: 0.8rem;
  background: var(--gray-light);
  border-radius: var(--radius);
  width: 30%;
}

.time-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
}

.time-label {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 0.3rem;
}

/* Animation for analytics bars */
@keyframes growBar {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

.analytics-bar {
  animation: growBar 1.5s ease-out;
}

/* Responsive fixes for analytics */
@media (max-width: 700px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .time-stats {
    flex-direction: column;
    gap: 0.5rem;
  }

  .time-stat {
    width: 100%;
  }
}

/* Time Performance Analytics Styling - Updated to match screenshot */
.analytics-card {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  background-color: white;
  margin-bottom: 1.5rem;
}

.analytics-title {
  background-color: #4361ee;
  color: white;
  padding: 0.8rem;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

.time-stats {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  background-color: #f5f7fb;
  padding: 1rem;
}

.time-stat {
  flex: 1;
  text-align: center;
  background-color: #f0f2f9;
  border-radius: 8px;
  padding: 0.8rem;
}

.time-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: #4361ee;
  margin-bottom: 0.2rem;
}

.time-label {
  font-size: 0.85rem;
  color: #6c757d;
}

/* Responsive styles for Time Performance */
@media (max-width: 767px) {
  .time-stats {
    padding: 0.5rem;
    gap: 4px;
  }

  .time-stat {
    padding: 0.6rem 0.4rem;
  }

  .time-value {
    font-size: 1.2rem;
  }
}

/* RESPONSIVE DESIGN */
@media (max-width: 700px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .features {
    flex-direction: column;
    gap: 1rem;
  }

  .feature {
    width: 100%;
  }

  .action-buttons {
    flex-direction: column;
  }

  #question-text {
    font-size: 1.4rem;
  }

  .score-circle {
    width: 120px;
    height: 120px;
  }

  .score-number {
    font-size: 2rem;
  }
}

@media (max-width: 500px) {
  .quiz-header-brand {
    padding: 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  .logo i {
    font-size: 1.5rem;
  }

  .start-content,
  .quiz-header,
  .result-content {
    padding: 1.5rem 1rem;
  }

  .answers-container,
  .progress-container {
    padding: 0 1rem 1.5rem;
  }

  #question-text {
    font-size: 1.2rem;
  }

  button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }

  .categories,
  .difficulty-options {
    flex-direction: column;
    gap: 0.5rem;
  }
}