/* Базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Шапка */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    color: #666;
}

.subtitle a {
    color: #3388ff;
    text-decoration: none;
}

.subtitle a:hover {
    text-decoration: underline;
}

/* Контейнер карты */
#map {
    height: 100vh;
    width: 100%;
}

/* MapLibre маркеры */
.custom-marker {
    background: transparent;
    z-index: 1;
}

.custom-marker-inner {
    width: 25px;
    height: 41px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 41"><path fill="%233388ff" d="M12.5 0C5.6 0 0 5.6 0 12.5c0 12 12.5 28.5 12.5 28.5S25 24.5 25 12.5C25 5.6 19.4 0 12.5 0z"/><circle fill="%23fff" cx="12.5" cy="12.5" r="5"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 120ms ease, filter 120ms ease;
    transform-origin: center center;
    cursor: pointer;
}

.custom-marker-inner:hover,
.custom-marker-inner.marker-hovered {
    transform: scale(1.5);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.custom-marker.marker-hovered .custom-marker-inner {
    transform: scale(1.5) !important;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4)) !important;
}

/* MapLibre Popup */
.maplibregl-popup {
    background-color: rgba(0, 0, 0, 0.85);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.maplibregl-popup-tip {
    border-top-color: rgba(0, 0, 0, 0.85) !important;
}

.maplibregl-popup-content {
    margin: 0;
}

/* Custom Tooltip for MapLibre */
.custom-tooltip {
    display: none;
    position: fixed;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* MapLibre элементы управления */
.maplibregl-ctrl-group {
    border-radius: 4px;
}

.maplibregl-ctrl {
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.9);
    padding: 0 5px;
}

/* ==================== Карточка объекта ==================== */
.place-card {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.place-card.active {
    display: flex;
}

.place-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.place-card-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 2002;
    transition: background-color 0.2s;
}

.place-card-close:hover {
    background: #fff;
}

.place-card-content {
    position: relative;
    z-index: 2001;
    width: 700px;
    max-width: 90%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Верхняя часть с градиентным фоном */
.place-card-header {
    position: relative;
    min-height: 400px;
    background-image: url('/фон градиент.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
}

/* Левая панель (25%) */
.place-card-left-panel {
    width: 25%;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

/* Аватарка ученика */
.place-card-student {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.place-card-student img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

/* Если нет фото - показываем пустой круг с белой рамкой */
.place-card-student img[src=""],
.place-card-student img:not([src]) {
    content: '';
    display: block;
    background: transparent;
    border: 3px solid rgba(255, 255, 255, 0.8);
}

/* Тёмно-зелёный блок с ФИО - отдельный элемент ПОД аватаркой */
.place-card-student-name {
    background: #2e7d32;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    color: white;
    text-align: center;
    white-space: normal;
    line-height: 1.3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 110px;
    margin-top: 8px;
}

/* Две строки для ФИО */
.place-card-student-name .name-line-1 {
    display: block;
    margin-bottom: 2px;
    font-weight: 500;
}

.place-card-student-name .name-line-2 {
    display: block;
    font-weight: 400;
}

/* Название и адрес - в нижнем левом углу */
.place-card-title-block {
    margin-top: auto;
    margin-bottom: 20px;
    text-align: left;
    align-self: flex-start;
    width: 100%;
}

.place-title {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.place-address {
    font-size: 18px;
    font-weight: 400;
    color: #000000;
    margin: 0;
    line-height: 1.3;
}

/* Фото по центру (67% ширины) */
.place-card-image-wrapper {
    width: 67%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.place-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

/* Кнопка Play - ближе к правому краю карточки */
.play-button {
    position: absolute;
    bottom: 30px;
    right: 8%;
    left: auto;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 50%, #d32f2f 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
    z-index: 10;
}

.play-button:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 50%, #c62828 100%);
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.5);
}

.play-button:active {
    background: linear-gradient(135deg, #e53935 0%, #c62828 50%, #b71c1c 100%);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

.play-button-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent white;
    margin-left: 4px;
}

/* Нижняя часть (белый фон) */
.place-card-footer {
    background: white;
    padding: 15px 20px;
    text-align: left;
}

.footer-poem {
    margin-bottom: 8px;
}

.footer-poem-author,
.footer-poem-title,
.footer-student,
.footer-class {
    font-size: 13px;
    font-weight: 400;
    color: #000000;
    margin-bottom: 5px;
    line-height: 1.4;
}

.footer-poem-author {
    margin-bottom: 4px;
}

.footer-poem-title {
    margin-bottom: 8px;
}

.footer-student {
    margin-bottom: 8px;
}

.footer-class {
    margin-bottom: 0;
}

/* ==================== Видео модальное окно ==================== */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.video-modal.active {
    display: flex;
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.video-modal-content {
    position: relative;
    z-index: 3001;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 3002;
    transition: background-color 0.2s;
}

.video-modal-close:hover {
    background: #fff;
}

/* Видео контейнер */
.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
}

/* ==================== Режим изображения карточки ==================== */
.card-image-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.card-image-full {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Кнопка Play в режиме изображения карточки */
.card-image-mode .play-button {
    position: absolute;
    bottom: 30px;
    right: 30px;
}

/* ==================== Мобильные устройства ==================== */
@media (max-width: 768px) {
    .place-card-content {
        width: 95%;
        max-width: none;
    }

    .place-card-header {
        min-height: 350px;
        flex-direction: column;
    }

    .place-card-left-panel {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        padding: 15px;
        gap: 10px;
    }

    .place-card-student {
        margin-bottom: 0;
        flex-direction: row;
        gap: 10px;
    }

    .place-card-student img {
        width: 60px;
        height: 60px;
    }

    .place-card-student-name {
        font-size: 11px;
        padding: 6px 10px;
        min-width: 90px;
    }

    .place-card-title-block {
        margin-top: auto;
        margin-bottom: 15px;
    }

    .place-title,
    .place-address {
        font-size: 16px;
    }

    .play-button {
        width: 60px;
        height: 60px;
        bottom: 15px;
        left: calc(100% - 50px);
    }

    .play-button-icon {
        border-width: 10px 0 10px 18px;
    }

    .place-card-footer {
        padding: 12px 15px;
    }

    .footer-poem-author,
    .footer-poem-title,
    .footer-student,
    .footer-class {
        font-size: 12px;
    }

    .place-card-close,
    .video-modal-close {
        top: -35px;
        width: 28px;
        height: 28px;
        font-size: 20px;
    }
}
