/* Updated styles for cleaner UI and better typography */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #4361ee;
  --secondary-color: #3a0ca3;
  --accent-color: #f72585;
  --background-color: #f8f9fa;
  --text-color: #2b2d42;
  --card-background: #ffffff;
  --rs232-color: #4361ee;
  --watchdog-color: #f72585;
  --scheduling-color: #4cc9f0;
  --realtime-color: #4895ef;
  --adc-color: #560bad;
  --port-color: #7209b7;
  --light-gray: #e9ecef;
  --medium-gray: #dee2e6;
  --dark-gray: #6c757d;
  --success-color: #06d6a0;
  --warning-color: #ffd166;
  --error-color: #ef476f;
  --border-radius: 10px;
  --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  font-size: 16px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

p {
  margin-bottom: 1.2rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles - Improved */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px 0;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo h1 {
  font-size: 1.6rem;
  margin: 0;
  color: white;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Navigation Styles - Improved */
nav ul {
  display: flex;
  list-style: none;
  gap: 15px;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 20px;
}

nav ul li a:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

nav ul li a.active {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Progress Tracker - Improved */
.progress-tracker {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  height: 8px;
  width: 200px;
  margin-left: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--success-color);
  width: 0%;
  transition: width 0.5s ease;
}

/* Main Content - Improved */
main {
  margin-top: 80px;
  padding: 40px 0;
}

section {
  padding: 60px 0;
  border-bottom: 1px solid var(--medium-gray);
}

section:last-child {
  border-bottom: none;
}

.section-header {
  text-align: center;
  margin-bottom: 50px;
}

.section-header h2 {
  font-size: 2.2rem;
  margin-bottom: 15px;
  position: relative;
  display: inline-block;
  color: var(--secondary-color);
}

.section-header h2::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 4px;
  background-color: var(--accent-color);
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

.section-header p {
  font-size: 1.1rem;
  color: var(--dark-gray);
  max-width: 700px;
  margin: 0 auto;
}

/* Topic Cards - Improved */
.topic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.topic-card {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  border: 1px solid var(--medium-gray);
}

.topic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.topic-card-header {
  padding: 20px;
  color: white;
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
}

.rs232 .topic-card-header {
  background-color: var(--rs232-color);
}

.watchdog .topic-card-header {
  background-color: var(--watchdog-color);
}

.scheduling .topic-card-header {
  background-color: var(--scheduling-color);
}

.realtime .topic-card-header {
  background-color: var(--realtime-color);
}

.adc .topic-card-header {
  background-color: var(--adc-color);
}

.port .topic-card-header {
  background-color: var(--port-color);
}

.topic-card-body {
  padding: 25px;
}

.topic-card-footer {
  padding: 15px 25px;
  background-color: var(--light-gray);
  text-align: center;
  border-top: 1px solid var(--medium-gray);
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
  background-color: var(--dark-gray);
}

.btn-secondary:hover {
  background-color: #5a6268;
}

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

.btn-accent:hover {
  background-color: #e01e79;
}

/* Content Layout - Improved */
.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
  align-items: start;
}

.text-content {
  line-height: 1.7;
}

.text-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
  font-size: 1.4rem;
}

.text-content p {
  margin-bottom: 1rem;
}

.text-content ul, .text-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.text-content li {
  margin-bottom: 0.5rem;
}

.text-content code {
  background-color: var(--light-gray);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9rem;
}

.text-content pre {
  background-color: var(--light-gray);
  padding: 15px;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.text-content pre code {
  background-color: transparent;
  padding: 0;
}

/* Flashcards - Improved */
.flashcard-container {
  perspective: 1000px;
  width: 100%;
  max-width: 500px;
  height: 300px;
  margin: 0 auto;
  position: relative;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  text-align: center;
}

.flashcard-front {
  background-color: var(--primary-color);
  color: white;
  font-size: 1.3rem;
  font-weight: 500;
}

.flashcard-back {
  background-color: white;
  color: var(--text-color);
  transform: rotateY(180deg);
  font-size: 1.1rem;
  line-height: 1.6;
}

.flashcard-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  gap: 15px;
}

#card-counter {
  font-weight: 500;
  color: var(--dark-gray);
  min-width: 120px;
  text-align: center;
}

/* Quiz Styles - Improved */
.quiz-container {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 30px;
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid var(--medium-gray);
}

.quiz-question {
  margin-bottom: 25px;
}

.quiz-question h4 {
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-bottom: 15px;
}

.quiz-options {
  list-style: none;
}

.quiz-option {
  padding: 15px;
  margin-bottom: 12px;
  background-color: var(--light-gray);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.quiz-option:hover {
  background-color: #e2e6ea;
}

.quiz-option.selected {
  background-color: rgba(67, 97, 238, 0.1);
  border-color: var(--primary-color);
}

.quiz-option.correct {
  background-color: rgba(6, 214, 160, 0.1);
  border-color: var(--success-color);
  color: #06825f;
}

.quiz-option.incorrect {
  background-color: rgba(239, 71, 111, 0.1);
  border-color: var(--error-color);
  color: #c6365d;
}

.quiz-explanation {
  margin-top: 20px;
  padding: 15px;
  background-color: rgba(67, 97, 238, 0.05);
  border-left: 4px solid var(--primary-color);
  border-radius: 0 8px 8px 0;
  display: none;
}

.quiz-controls {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-progress {
  color: var(--dark-gray);
  font-weight: 500;
}

/* Visualizations - Improved */
.visualization {
  margin: 40px 0;
}

.visualization-container {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 25px;
  margin-top: 20px;
  border: 1px solid var(--medium-gray);
}

.visualization-container h3 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--secondary-color);
  font-size: 1.3rem;
}

