/* ========== 1. СКРОЛБАР ========== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========== LESSON GALLERY STYLES ========== */
.lesson-gallery {
  margin-bottom: 1.5rem;
}
.lesson-gallery .gallery-item {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.lesson-gallery .gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  text-decoration: none;
}
.lesson-gallery .gallery-item img {
  transition: transform 0.3s ease;
  border-radius: 8px 8px 0 0;
}
.lesson-gallery .gallery-item:hover img {
  transform: scale(1.05);
}
.lesson-gallery .gallery-caption {
  padding: 8px 12px;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid #eee;
  border-radius: 0 0 8px 8px;
  text-align: center;
}
.lesson-gallery .gallery-caption small {
  font-size: 0.75rem;
  color: #666;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* File browser modal enhancements */
#fileBrowserModal .modal-body {
  max-height: 70vh;
  overflow-y: auto;
}
#fileBrowserModal .card {
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
#fileBrowserModal .card-header {
  background: linear-gradient(135deg, #007bff, #0056b3);
  border-bottom: none;
}
#fileBrowserModal .list-group-item {
  border-left: none;
  border-right: none;
  transition: all 0.2s ease;
}
#fileBrowserModal .list-group-item:hover {
  background-color: #f8f9fa;
  transform: translateX(4px);
}
#fileBrowserModal .list-group-item i {
  font-size: 1.2rem;
}

/* Responsive adjustments for lesson gallery */
@media (max-width: 768px) {
  .lesson-gallery .col-6 {
    margin-bottom: 1rem;
  }
  .lesson-gallery .gallery-item img {
    height: 120px !important;
  }
}
@media (min-width: 769px) and (max-width: 1024px) {
  .lesson-gallery .gallery-item img {
    height: 130px !important;
  }
}

/* ========== Preloader ========== */
#video-preloader {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#video-preloader video {
  max-width: 60%;
  max-height: 60vh;
  border: 12px solid #046434;
  border-radius: 8px;
  box-shadow:
    0 0 40px 10px rgba(0,255,0,0.9),
    0 0 80px 20px rgba(0,255,0,0.7),
    0 0 120px 30px rgba(0,255,0,0.5),
    0 0 160px 40px rgba(0,255,0,0.3);
  filter: brightness(1.4);
  animation: neonPulse 3.5s ease-in-out infinite;
  will-change: transform, box-shadow, filter;
  backface-visibility: hidden;
  transform: translateZ(0);
}
#video-preloader.loaded {
  animation: flashAndHide 3.5s ease-in-out forwards;
  opacity: 0;
  visibility: hidden;
}
@keyframes flashAndHide {
  0% {
    filter: brightness(3);
    opacity: 1;
    visibility: visible;
  }
  50% {
    filter: brightness(1);
    opacity: 1;
    visibility: visible;
  }
  100% {
    filter: brightness(1);
    opacity: 0;
    visibility: hidden;
  }
}
@keyframes neonPulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(0,255,0,0.4),
      0 0 16px rgba(0,255,0,0.3);
    transform: scale(1);
  }
  100% {
    box-shadow:
      0 0 16px rgba(0,255,0,0.7),
      0 0 32px rgba(0,255,0,0.5);
    transform: scale(1.02);
  }
}

/* ========== 2. ОСНОВНИ НАСТРОЙКИ ЗА HTML И BODY ========== */
html {
  scroll-padding-top: 100px;
  scroll-behavior: smooth;
}
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background-color: #4e9b00;
  margin: 0;
  padding: 0;
}
h1, h2, h3, h4, h5 {
  font-weight: bold;
}

/* ========== 3. НАСТРОЙКИ ЗА СЕКЦИИ ========== */
section.container {
  scroll-snap-align: start;
  scroll-margin-top: 100px;
  background-color: #f8f9fa;
  padding: 40px;
  border-radius: 8px;
  margin-bottom: 2rem;
  animation: fadeInUp 1s ease-out;
}

