/* mobile-map.css - Мобильная адаптация для страницы карты */

/* ===== ОБЩИЕ СТИЛИ ДЛЯ МОБИЛЬНОГО ХЕДЕРА ===== */
@media (max-width: 1024px) {
  /* HEADER - Мобильная версия */
  header {
    top: 10px;
    height: 70px; /* Увеличил высоту */
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 40px);
    position: fixed;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    left: 50%;
    transform: translateX(-50%);
  }

  body.dark-theme header {
    background: rgba(45, 45, 45, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  .top-left-icons {
    display: flex;
    gap: 12px; /* Увеличил расстояние между иконками */
    align-items: center;
  }

  .top-left-icons img {
    width: 28px; /* Увеличил размер иконок */
    height: 28px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
  }

  .top-left-icons img:hover {
    transform: scale(1.1);
    opacity: 0.8;
  }

  /* Скрываем основную навигацию на мобильных */
  .main-nav {
    display: none !important;
  }

  /* Бургер меню */
  .burger-menu {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 32px; /* Увеличил размер бургер-меню */
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
  }

  .burger-line {
    width: 100%;
    height: 3px; /* Увеличил толщину линий */
    background-color: #000;
    transition: all 0.3s ease;
    border-radius: 2px;
  }

  body.dark-theme .burger-line {
    background-color: #fff;
  }

  .burger-menu.active .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }

  .burger-menu.active .burger-line:nth-child(2) {
    opacity: 0;
  }

  .burger-menu.active .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
  }

  /* Боковое меню */
  .side-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1001;
    transition: right 0.3s ease;
    padding: 90px 30px 30px;
    overflow-y: auto;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
  }

  body.dark-theme .side-menu {
    background: rgba(45, 45, 45, 0.98);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.4);
  }

  .side-menu.open {
    right: 0;
  }

  .side-menu nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .side-menu a {
    color: #333;
    text-decoration: none;
    font-size: 20px; /* Увеличил размер шрифта */
    padding: 16px 20px; /* Увеличил отступы */
    border-radius: 12px;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid transparent;
  }

  body.dark-theme .side-menu a {
    color: #fff;
  }

  .side-menu a:hover {
    color: #0d4269;
    background: rgba(13, 66, 105, 0.1);
    border-color: rgba(13, 66, 105, 0.2);
    transform: translateX(5px);
  }

  body.dark-theme .side-menu a:hover {
    color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.2);
  }

  .close-menu {
    position: absolute;
    top: 25px;
    right: 25px;
    background: none;
    border: none;
    font-size: 32px; /* Увеличил размер кнопки закрытия */
    cursor: pointer;
    color: #333;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1002;
  }

  body.dark-theme .close-menu {
    color: #fff;
  }

  .close-menu:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
  }

  body.dark-theme .close-menu:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Overlay для размытия фона */
  .overlay-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
  }

  .overlay-blur.active {
    display: block;
  }

  /* Сдвигаем основной контент вниз из-за фиксированного хедера */
  main.hospital-map-page {
    margin-top: 90px;
  }
}

/* ===== СТИЛИ ДЛЯ ДЕСКТОПНОЙ ВЕРСИИ ===== */
@media (min-width: 1025px) {
  .burger-menu {
    display: none !important;
  }
  
  .side-menu {
    display: none !important;
  }
  
  .overlay-blur {
    display: none !important;
  }
}

