/* Main page styles - simple color scheme */
:root {
  /* Tab colors */
  --color-tab-year: #2c5282;
  --color-tab-year-shadow: rgba(44, 82, 130, 0.3);
  
  --color-tab-topic: #38a169;
  --color-tab-topic-shadow: rgba(56, 161, 105, 0.3);
  --color-tab-topic-hover: #2f855a;
  --color-tab-topic-light: #9ae6b4;
  
  --color-tab-formula: #805ad5;
  --color-tab-formula-shadow: rgba(128, 90, 213, 0.3);
  --color-tab-formula-hover: #6b46c1;
  --color-tab-formula-light: #b794f4;
  
  --color-tab-grade: #0e7490;
  --color-tab-grade-shadow: rgba(14, 116, 144, 0.3);
  --color-tab-grade-hover: #155e75;
  --color-tab-grade-light: #67e8f9;
  
  /* Common colors */
  --color-gray-50: #f8f9fa;
  --color-gray-100: #f7fafc;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e0;
  --color-gray-500: #718096;
  --color-gray-600: #4a5568;
  --color-gray-700: #2d3748;
  --color-white: #ffffff;
}

/* Tab navigation */
.tab-navigation {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 0;
  background: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 100;
  /* border-bottom: 2px solid var(--color-gray-200); */
  margin-bottom: 1.5rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: var(--color-white);
  border: 2px solid var(--color-gray-200);
  border-radius: 8px;
  color: var(--color-gray-600);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover {
  background: var(--color-gray-100);
  border-color: var(--color-gray-300);
  color: var(--color-gray-700);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Tab colors for different sections */
.tab-btn[data-tab="by-year"].active {
  background: var(--color-tab-year);
  border-color: var(--color-tab-year);
  color: var(--color-white);
  box-shadow: 0 4px 6px var(--color-tab-year-shadow);
}

.tab-btn[data-tab="by-topic"].active {
  background: var(--color-tab-topic);
  border-color: var(--color-tab-topic);
  color: var(--color-white);
  box-shadow: 0 4px 6px var(--color-tab-topic-shadow);
}

.tab-btn[data-tab="by-formula"].active {
  background: var(--color-tab-formula);
  border-color: var(--color-tab-formula);
  color: var(--color-white);
  box-shadow: 0 4px 6px var(--color-tab-formula-shadow);
}

.tab-btn[data-tab="by-grade"].active {
  background: var(--color-tab-grade);
  border-color: var(--color-tab-grade);
  color: var(--color-white);
  box-shadow: 0 4px 6px var(--color-tab-grade-shadow);
}

.tab-btn i {
  font-size: 1.2rem;
}

/* Subtab navigation */
.subtab-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 2px solid var(--color-gray-200);
  overflow-x: auto;
  scrollbar-width: thin;
  background: var(--color-white);
  position: sticky;
  top: 80px;
  z-index: 90;
}

.subtab-navigation::-webkit-scrollbar {
  height: 4px;
}

.subtab-navigation::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 2px;
}

.subtab-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-gray-500);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-bottom: -2px;
}

.subtab-btn:hover {
  color: var(--color-gray-700);
  border-bottom-color: var(--color-gray-300);
}

/* Subtab colors for topics (green) */
#topic-subtabs .subtab-btn.active {
  color: var(--color-tab-topic);
  border-bottom-color: var(--color-tab-topic);
  font-weight: 600;
}

#topic-subtabs .subtab-btn:hover {
  color: var(--color-tab-topic-hover);
  border-bottom-color: var(--color-tab-topic-light);
}

/* Subtab colors for formulas (purple) */
#formula-subtabs .subtab-btn.active {
  color: var(--color-tab-formula);
  border-bottom-color: var(--color-tab-formula);
  font-weight: 600;
}

#formula-subtabs .subtab-btn:hover {
  color: var(--color-tab-formula-hover);
  border-bottom-color: var(--color-tab-formula-light);
}

/* Subtab colors for grades (orange) */
#grade-subtabs .subtab-btn.active {
  color: var(--color-tab-grade);
  border-bottom-color: var(--color-tab-grade);
  font-weight: 600;
}

#grade-subtabs .subtab-btn:hover {
  color: var(--color-tab-grade-hover);
  border-bottom-color: var(--color-tab-grade-light);
}

/* Subtab content */
.subtab-content {
  display: none;
}

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

/* Common section styles */
.content-section {
  margin-bottom: 2.5rem;
}

