.photo-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 10px;
    /* базовая высота ряда для "masonry" эффекта */
    gap: 8px;
    grid-auto-flow: dense;
}

.photo-wrapper {
    display: block;
}

.photo-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* Пропорциональное растяжение для эффекта мозаики */
.photo-wrapper {
    grid-row-end: span var(--span);
}

/* ===== Морская тема фильтров ===== */
.sea-theme {
    background: linear-gradient(90deg, #1e90ff, #00bfff);
    padding: 10px;
    border-radius: 8px;
    color: white;
    gap: 8px;
    flex-wrap: wrap;
}

.sea-theme .form-select {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sea-theme .form-select option {
    color: black;
}

.sea-theme .btn-apply {
    background-color: #0077be;
    border: none;
    color: white;
}

/* ===== Мозаика ===== */
.photo-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 10px;
    gap: 8px;
    grid-auto-flow: dense;
    padding: 5px;
}

.photo-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* ===== Модальное окно во весь экран ===== */
.modal-img {
    display: none;
    /* Скрыто по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 50, 0.85);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 15px;
}

.modal-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.modal-inner img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    display: block;
}

.modal-content-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 95vw;
}

.modal-info {
    position: absolute;
    top: 20px;
    left: 20px;
    width: auto;
    max-width: 350px;
    background: rgba(0, 0, 50, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 15px;
    border-radius: 8px;
    box-sizing: border-box;
    text-align: left;
    z-index: 1060;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.modal-info h4 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: #00bfff;
}

.modal-info-details {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    align-items: center;
}

.modal-info-details span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.slideshow-input {
    width: 50px !important;
    /* сильно уменьшили ширину */
    padding: 0.15rem 0.25rem;
    /* минимальные отступы */
    font-size: 0.85rem;
    /* уменьшили шрифт */
    text-align: center;
}

/* Кнопка закрытия */
.btn-close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    font-size: 2rem;
    border-radius: 50%;
    cursor: pointer;
}

.btn-close-modal:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Кнопки управления модалкой */
.btn-modal {
    background: rgba(0, 0, 139, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-modal:hover {
    background: rgba(0, 0, 139, 0.9);
}

.modal-bottom-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

/* Фильтры в стиле навбара, без скруглений */
.photo-navbar {
    background: linear-gradient(to right, #1a2980, #26d0ce);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-radius: 0;
    /* Убираем скругления */
}

.photo-navbar select.form-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    min-width: 130px;
    font-weight: 500;
    padding: 0.3rem 0.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    border-radius: 0;
}

/* Добавляем стрелочку через псевдоэлемент */
.photo-navbar select.form-select::after {
    content: "▾";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: white;
    font-size: 0.9rem;
}

/* Опции селекта */
.photo-navbar select.form-select option {
    color: white;
    background-color: #1a2980;
}

/* Поле скорости */
.photo-navbar .slideshow-input {
    width: 50px;
    padding: 0.2rem 0.3rem;
    font-size: 0.85rem;
    text-align: center;
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Кнопка Применить */
.photo-navbar .btn-apply {
    background-color: #0077be;
    border: none;
    color: white;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 0;
    /* Без скруглений */
}

/* Ховер кнопки */
.photo-navbar .btn-apply:hover {
    background-color: #005f9e;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .photo-navbar form {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Custom Multiselect */
.custom-multiselect .dropdown-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0;
}

.custom-multiselect .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.custom-multiselect .dropdown-menu {
    background: rgba(26, 41, 128, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 0;
    min-width: 200px;
}

.custom-multiselect .form-check-label {
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    width: 100%;
}

.custom-multiselect .form-check {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    margin-bottom: 0;
    transition: background 0.2s ease;
}

.custom-multiselect .form-check:hover {
    background: rgba(255, 255, 255, 0.1);
}

.custom-multiselect .form-check-input:checked {
    background-color: #00bfff;
    border-color: #00bfff;
}