/* ===== АДАПТАЦИЯ ОСНОВНОГО КОНТЕНТА КАРТЫ ===== */
@media (max-width: 1024px) {
  /* MAIN CONTENT - Вертикальное расположение */
  main.hospital-map-page {
    flex-direction: column;
    height: auto;
    padding: 20px 15px 15px;
    gap: 25px;
  }

  .map-container {
    height: 50vh;
    min-height: 350px; /* Увеличил минимальную высоту */
    order: 1;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }

  .hospital-map-wrapper {
    height: 100%;
    position: relative;
  }

  .hospital-map-bg {
    object-fit: contain;
    width: 100%;
    height: 100%;
  }

  /* Увеличиваем блоки легенды */
  .legend-container {
    width: 100%;
    height: auto;
    max-height: 45vh; /* Увеличил максимальную высоту */
    min-height: 250px; /* Увеличил минимальную высоту */
    order: 2;
    padding: 20px;
    gap: 15px;
    overflow-y: auto;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 15px;
    backdrop-filter: blur(10px);
  }

  body.dark-theme .legend-container {
    background: rgba(45, 45, 45, 0.8);
  }

  .legend-item {
    padding: 18px 16px; /* Увеличил отступы */
    font-size: 16px; /* Увеличил размер шрифта */
    line-height: 1.6;
    min-height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
  }

  .legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  }

  /* Улучшаем читаемость текста в легенде */
  .legend-item.a {
    background: #0e4b36;
    color: white;
    font-weight: 600; /* Увеличил жирность */
    border-color: #1a7a52;
  }

  .legend-item.b {
    background: #6b0f1d;
    color: white;
    font-weight: 600;
    border-color: #9a1429;
  }

  .legend-item.c {
    background: #083a86;
    color: white;
    font-weight: 600;
    border-color: #0c52c2;
  }

  body.dark-theme .legend-item.a {
    background: #1a5c3e;
    border-color: #2d8c62;
  }

  body.dark-theme .legend-item.b {
    background: #7a1a2a;
    border-color: #ad243a;
  }

  body.dark-theme .legend-item.c {
    background: #1a4a8a;
    border-color: #2668c7;
  }

  /* Адаптируем тултипы */
  .tooltip {
    font-size: 16px; /* Увеличил размер шрифта */
    padding: 14px 18px; /* Увеличил отступы */
    max-width: 320px; /* Увеличил максимальную ширину */
    border-radius: 12px;
    font-weight: 500;
  }

  /* Адаптируем контролы масштабирования */
  .zoom-controls {
    bottom: 20px;
    right: 20px;
    gap: 8px;
  }

  .zoom-btn {
    width: 44px; /* Увеличил размер кнопок */
    height: 44px;
    font-size: 20px; /* Увеличил размер шрифта */
    border-radius: 12px;
    font-weight: 600;
  }

  .zoom-level {
    bottom: 75px;
    right: 20px;
    font-size: 15px; /* Увеличил размер шрифта */
    padding: 8px 12px; /* Увеличил отступы */
    border-radius: 8px;
    font-weight: 600;
  }

  /* Футер */
  .site-footer {
    padding: 30px 20px; /* Увеличил отступы */
    margin-top: 20px;
  }

  .footer-container {
    font-size: 16px; /* Увеличил размер шрифта */
    font-weight: 500;
  }
}

/* ===== АДАПТАЦИЯ ДЛЯ ПЛАНШЕТОВ ===== */
@media (max-width: 768px) {
  header {
    height: 65px;
    padding: 0 15px;
    width: calc(100% - 30px);
  }

  .top-left-icons img {
    width: 26px;
    height: 26px;
  }

  .burger-menu {
    width: 30px;
    height: 22px;
  }

  main.hospital-map-page {
    padding: 15px 12px 12px;
    gap: 20px;
    margin-top: 85px;
  }

  .map-container {
    height: 45vh;
    min-height: 300px;
  }

  .legend-container {
    max-height: 40vh;
    min-height: 220px;
    padding: 18px;
  }

  .legend-item {
    padding: 16px 14px;
    font-size: 15px;
  }

  .tooltip {
    font-size: 15px;
    padding: 12px 16px;
    max-width: 300px;
  }

  .zoom-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .zoom-level {
    font-size: 14px;
  }
}

