/* custom-theme.css — Оптимизированная версия */

/* ==================== ШРИФТЫ ==================== */

@font-face {
  font-family: "Geologica";
  src:
    url("/assets/fonts/Geologica-Black.woff2") format("woff2"),
    url("/assets/fonts/Geologica-Black.woff") format("woff");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src:
    url("/assets/fonts/Geologica-Bold.woff2") format("woff2"),
    url("/assets/fonts/Geologica-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src:
    url("/assets/fonts/Geologica-Regular.woff2") format("woff2"),
    url("/assets/fonts/Geologica-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src:
    url("/assets/fonts/Geologica-Light.woff2") format("woff2"),
    url("/assets/fonts/Geologica-Light.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src:
    url("/assets/fonts/Geologica-Thin.woff2") format("woff2"),
    url("/assets/fonts/Geologica-Thin.woff") format("woff");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Цвета */
  --bs-primary: #1a2f60;
  --bs-secondary: #5a3e96;
  --bs-success: #28a745;
  --bs-info: #7ab8f5;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: #f8f9fa;
  --bs-dark: #212529;
  --bs-white: #ffffff;

  /* Производные */
  --bs-body-color: var(--bs-dark);
  --bs-body-bg: #f8f8f8;
  --bs-border-color: #dee2e6;
  --bs-gray-100: #f8f9fa;
  --bs-gray-300: #dee2e6;
  --bs-gray-600: #6c757d;

  /* Бренд */
  --doprof-blue-medium: #3e54a3;
  --doprof-blue-dark: #152347;
  --doprof-purple: #5a3e96;
  --doprof-text-light: #fefefe;

  /* Шрифты */
  --font-lato: "Geologica";
  --font-weight-thin: 100;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* Анимации */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.6s ease-out;

  /* Радиусы */
  --radius-sm: 0.4rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Тени */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* ==================== БАЗОВЫЕ СТИЛИ ==================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

*:focus {
  outline: none;
  box-shadow: none;
}

html {
  font-family: var(--font-lato);
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-family: var(--font-lato);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  line-height: 1.3;
}

a {
  color: var(--bs-primary);
  text-decoration: none;
  transition: color var(--transition-normal);
}

a:hover {
  color: var(--bs-secondary);
  text-decoration: underline;
}

.btn:hover {
  text-decoration: none;
}

p {
  font-weight: var(--font-weight-regular);
}

/* ==================== КНОПКИ ==================== */

.btn {
  transition: all var(--transition-normal);
}

.btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--doprof-blue-medium);
  --bs-btn-hover-border-color: var(--doprof-blue-medium);
  --bs-btn-active-bg: var(--doprof-blue-dark);
  --bs-btn-active-border-color: var(--doprof-blue-dark);
  --bs-btn-color: var(--bs-white);
}

.btn-outline-primary {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-hover-color: var(--bs-white);
  --bs-btn-active-bg: var(--doprof-blue-dark);
  --bs-btn-active-border-color: var(--doprof-blue-dark);
}

.btn-outline-primary:hover {
  border-color: var(--bs-primary);
}

.btn-outline-secondary {
  --bs-btn-color: var(--bs-secondary);
  --bs-btn-border-color: var(--bs-secondary);
  --bs-btn-hover-bg: var(--bs-secondary);
  --bs-btn-hover-color: var(--bs-white);
}

.btn-success {
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}

.btn-success.disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: var(--bs-gray-600);
  border-color: var(--bs-gray-600);
}

/* ==================== КАРТОЧКИ ==================== */

.card {
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}

.card-header {
  background-color: var(--bs-light);
  border-bottom-color: var(--bs-border-color);
}

.course-info-card {
  border: none;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition:
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.course-cover-image {
  height: 250px;
  object-fit: cover;
  border-bottom: 1px solid var(--bs-border-color);
}

.course-info-card .card-body {
  padding: 1.5rem;
  background-color: var(--bs-light);
}
.course-info-card .card-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}
.course-info-card .card-text {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ==================== АККОРДЕОН ==================== */

.accordion-item {
  border-color: var(--bs-gray-300);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion-flush .accordion-item {
  border-left: 0;
  border-right: 0;
}
.accordion-flush .accordion-item:first-of-type {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.accordion-flush .accordion-item:last-of-type {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.accordion-button {
  padding: 1.25rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--bs-primary);
  background-color: var(--bs-white);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.accordion-button:not(.collapsed) {
  background-color: var(--bs-primary);
  color: var(--bs-white);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem rgba(26, 47, 96, 0.25);
}

.accordion-body {
  padding: 1.5rem;
  background-color: var(--bs-light);
  border-top: 1px solid var(--bs-border-color);
}

/* Пройденная тема */
.topic-completed .accordion-item {
  border-color: #c3e6cb;
}

.topic-completed .accordion-button {
  background-color: #e6ffe6;
  color: #198754;
  font-weight: 400;
}

.topic-completed .accordion-button:not(.collapsed) {
  background-color: #d4edda;
  color: #155724;
}

.topic-completed .accordion-button .badge.bg-success {
  background-color: #198754 !important;
  color: var(--bs-white) !important;
  margin-right: 10px;
}

/* Контент темы */
.topic-content {
  background-color: var(--bs-white);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  line-height: 1.7;
  font-size: 0.95rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topic-materials-section button {
  display: none;
}

/* ==================== НАВИГАЦИЯ ==================== */

.navbar {
  background-color: var(--bs-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.8);
}
.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--bs-white);
}

/* ==================== ФОРМЫ ==================== */

.form-check-input:checked {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.form-check-input:focus {
  box-shadow: 0 0 0 0.25rem rgba(26, 47, 96, 0.25);
}

.form-check {
  border-bottom: 1px solid var(--bs-gray-100);
}
.form-check:last-child {
  border-bottom: none;
}

.form-check-input {
  cursor: pointer;
}
.form-check-label {
  cursor: pointer;
  padding-left: 0.5rem;
}

.form-check input[type="radio"]:checked + .form-check-label {
  font-weight: 600;
  color: var(--bs-primary);
}

/* ==================== ТАБЛИЦЫ ==================== */

.table-dark {
  --bs-table-bg: var(--bs-primary);
  --bs-table-color: var(--bs-white);
}

.action-td {
  min-width: 370px;
}

/* ==================== БЕДЖИ ==================== */

.badge.bg-info {
  background-color: var(--bs-info) !important;
  color: var(--bs-dark) !important;
}

/* ==================== ПРОГРЕСС-БАР ==================== */

.progress {
  background-color: var(--bs-gray-300);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.progress-bar {
  background-color: var(--bs-primary);
  font-weight: bold;
  color: var(--bs-white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */

.modal-header {
  background-color: var(--bs-light);
  border-bottom-color: var(--bs-border-color);
}

.modal-content {
  border-radius: var(--radius-lg);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Видео модальное окно */
#videoModal .modal-content {
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#videoModal .modal-header {
  background-color: var(--bs-primary);
  color: var(--bs-white);
  border-bottom: none;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
}

#videoModal .modal-title {
  color: var(--bs-white);
}
#videoModal .btn-close {
  filter: invert(1);
  opacity: 0.8;
}
#videoModal .btn-close:hover {
  opacity: 1;
}
#videoPlayer {
  background-color: #000;
}

/* ==================== СПИСКИ ==================== */

.list-group-flush.border {
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}

.list-group-item-action {
  border-color: var(--bs-border-color);
  padding: 0.75rem 1rem;
}

.list-group-item:first-child {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.list-group-item:last-child {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* ==================== КАСТОМНЫЕ СЕКЦИИ ==================== */

.custom-section-blue {
  background-color: var(--bs-primary);
  color: var(--doprof-text-light);
  padding: 3rem 0;
  border-radius: var(--radius-xl);
  margin-bottom: 2rem;
}

.custom-section-blue h2 {
  color: var(--bs-white);
}

.custom-icon-box {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--bs-white);
}

.custom-icon-box i {
  font-size: 2.5rem;
  color: var(--bs-info);
  margin-bottom: 1rem;
}

.container.my-5 {
  padding: 3rem 0;
}

/* ==================== ТЕСТ ==================== */

#questionsContainer {
  min-height: 250px;
  perspective: 1000px;
}

.question-slide {
  width: 100%;
  transition:
    transform var(--transition-slow),
    opacity var(--transition-slow);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transform: translateX(100px);
  pointer-events: none;
}

.question-slide.active-question {
  opacity: 1;
  transform: translateX(0);
  position: relative;
  pointer-events: auto;
  z-index: 1;
}

.question-slide.leaving-question {
  opacity: 0;
  transform: translateX(-100px);
  position: absolute;
  z-index: 0;
}

/* ==================== VIEWER ==================== */

#viewer-container {
  overflow: auto;
}

#viewer-container img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

#viewer-container canvas {
  margin: 0 auto;
}

/* ==================== КНОПКИ НАВИГАЦИИ ПО ТЕМАМ ==================== */

.topic-action-area .btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 991.98px) {
  .course-info-card {
    margin-bottom: 2rem;
  }
  .course-cover-image {
    height: 200px;
  }
}

@media (max-width: 767.98px) {
  .course-cover-image {
    height: 180px;
  }
  .course-info-card .card-title {
    font-size: 1.75rem;
  }

  .accordion-button {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
  .accordion-body {
    padding: 1rem;
  }
  .topic-content {
    padding: 1rem;
  }

  .topic-action-area {
    flex-direction: column;
    align-items: flex-start;
  }

  .topic-action-area .btn {
    width: 100%;
    margin-bottom: 0.75rem;
    margin-right: 0 !important;
  }

  .topic-action-area .btn:last-child {
    margin-bottom: 0;
  }
  .action-td {
    min-width: auto;
  }
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.course-overview-stats {
  background: #fff;
  /*border-radius: 12px;
    border: 1px solid #e9ecef;*/
  overflow: hidden;
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  background: var(--bs-primary);
  color: white;
}

.overview-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.overview-header-left > i {
  font-size: 1.5rem;
  opacity: 0.9;
}

.overview-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: white;
}

.overview-subtitle {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 1px;
}

.overview-body {
  padding: 1rem;
}

.overview-section {
  margin-bottom: 1rem;
}

.overview-section:last-child {
  margin-bottom: 0;
}

.overview-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.625rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e9ecef;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-heading-color);
}