/* ========== 4. HERO СЕКЦИЯ ========== */
header {
  margin-top: 86px;
}
header h1 {
  padding-top: 12px;
}
.hero {
  background: linear-gradient(to right, #2f5e00, #005b00);
  padding: 100px 20px;
  text-align: center;
  color: #ffffff;
  animation: fadeIn 1s ease-out;
}

/* ========== 5. КАРТИЧКИ (CARDS) ========== */
.card {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #ffffff;
}
.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 1rem 2rem rgba(0,0,0,0.3);
}
.card-img-top {
  height: 220px;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card-img-top:hover {
  transform: scale(1.1);
}
.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}
.card-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #2f5e00;
}
.card-text {
  flex-grow: 1;
  font-size: 0.95rem;
  color: #555555;
  margin-bottom: 1rem;
}
.btn-primary {
  background: linear-gradient(135deg, #37a301, #005b00);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  font-weight: 500;
  transition: background 0.4s ease, transform 0.3s ease, background-color 0.3s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #005b00, #37a301);
  transform: translateY(-2px) scale(1.05);
}
.card::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #37a301, #005b00);
  margin-top: auto;
}

/* ========== СБОРНИК КАРТА ========== */
.sbornik-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid #37a301;
  box-shadow: 0 8px 25px rgba(55, 163, 1, 0.15);
  overflow: hidden;
}
.sbornik-image-col {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  padding: 0;
}
.sbornik-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sbornik-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  min-height: 100%;
}
.sbornik-card .card-title {
  color: #2f5e00;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.sbornik-card .card-text {
  color: #555;
  font-size: 1.1rem;
  line-height: 1.6;
}
.sbornik-card .btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 2rem;
  min-width: 150px;
}
.sbornik-card .btn-success {
  background: linear-gradient(135deg, #28a745, #20c997);
  border: none;
  transition: all 0.3s ease;
}
.sbornik-card .btn-success:hover {
  background: linear-gradient(135deg, #20c997, #28a745);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}
@media (max-width: 768px) {
  .sbornik-image-col {
    min-height: 250px;
  }
  .sbornik-cover-image {
    object-fit: contain;
    padding: 1rem;
  }
  .sbornik-content {
    padding: 1.5rem !important;
  }
  .sbornik-card .card-title {
    font-size: 1.5rem;
  }
  .sbornik-card .card-text {
    font-size: 1rem;
  }
  .sbornik-card .btn-lg {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    min-width: 120px;
  }
}

/* ========== 6. НАВИГАЦИЯ (NAVBAR) ========== */
.navbar {
  background: linear-gradient(to right, #37a301, #007400);
  padding: 10px 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.3s ease;
}
.navbar-brand {
  width: 70px;
  height: 70px;
  transition: transform 0.3s ease;
}
.navbar-brand:hover {
  transform: scale(1.05);
}
.navbar-nav .nav-link {
  color: #000000 !important;
  margin: 0 15px;
  font-size: 1.1rem;
  font-weight: bold;
  position: relative;
  transition: color 0.3s ease;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: #ffffff !important;
}
.navbar-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0%;
  height: 2px;
  background-color: #000000;
  transition: width 0.3s ease;
}
.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
  width: 100%;
}
.navbar-toggler {
  border: 2px solid #333333;
  transition: border-color 0.3s ease;
}
.navbar-toggler-icon {
  filter: invert(0);
}
.container-fluid img {
  cursor: pointer;
}

/* ========== 7. ИЗОБРАЖЕНИЯ ========== */
img {
  height: 600px;
}
.row.align-items-center img {
  width: 500px;
  height: 250px;
  border: 3px solid #e0e0e0;
  border-radius: 8px;
  transition: transform 0.4s ease;
}
.row.align-items-center img:hover {
  transform: scale(1.03);
}

/* ========== 8. АНИМАЦИИ ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========== 9. БУТОНИ ========== */
/* .btn-primary transitions are already included above */

/* ========== 10. FOOTER ========== */
footer.bg-dark {
  background: linear-gradient(to right, #2f5e00, #005b00);
  color: #f8f9fa;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}
footer .container {
  max-width: 1140px;
}
footer .row > div {
  text-align: center;
}
footer h5 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e9f5e9;
  margin-bottom: 1rem;
}
footer p.small {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #d4e8d4;
  margin-bottom: 0.75rem;
}
footer .nav.flex-column {
  align-items: center;
}
footer .nav-link {
  padding: 0;
  color: #c5e1c5;
  transition: color 0.3s ease;
}
footer .nav-link:hover {
  color: #ffffff;
  text-decoration: none;
}
footer .row > div > div {
  display: flex;
  justify-content: center;
}
footer .bi {
  color: #c5e1c5;
  transition: color 0.3s ease, transform 0.3s ease;
}
footer .bi:hover {
  color: #ffffff;
  transform: translateY(-2px);
}
footer .border-top {
  border-color: rgba(255,255,255,0.2) !important;
}
footer .border-top + .small {
  color: #a9d3a9;
  margin-top: 1rem;
  padding-top: 1rem;
}
#backToTop {
  background: #37a301;
  color: #ffffff;
}
#backToTop:hover {
  background: #005b00;
}

/* ========== 11. МОДАЛЕН ПРОЗОРЕЦ ========== */
#genericModal .modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  margin: 0;
  padding: 1rem;
}
#genericModal .modal-content {
  border-radius: 0.75rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