/* ===== АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ ===== */
@media (max-width: 480px) {
  header {
    top: 8px;
    height: 60px;
    padding: 0 12px;
    width: calc(100% - 24px);
  }

  .top-left-icons {
    gap: 10px;
  }

  .top-left-icons img {
    width: 24px;
    height: 24px;
  }

  .burger-menu {
    width: 28px;
    height: 20px;
  }

  .burger-line {
    height: 2.5px;
  }

  .side-menu {
    width: 90%;
    padding: 80px 20px 20px;
  }

  .side-menu a {
    font-size: 18px;
    padding: 14px 18px;
  }

  .close-menu {
    top: 20px;
    right: 20px;
    font-size: 28px;
    width: 45px;
    height: 45px;
  }

  main.hospital-map-page {
    padding: 10px 8px 8px;
    gap: 15px;
    margin-top: 80px;
  }

  .map-container {
    height: 40vh;
    min-height: 250px;
    border-radius: 12px;
  }

  .legend-container {
    max-height: 35vh;
    min-height: 200px;
    padding: 15px;
    border-radius: 12px;
  }

  .legend-item {
    padding: 14px 12px;
    font-size: 14px;
    border-radius: 10px;
  }

  .tooltip {
    font-size: 14px;
    padding: 10px 14px;
    max-width: 280px;
  }

  .zoom-controls {
    bottom: 15px;
    right: 15px;
  }

  .zoom-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .zoom-level {
    bottom: 65px;
    right: 15px;
    font-size: 13px;
    padding: 6px 10px;
  }

  .site-footer {
    padding: 25px 15px;
  }

  .footer-container {
    font-size: 15px;
  }
}

/* ===== СПЕЦИАЛЬНЫЕ СТИЛИ ДЛЯ ОЧЕНЬ МАЛЕНЬКИХ ЭКРАНОВ ===== */
@media (max-width: 360px) {
  .legend-item {
    font-size: 13px;
    padding: 12px 10px;
  }

  .side-menu {
    width: 95%;
    padding: 70px 15px 15px;
  }

  .side-menu a {
    font-size: 16px;
    padding: 12px 15px;
  }

  .close-menu {
    font-size: 24px;
    width: 40px;
    height: 40px;
  }
}

/* ===== АДАПТАЦИЯ ДЛЯ РАЗНЫХ ОРИЕНТАЦИЙ ===== */
/* Портретная ориентация */
@media (max-width: 768px) and (orientation: portrait) {
  .map-container {
    height: 45vh;
  }
  
  .legend-container {
    max-height: 40vh;
  }
}

/* Ландшафтная ориентация для мобильных */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 500px) {
  main.hospital-map-page {
    flex-direction: row;
    height: calc(100vh - 90px);
    gap: 15px;
  }
  
  .map-container {
    height: 100%;
    flex: 2;
    min-height: auto;
  }
  
  .legend-container {
    height: 100%;
    max-height: none;
    flex: 1;
    min-height: auto;
  }

  header {
    height: 55px;
  }

  main.hospital-map-page {
    margin-top: 75px;
  }
}

/* ===== УЛУЧШЕНИЕ СКРОЛЛА ДЛЯ ЛЕГЕНДЫ ===== */
.legend-container::-webkit-scrollbar {
  width: 8px; /* Увеличил ширину скроллбара */
}

.legend-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.legend-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  transition: background 0.3s ease;
}

.legend-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

body.dark-theme .legend-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .legend-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

body.dark-theme .legend-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ===== АНИМАЦИИ И ПЕРЕХОДЫ ===== */
.map-container, .legend-container, .zoom-controls {
  transition: all 0.3s ease;
}

/* ===== УЛУЧШЕНИЕ ДОСТУПНОСТИ ===== */
@media (prefers-reduced-motion: reduce) {
  .burger-menu, .side-menu, .overlay-blur, .legend-item, .zoom-btn {
    transition: none;
  }
}

/* ===== ПОДДЕРЖКА ТЕМНОЙ ТЕМЫ ===== */
@media (max-width: 1024px) {
  body.dark-theme .top-left-icons img {
    filter: invert(1);
  }
}