.overview-section-title i {
  color: #667eea;
  font-size: 0.9rem;
}

.overview-section-badge {
  margin-left: auto;
  background: #f8f9fa;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
}

.overview-grid {
  display: grid;
  gap: 0.625rem;
}

.structure-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.materials-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.overview-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--card-color, #667eea);
}

.icon-topics {
  --card-color: #2563eb;
}
.icon-tests {
  --card-color: #059669;
}
.icon-exam {
  --card-color: #d97706;
}
.icon-hours {
  --card-color: #7c3aed;
}
.icon-video {
  --card-color: #2563eb;
}
.icon-pdf {
  --card-color: #dc2626;
}
.icon-docx {
  --card-color: #1e40af;
}
.icon-presentation {
  --card-color: #d97706;
}
.icon-spreadsheet {
  --card-color: #059669;
}
.icon-image {
  --card-color: #4f46e5;
}
.icon-audio {
  --card-color: #7c3aed;
}
.icon-archive {
  --card-color: #6b7280;
}
.icon-link {
  --card-color: #16a34a;
}
.icon-txt {
  --card-color: #475569;
}

.overview-card-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--card-color);
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.overview-subtitles-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.5rem;
  border: 2px solid white;
}

.overview-card-content {
  flex: 1;
  min-width: 0;
}

