:root {
  --primary-color: #243b53;
  --primary-dark: #1a2d3f;
  --accent-color: #c53030;
  --success-color: #28a745;
  --danger-color: #c53030;
  --warning-color: #ffc107;
  --text-dark: #212529;
  --text-light: #6c757d;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border-color: #dee2e6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-light);
  line-height: 1.6;
}

/* Header */
.navbar {
  background-color: var(--primary-color) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9);
  transition: color 0.3s;
}

.navbar-dark .navbar-nav .nav-link:hover {
  color: #ffffff;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.95;
}

.hero .btn {
  padding: 12px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s;
}

.hero .btn-light {
  background-color: white;
  color: var(--primary-color);
}

.hero .btn-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Cards */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card-header {
  background-color: var(--primary-color);
  color: white;
  border-radius: 12px 12px 0 0 !important;
  padding: 1.25rem;
  font-weight: 600;
}

/* Card header accordion buttons */
.card-header .accordion-button {
  background-color: transparent;
  color: white;
  font-weight: 600;
  padding: 0;
  box-shadow: none !important;
  border: none;
}

.card-header .accordion-button:not(.collapsed) {
  background-color: transparent;
  color: white;
}

.card-header .accordion-button::after {
  filter: brightness(0) invert(1);
}

.card-header .accordion-button:hover {
  background-color: transparent;
}

.card-header .accordion-button:focus {
  box-shadow: none;
  border: none;
}

/* FAQ card specific styles */
.card.mb-4 {
  margin-bottom: 1.5rem;
}

.card.mb-4:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Quiz Styles */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
}

.question-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.question-number {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-dark);
}

.answer-box {
  background-color: var(--bg-light);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.answer-box:hover {
  border-color: var(--primary-color);
  background-color: #e7f3ff;
}

.answer-box.correct {
  border-color: var(--success-color);
  background-color: #d4edda;
}

.answer-box.incorrect {
  border-color: var(--danger-color);
  background-color: #f8d7da;
}

.answer-box.show-correct {
  border-color: var(--success-color);
  background-color: #d4edda;
}

/* Voice Input Styles (Premium Feature) */
#micBtn {
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  transition: all 0.3s;
}

#micBtn:hover:not(:disabled) {
  transform: scale(1.05);
}

#micBtn.btn-danger {
  animation: pulse 1.5s infinite;
}

#micBtn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#voiceStatus {
  animation: fadeIn 0.3s;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Progress Bar */
.progress-container {
  margin-bottom: 2rem;
}

.progress {
  height: 8px;
  border-radius: 10px;
  background-color: #e9ecef;
}

.progress-bar {
  background-color: var(--primary-color);
  transition: width 0.3s;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  border-radius: 8px;
  padding: 10px 30px;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  border-radius: 8px;
  padding: 10px 30px;
  font-weight: 600;
}

.btn-lg {
  padding: 12px 40px;
  font-size: 1.1rem;
}

/* Score Display */
.score-display {
  text-align: center;
  padding: 3rem 2rem;
}

.score-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  font-size: 3rem;
  font-weight: 700;
  color: white;
}

.score-pass {
  background: linear-gradient(135deg, #28a745, #20c997);
}

.score-fail {
  background: linear-gradient(135deg, #dc3545, #fd7e14);
}

/* Study Page */
.question-list {
  list-style: none;
  padding: 0;
}

.question-item {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1; /* Ensure it's below the sticky filter */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.question-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.question-item strong {
  color: var(--primary-color);
  display: block;
  margin-bottom: 0.5rem;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 8px;
  margin-bottom: 8px;
}

.badge-government {
  background-color: #e7f3ff;
  color: var(--primary-color);
}

.badge-history {
  background-color: #fff3cd;
  color: #856404;
}

/* Footer */
footer {
  background-color: var(--primary-dark);
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

footer h5 {
  font-weight: 700;
  margin-bottom: 1rem;
}

footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s;
}

footer a:hover {
  color: white;
}

.disclaimer {
  background-color: #ffc107;
  color: #212529;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-weight: 600;
}

/* Language Selector */
.language-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 2rem;
}

.lang-btn {
  padding: 8px 20px;
  border: 2px solid var(--primary-color);
  background: white;
  color: var(--primary-color);
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
}

.lang-btn.active,
.lang-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .question-text {
    font-size: 1.25rem;
  }

  .score-circle {
    width: 150px;
    height: 150px;
    font-size: 2.5rem;
  }
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--bg-light);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Sticky Filter Card for Study Page */
.filter-sticky {
  position: sticky;
  top: 70px; /* Offset for navbar height */
  z-index: 1000; /* High z-index to stay above scrolling content */
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 1.5rem;
}

/* Questions list container */
.questions-container {
  position: relative;
  z-index: 1; /* Lower z-index so it scrolls under the filter */
}

/* Study Page Layout */
.study-container {
  display: block;
  height: auto;
}

/* Study Page Layout - Full viewport height */
.study-page-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.study-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 0;
}

/* Fixed title section */
.study-title {
  flex-shrink: 0;
  margin-bottom: 1rem;
}

/* Fixed Filter Card */
.filter-sticky {
  flex-shrink: 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  z-index: 100;
}

/* Scrollable Questions Container */
.questions-scroll-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.5rem;
}

/* Custom scrollbar */
.questions-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.questions-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.questions-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.questions-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Question items */
.question-item {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.question-item:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Question and Answer Text Styling */
.question-item p {
  line-height: 1.8;
}

.question-item .question-label {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-right: 0.5rem;
}

.question-item .question-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
}

.question-item .answer-label {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--success-color);
  margin-right: 0.5rem;
}

.question-item .answer-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: #059669;
  line-height: 1.8;
}

/* Login Error Message */
#login-error {
  border-left: 4px solid #dc3545;
  background-color: #f8d7da;
  color: #721c24;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

#login-error i {
  font-size: 1.2rem;
  vertical-align: middle;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .scroll-buttons {
    position: fixed;
    right: 10px;
    top: auto;
    bottom: 20px;
    transform: none;
    flex-direction: row;
    gap: 0.5rem;
    margin-left: 0;
  }
  
  .scroll-btn {
    width: 44px;
    height: 44px;
  }
}