/* Quick Check Section - Improved */
.quick-check {
  margin-top: 50px;
  padding: 30px;
  background-color: rgba(67, 97, 238, 0.05);
  border-radius: var(--border-radius);
  border: 1px solid rgba(67, 97, 238, 0.1);
}

.quick-check h3 {
  margin-bottom: 25px;
  text-align: center;
  color: var(--secondary-color);
  font-size: 1.4rem;
}

/* Study Timer - Improved */
.study-timer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.2);
  z-index: 100;
  font-weight: 500;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.study-timer::before {
  content: '⏱️';
  font-size: 1.2rem;
}

/* Timeline for Study Plan - Improved */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 50px auto;
}

.timeline::after {
  content: '';
  position: absolute;
  width: 4px;
  background-color: var(--primary-color);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  border-radius: 2px;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  width: 50%;
  box-sizing: border-box;
}

.timeline-item:nth-child(odd) {
  left: 0;
}

.timeline-item:nth-child(even) {
  left: 50%;
}

.timeline-content {
  padding: 20px;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: 1px solid var(--medium-gray);
}

.timeline-content h4 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  background-color: white;
  border: 3px solid var(--primary-color);
  top: 15px;
  border-radius: 50%;
  z-index: 1;
}

.timeline-item:nth-child(even)::after {
  left: -8px;
}

/* CTA Buttons - Improved */
.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
}

/* Footer - Improved */
footer {
  background-color: var(--secondary-color);
  color: white;
  padding: 30px 0;
  text-align: center;
  margin-top: 60px;
}

footer p {
  margin-bottom: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Responsive Design - Improved */
@media (max-width: 992px) {
  .content-wrapper {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .section-header h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
  }
  
  nav ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  
  nav ul li a {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
  
  .progress-tracker {
    margin: 15px 0 0 0;
    width: 100%;
  }
  
  .section-header h2 {
    font-size: 1.8rem;
  }
  
  .timeline::after {
    left: 31px;
  }
  
  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }
  
  .timeline-item:nth-child(even) {
    left: 0;
  }
  
  .timeline-item::after {
    left: 21px;
    right: auto;
  }
  
  .flashcard-container {
    height: 250px;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 576px) {
  .section-header h2 {
    font-size: 1.6rem;
  }
  
  .topic-card-header {
    font-size: 1.1rem;
  }
  
  .quiz-question h4 {
    font-size: 1.1rem;
  }
  
  .flashcard-front {
    font-size: 1.1rem;
    padding: 20px;
  }
  
  .flashcard-back {
    font-size: 1rem;
    padding: 20px;
  }
}

/* Additional Improvements */
.label {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 8px;
  margin-bottom: 8px;
}

.label-primary {
  background-color: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
}

.label-secondary {
  background-color: rgba(58, 12, 163, 0.1);
  color: var(--secondary-color);
}

.label-accent {
  background-color: rgba(247, 37, 133, 0.1);
  color: var(--accent-color);
}

.card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid var(--medium-gray);
}

.card-header {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--medium-gray);
}

.card-header h3 {
  margin-bottom: 0;
}

.card-body {
  line-height: 1.7;
}

.card-footer {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--medium-gray);
  text-align: right;
}

.highlight {
  background-color: rgba(247, 37, 133, 0.1);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--accent-color);
  font-weight: 500;
}

.note {
  background-color: rgba(67, 97, 238, 0.05);
  border-left: 4px solid var(--primary-color);
  padding: 15px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
}

.note-title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
  display: block;
}

.divider {
  height: 1px;
  background-color: var(--medium-gray);
  margin: 30px 0;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

/* Improved Form Elements */
input, select, textarea {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--medium-gray);
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

input[type="range"] {
  height: 8px;
  -webkit-appearance: none;
  background-color: var(--medium-gray);
  border-radius: 4px;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background-color: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

/* Improved Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--medium-gray);
}

th {
  background-color: var(--light-gray);
  font-weight: 600;
  color: var(--secondary-color);
}

tr:hover {
  background-color: rgba(67, 97, 238, 0.03);
}

/* Improved Code Blocks */
code {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9em;
}

pre {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--medium-gray);
}

pre code {
  color: #333;
  background: transparent;
  padding: 0;
}

/* Improved Tooltips */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.9rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Improved Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  margin-left: 5px;
}

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

.badge-secondary {
  background-color: var(--dark-gray);
  color: white;
}

.badge-success {
  background-color: var(--success-color);
  color: white;
}

.badge-warning {
  background-color: var(--warning-color);
  color: #333;
}

.badge-error {
  background-color: var(--error-color);
  color: white;
}

/* Improved Alerts */
.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid transparent;
}

.alert-info {
  background-color: rgba(67, 97, 238, 0.1);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.alert-success {
  background-color: rgba(6, 214, 160, 0.1);
  border-left-color: var(--success-color);
  color: #06825f;
}

.alert-warning {
  background-color: rgba(255, 209, 102, 0.1);
  border-left-color: var(--warning-color);
  color: #b3860f;
}

.alert-error {
  background-color: rgba(239, 71, 111, 0.1);
  border-left-color: var(--error-color);
  color: #c6365d;
}

/* Improved Icons */
.icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 5px;
}

/* Improved Breadcrumbs */
.breadcrumbs {
  display: flex;
  list-style: none;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
  content: '›';
  margin: 0 8px;
  color: var(--dark-gray);
}

.breadcrumbs a {
  color: var(--dark-gray);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.breadcrumbs li:last-child {
  color: var(--text-color);
  font-weight: 500;
}
