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

:root {
  /* Fresh, Clean, Light Palette */
  --sidebar-bg: #ffffff;
  --sidebar-text: #334155;
  --sidebar-hover: #f1f5f9;
  
  --main-bg: #f3f4f6;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  
  /* Primary Color: Soft Teal/Blue */
  --primary-btn-bg: #0ea5e9;
  --primary-btn-text: #ffffff;
  
  --secondary-btn-bg: #94a3b8;
  --secondary-btn-text: #ffffff;
  
  --danger-btn-bg: #ef4444;
  --danger-btn-text: #ffffff;
  
  --option-btn-bg: #f8fafc;
  --option-btn-text: #334155;
  --option-btn-border: #e2e8f0;
  --option-btn-hover: #f1f5f9;
  --option-btn-selected: #e0f2fe;
  
  --option-btn-correct: #dcfce7; /* Light green */
  --option-btn-wrong: #fee2e2;   /* Light red */
  
  --question-text-color: #1e293b;
  --feedback-bg: #f0f9ff;
  
  --header-bg: #ffffff;
  --header-text: #1e293b;
  
  --border-radius: 12px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--main-bg);
  margin: 0;
  padding: 0;
  color: var(--question-text-color);
  min-height: 100vh;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  gap: 0;
  box-shadow: var(--shadow-lg);
  background-color: var(--main-bg);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 30px 15px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.sidebar nav button {
  background: transparent;
  border: none;
  color: #64748b;
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
}

.sidebar nav button:hover:not(.active) {
  background: var(--sidebar-hover);
  color: var(--primary-btn-bg);
  transform: translateX(4px);
}

.sidebar nav button.active {
  background: #e0f2fe; /* Light blue tint */
  color: var(--primary-btn-bg);
  font-weight: 600;
}

.main-content {
  background: var(--main-bg);
  padding: 30px 40px;
  overflow-y: auto;
}

header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 20px 30px;
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-btn-bg);
  letter-spacing: -0.02em;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Question Card */
.question-card {
  background: var(--card-bg);
  padding: 40px;
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600; /* Reverted to Bold per request */
  margin-bottom: 30px;
  line-height: 1.6;
  color: #0f172a;
}

.options-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.options-list li {
  margin-bottom: 0;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border: 1px solid var(--option-btn-border);
  border-radius: var(--border-radius);
  background: var(--option-btn-bg);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  color: var(--option-btn-text);
  position: relative;
  overflow: hidden;
}

.option-btn:hover {
  background: var(--option-btn-hover);
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.option-btn.selected {
  background: var(--option-btn-selected);
  border-color: var(--primary-btn-bg);
  font-weight: 500;
  color: #0369a1;
}

.option-btn.correct {
  background-color: var(--option-btn-correct) !important;
  border-color: #22c55e !important;
  color: #14532d;
}

.option-btn.wrong {
  background-color: var(--option-btn-wrong) !important;
  border-color: #ef4444 !important;
  color: #7f1d1d;
}

.feedback {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: var(--border-radius);
  background: var(--feedback-bg);
  display: none;
  border-left: 5px solid var(--primary-btn-bg);
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  box-shadow: var(--shadow-sm);
}

.progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 24px;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  font-weight: 600;
  color: #64748b;
}

.navigation-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
}

button {
  padding: 12px 24px;
  border-radius: var(--border-radius);
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  letter-spacing: 0.02em;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sidebar nav button {
  /* Sidebar buttons handled above */
}

button:focus {
  outline: none;
}

.primary-btn {
  background: var(--primary-btn-bg);
  color: var(--primary-btn-text);
  /* Removed box-shadow to avoid "black outline" look if that was it, or just keep it soft */
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2); 
  border: none; /* Ensure no border */
}
.primary-btn:hover {
  background: #0284c7;
  box-shadow: 0 4px 12px -1px rgba(14, 165, 233, 0.3);
}

.secondary-btn {
  background: var(--secondary-btn-bg);
  color: var(--secondary-btn-text);
}
.secondary-btn:hover {
  background: #64748b;
}

.danger-btn {
  background: var(--danger-btn-bg);
  color: var(--danger-btn-text);
}

/* Graph */
#mynetwork {
  width: 100%;
  height: 650px;
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  background: #f8fafc; /* Slightly darker than card for contrast */
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

/* Flashcards */
.card-container {
  perspective: 1200px;
  width: 100%;
  height: 450px; 
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}

.flashcard {
  width: 650px;
  max-width: 95%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  border-radius: 20px;
}

.flashcard:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  padding: 30px;
  box-sizing: border-box;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow-y: auto; 
}

/* Front Styling */
.card-front {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #334155;
  border: 1px solid var(--card-border);
  justify-content: flex-start; /* Align content to top */
  text-align: left !important; /* Left align per request */
  align-items: flex-start; /* Left align flex items */
  padding: 40px; /* More padding for cleaner look */
}

.card-concept-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0ea5e9;
  margin-bottom: 15px;
  text-align: left !important;
}

/* Back Styling */
.card-back {
  background: linear-gradient(135deg, var(--primary-btn-bg) 0%, #0284c7 100%);
  color: white;
  transform: rotateY(180deg);
  justify-content: flex-start;
  text-align: left !important;
}

.card-back h4 {
  margin-top: 0;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 10px;
  width: 100%;
  margin-bottom: 15px;
  font-weight: 600;
}

.card-back p, .card-back div {
  line-height: 1.6;
  font-size: 1rem;
}

/* Flat Reset Button */
.flat-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.flat-btn:hover {
    background: #f1f5f9;
    color: #64748b;
}

/* Exam Guide */
.guide-header {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}

.guide-section {
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.guide-section-header {
    background: #f8fafc;
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.guide-section-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #334155;
}

.guide-section-body {
    padding: 20px;
    display: none; /* Collapsible */
}

.guide-section-body.open {
    display: block;
}

.domain-weight {
    background: #e0f2fe;
    color: #0ea5e9;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #e2e8f0;
}

.task-list li:last-child {
    border-bottom: none;
}

.task-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
    display: block;
}

.task-desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Exam */
.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 16px 24px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

#exam-questions-list {
  max-height: 75vh;
  overflow-y: auto;
  padding-right: 15px;
}

.score-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--primary-btn-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3.5rem;
  font-weight: 800;
  margin: 40px auto;
  box-shadow: var(--shadow-lg);
  border: 8px solid #f1f5f9;
}

.header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

/* Knowledge 360 Grid (Hidden per request but css kept for future) */
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.k360-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  height: 100%;
  box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    height: auto;
    padding: 15px 20px;
    border-bottom: 1px solid var(--card-border);
    position: relative;
  }
  
  .sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-top: 10px;
  }
  
  .sidebar nav button {
    white-space: nowrap;
  }
  
  header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 15px;
  }
  
  .main-content {
    padding: 20px;
  }
  
  .card-container {
    height: 350px;
  }
}