#genericModal .modal-header,
#genericModal .modal-footer {
  border: none;
  justify-content: center;
  padding: 1rem 1.5rem;
}
#genericModal .modal-title {
  margin: 0 auto;
  font-size: 1.5rem;
  text-align: center;
}
#genericModal .modal-body {
  padding: 1.5rem;
  text-align: left;
  line-height: 1.6;
  font-size: 1rem;
}

/* ========== 12. АДАПТИВЕН ДИЗАЙН ========== */
@media (max-width: 767.98px) {
  .school-img,
  .school-info {
    width: 100%;
  }
  .school-img {
    order: 1;
  }
  .school-info {
    order: 2;
    border-top: 1px solid #ccc;
    padding-top: 15px;
  }
  #genericModal .modal-dialog {
    max-width: 95%;
    padding: 0.5rem;
  }
  #genericModal .modal-title {
    font-size: 1.25rem;
  }
  #genericModal .modal-body {
    font-size: 0.95rem;
  }
}
@media (min-width: 576px) and (max-width: 767.98px) {
  #genericModal .modal-dialog {
    max-width: 500px;
  }
}
@media (min-width: 768px) and (max-width: 991.98px) {
  #genericModal .modal-dialog {
    max-width: 550px;
  }
  .navbar-toggler {
    width: 10px;
  }
  .navbar-toggler {
    width: auto !important;
    padding: 0.25rem 0.75rem !important;
  }
  .navbar-toggler-icon {
    background-size: 1.25em 1.25em !important;
  }
}
@media (min-width: 992px) {
  #genericModal .modal-dialog {
    max-width: 650px;
  }
}
@media (max-width: 468px) {
  header {
    margin-top: 250px;
  }
  header h1 {
    padding-top: 24px;
  }
  .navbar-toggler {
    width: 100%;
    margin-top: 20px;
  }
}
@media (min-width: 362px) and (max-width: 407px) {
  .laboratory {
    margin-left: 20px;
  }
}