/* Common heading style for all sections */
.section-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: #f7fafc;
  border-radius: 8px;
  border-left: 4px solid;
}

/* Year section - blue accent */
.section-heading--year {
  color: #2c5282;
  border-left-color: #2c5282;
}

.section-heading--year i {
  color: #2c5282;
}

/* Topic section - green accent */
.section-heading--topic {
  color: #38a169;
  border-left-color: #38a169;
}

.section-heading--topic i {
  color: #38a169;
}

/* Formula section - purple accent */
.section-heading--formula {
  color: #805ad5;
  border-left-color: #805ad5;
}

.section-heading--formula i {
  color: #805ad5;
}

/* Test cards */
.test-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.test-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  transform: translateX(4px);
}

.test-card a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #2d3748;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.test-card a:hover {
  color: #2c5282;
}

.test-card i {
  color: #718096;
  font-size: 1.1rem;
}

.duplicate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  background: transparent;
  color: #a0aec0;
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 0.5rem;
  transition: color 0.2s ease;
}

.duplicate-badge:hover {
  color: #718096;
}

.duplicate-badge i {
  font-size: 0.75rem;
}



.topic-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: none;
}

.topic-card:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.topic-card a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #2d3748;
  text-decoration: none;
  font-weight: 500;
  flex-grow: 1;
  transition: color 0.2s ease;
}

.topic-card a:hover {
  color: #2c5282;
}

.topic-card i {
  color: #cbd5e0;
  font-size: 1rem;
}

.question-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.4rem;
  background: #edf2f7;
  color: #718096;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}



.formula-subtopic-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: #718096;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.formula-subtopic-heading i {
  color: #cbd5e0;
  font-size: 0.9rem;
}

/* Semester headings for grade tabs */
.semester-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-tab-grade);
  margin-bottom: 1rem;
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-tab-grade-light);
}

.semester-heading i {
  color: var(--color-tab-grade);
  font-size: 1rem;
}

.formula-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
  height: 100%;
  transition: all 0.2s ease;
  box-shadow: none;
}

.formula-card:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.formula-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.formula-card-link:hover {
  text-decoration: none;
}

.formula-card a {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.formula-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.formula-expression {
  font-size: 1.15rem;
  color: #2d3748;
  font-weight: 500;
  padding: 0.75rem 0;
  background: transparent;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.formula-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.formula-description {
  font-size: 0.85rem;
  color: #718096;
  line-height: 1.4;
  flex: 1;
}

.formula-question-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  background: #edf2f7;
  color: #718096;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.formula-question-badge i {
  font-size: 0.75rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #718096;
}

.empty-state i {
  font-size: 3rem;
  color: #cbd5e0;
  margin-bottom: 1rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .tab-navigation {
    gap: 0.35rem;
  }

  .tab-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  .tab-btn i {
    font-size: 1rem;
  }

  .subtab-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .section-heading {
    font-size: 1.2rem;
  }

  .formula-subtopic-heading {
    font-size: 1rem;
  }

  .test-card,
  .topic-card {
    padding: 0.75rem 1rem;
  }

  .formula-card {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .tab-navigation {
    padding: 0.75rem 0;
  }

  .subtab-navigation {
    top: 69px;
  }
}

/* Landscape орієнтація мобільних (перевернутий телефон) */
@media (max-height: 500px) and (min-width: 769px) {
  .tab-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    flex-direction: column;
    gap: 0.2rem;
    text-align: center;
    line-height: 1.1;
  }

  .tab-btn span {
    white-space: normal;
    word-break: break-word;
  }

  .tab-btn i {
    font-size: 0.9rem;
  }

  .tab-navigation {
    padding: 0.4rem 0;
    margin-bottom: 1rem;
  }

  .subtab-navigation {
    padding: 0.4rem 0;
    top: 60px;
  }
}

@media (max-width: 576px) {
  .tab-navigation {
    padding: 0.5rem 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .tab-navigation::-webkit-scrollbar {
    height: 3px;
  }

  .tab-navigation::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 2px;
  }

  .tab-btn {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .tab-btn span {
    white-space: nowrap;
  }

  .subtab-navigation {
    top: 70px;
    padding: 0.5rem 0;
  }

  .section-heading {
    font-size: 1.1rem;
  }

  .formula-subtopic-heading {
    font-size: 1rem;
  }

  .test-card a,
  .topic-card a {
    font-size: 0.9rem;
  }

  .formula-expression {
    font-size: 1.05rem;
  }

  .formula-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .formula-description {
    font-size: 0.8rem;
  }
}