.overview-card-main {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-bottom: 0rem;
}

.overview-card-count {
  font-size: 1rem;
  font-weight: 700;
  color: #1a202c;
  line-height: 1;
}

.overview-card-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

.overview-card-footer {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 500;
  white-space: nowrap;
}

.overview-card-footer i {
  font-size: 0.8rem;
}

.overview-footer {
  padding: 0.625rem 1.25rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.overview-footer i {
  color: #9ca3af;
}

@media (max-width: 991px) {
  .structure-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }

  .materials-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .overview-card-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .overview-card-count {
    font-size: 1rem;
  }
}

@media (max-width: 767px) {
  .overview-header {
    padding: 0.75rem 1rem;
  }

  .overview-header-left > i {
    font-size: 1.25rem;
  }

  .overview-title {
    font-size: 0.9rem;
  }

  .overview-body {
    padding: 0.875rem;
  }

  .structure-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .materials-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
  }

  .overview-card {
    padding: 0.625rem 0.875rem;
    gap: 0.625rem;
  }

  .overview-card-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .overview-card-count {
    font-size: 1rem;
  }

  .overview-card-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 575px) {
  .structure-grid,
  .materials-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .overview-card {
    padding: 0.625rem 0.75rem;
    gap: 0.625rem;
  }

  .overview-card-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .overview-card-count {
    font-size: 1rem;
  }

  .overview-card-label {
    font-size: 0.8rem;
  }

  .overview-subtitles-badge {
    width: 14px;
    height: 14px;
    font-size: 0.45rem;
  }
}

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

.overview-card {
  animation: overviewFadeIn 0.3s ease-out backwards;
}

.overview-card:nth-child(1) {
  animation-delay: 0.05s;
}
.overview-card:nth-child(2) {
  animation-delay: 0.1s;
}
.overview-card:nth-child(3) {
  animation-delay: 0.15s;
}
.overview-card:nth-child(4) {
  animation-delay: 0.2s;
}
.overview-card:nth-child(5) {
  animation-delay: 0.25s;
}
.overview-card:nth-child(6) {
  animation-delay: 0.3s;
}

.course-description {
  position: relative;
}

.course-description.is-collapsible .description-content {
  max-height: 4.8em;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-description.is-expanded .description-content {
  max-height: 2000px;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.description-fade {
  position: absolute;
  bottom: 44px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(
    to bottom,
    rgb(248 248 248 / 0%) 0%,
    rgb(248 248 248) 50%,
    rgb(248 248 248) 100%
  );
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.course-description.is-expanded .description-fade {
  opacity: 0;
}

.description-toggle {
  display: block;
  width: 100%;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #1a2f60;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
  position: relative;
  z-index: 2;
}

.description-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.description-toggle .toggle-icon {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.course-description.is-expanded .toggle-icon {
  transform: rotate(180deg);
}

@media (max-width: 575px) {
  .course-description.is-collapsible .description-content {
    max-height: 4.2em;
  }

  .description-fade {
    bottom: 33px;
    height: 20px;
  }

  .description-toggle {
    font-size: 0.75rem;
    padding: 0.4rem 0.875rem;
  }
}