/* Gallery Tabs Styling */
#galleryTabs {
  border-bottom: 2px solid #4e9b00;
}
#galleryTabs .nav-link {
  color: #4e9b00;
  border: none;
  border-radius: 8px 8px 0 0;
  margin-right: 5px;
  padding: 12px 20px;
  font-weight: 500;
  transition: all 0.3s ease;
  background-color: rgba(78, 155, 0, 0.1);
}
#galleryTabs .nav-link:hover {
  background-color: rgba(78, 155, 0, 0.2);
  color: #2f5e00;
  transform: translateY(-2px);
}
#galleryTabs .nav-link.active {
  background-color: #4e9b00;
  color: white;
  box-shadow: 0 4px 12px rgba(78, 155, 0, 0.3);
}
#galleryTabs .nav-link.active:hover {
  background-color: #2f5e00;
  transform: translateY(-2px);
}
.tab-pane {
  animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.pswp-gallery img {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.pswp-gallery img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2) !important;
}
.pswp-gallery a {
  display: block;
  text-decoration: none;
  border-radius: 8px;
  overflow: hidden;
}
.pswp-gallery .col-12 {
  margin-bottom: 1rem;
}
.pswp {
  z-index: 10000;
}
.pswp__bg {
  background: rgba(0, 0, 0, 0.9);
}
.pswp__counter {
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
}
.pswp__button {
  color: white;
  transition: background-color 0.3s ease;
}
.pswp__button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
.pswp__img {
  object-fit: contain !important;
  max-width: 100vw !important;
  max-height: 90vh !important;
  width: auto !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

/* ========== PDF FLIPBOOK STYLES ========== */
.pdf-flipbook-modal .modal-dialog {
  margin: 0;
  max-width: 100%;
  height: 100vh;
}

.pdf-flipbook-modal .modal-content {
  height: 100vh;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.pdf-flipbook-modal .modal-header {
  flex-shrink: 0;
  padding: 1rem;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.pdf-flipbook-modal .modal-header .page-indicator {
  font-weight: 600;
  font-size: 0.95rem;
}

.pdf-flipbook-modal .modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  padding: 0;
  min-height: 0; /* Important for flexbox */
}

.pdf-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  color: white;
  width: 100%;
  max-width: 400px;
}

.pdf-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.pdf-loading-icon {
  font-size: 4rem;
  color: #ffffff;
  margin-bottom: 1.5rem;
  animation: pdfIconFloat 2s ease-in-out infinite;
}

.pdf-loading-icon i {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.pdf-loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 2rem;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: pdfSpinnerRotate 1.2s linear infinite;
}

.spinner-ring:nth-child(1) {
  animation-delay: 0s;
  opacity: 1;
}

.spinner-ring:nth-child(2) {
  animation-delay: 0.4s;
  opacity: 0.7;
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
}

.spinner-ring:nth-child(3) {
  animation-delay: 0.8s;
  opacity: 0.5;
  width: 50%;
  height: 50%;
  top: 25%;
  left: 25%;
}

.pdf-loading-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

.pdf-loading-text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.pdf-loading-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 1rem;
}

.pdf-loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffffff, rgba(255, 255, 255, 0.8));
  border-radius: 2px;
  animation: pdfProgressBar 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes pdfIconFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pdfSpinnerRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pdfProgressBar {
  0% {
    width: 0%;
    margin-left: 0%;
  }
  50% {
    width: 70%;
    margin-left: 15%;
  }
  100% {
    width: 100%;
    margin-left: 0%;
  }
}

.flipbook-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 0;
}

#flipbook {
  box-shadow: 0 10px 50px rgba(0,0,0,0.5);
  background: white;
  border-radius: 4px;
  position: relative;
  margin: 0 auto;
}

#flipbook .hard {
  background: #fff;
  display: block !important;
  position: relative !important;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

#flipbook .hard img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#flipbook .hard.empty-page {
  visibility: hidden !important;
  background: transparent !important;
}

/* Responsive Design for PDF Flipbook */
@media (max-width: 768px) {
  .pdf-flipbook-modal .modal-header {
    padding: 0.75rem;
    flex-wrap: wrap;
  }
  
  .pdf-flipbook-modal .modal-header .page-indicator {
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
  }
  
  .pdf-flipbook-modal .modal-header .btn-group {
    width: 100%;
    justify-content: center;
  }
  
  .pdf-flipbook-modal .modal-header .btn-group .btn {
    flex: 1;
    padding: 0.5rem;
  }
  
  #flipbook {
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  }
}

@media (max-width: 480px) {
  .pdf-flipbook-modal .modal-header {
    padding: 0.5rem;
  }
  
  .pdf-flipbook-modal .modal-header h5 {
    font-size: 0.9rem;
  }
  
  .pdf-flipbook-modal .modal-header .btn-group .btn {
    padding: 0.4rem;
    font-size: 0.8rem;
  }
}

.pdf-flipbook-modal:fullscreen .modal-header {
  padding: 1.5rem;
}

.pdf-flipbook-modal:fullscreen .modal-body {
  padding: 0;
}

