.card {
    position: absolute;
    width: 80%;
    max-width: 400px;
    height: 90%;
    background-color: #000;
    border: 2px solid white;
    border-radius: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out, left 0.4s ease-out, top 0.4s ease-out, filter 0.4s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    touch-action: manipulation;
}

/* Плавное появление карточек */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 0.6; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Контейнер стека карточек */
.card-stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 100%;
    margin: 0 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
}

/* Текущая карточка */
.card.current {
    z-index: 2;
    transform: scale(1);
    filter: none;
    opacity: 1;
}

/* Соседние карточки */
.card.prev, .card.next {
    z-index: 1;
    transform: scale(0.8);
    filter: blur(3px);
    opacity: 0.6;
}

/* Улучшение переходов для свайпа */
.card.swiped-left, .card.swiped-right {
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.card.swiped-left {
    transform: translateX(-100%) rotate(-10deg);
    opacity: 0;
}

.card.swiped-right {
    transform: translateX(100%) rotate(10deg);
    opacity: 0;
}

/* Слайдер фотографий */
.card .photo-slider-container {
    position: relative;
    width: 100%;
    height: 60%;
    overflow: hidden;
    background-color: #000; /* Фон для заполнения пустых областей */
}

.card .photo-slider-track {
    display: flex;
    height: 100%;
    width: auto; /* Ширина определяется слайдами */
    transition: transform 0.3s ease;
    gap: 0; /* Убираем промежутки между слайдами */
}

.card .photo-slide {
    flex-shrink: 0;
    width: 300px; /* Фиксированная ширина слайда, синхронизируется с JS */
    height: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    overflow: hidden; /* Убираем выходящие части изображения */
}

.card .slider-photo {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Заполняем слайд полностью */
    display: block;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    touch-action: manipulation;
    margin: 0;
}

.card .magnifier-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card .header-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

.card .name-age {
    color: white;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card .about-section {
    padding: 0 20px;
    text-align: left;
    color: white;
    overflow: hidden;
}

.card .about-section h4 {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0 5px;
}

.card .about-section p {
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.card .photo-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.card .photo-gallery img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
}

.card .interests-section {
    padding: 0 20px;
    text-align: left;
    color: white;
    overflow: hidden;
}

.card .interests-section h4 {
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0 5px;
}

.card .interests-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.card .interest-item {
    background-color: #333;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card button.book-button {
    margin: 0;
    padding: 8px 16px;
    background-color: #fe3c72;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    touch-action: manipulation;
}

.card button.book-button:hover {
    background-color: #e03562;
}

.card .swipe-buttons {
    display: none !important;
    display: flex;
    gap: 20px;
    padding: 10px 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    touch-action: manipulation;
}

.card .swipe-buttons button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    border: none;
    cursor: pointer;
}

.card .swipe-left {
    background-color: #ff4444;
    color: white;
}

.card .swipe-left:hover {
    background-color: #cc3333;
}

.card .swipe-right {
    background-color: #00cc66;
    color: white;
}

.card .swipe-right:hover {
    background-color: #00a854;
}

/* Стили для галереи и попапа */
.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.gallery-popup {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.popup-buttons {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.popup-yes, .popup-no {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.popup-yes {
    background-color: #00cc66;
    color: white;
}

.popup-no {
    background-color: #ff4444;
    color: white;
}

.gallery-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-container img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.gallery-prev, .gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 24px;
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.gallery-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 18px;
}

.gallery-book-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 8px 16px;
    background-color: #fe3c72;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    touch-action: manipulation;
}

/* Адаптация для мобильных устройств */
@media (max-width: 600px) {
    .card-stack {
        position: relative;
        width: 100%;
        max-width: 400px;
        height: 100%;
        margin-top: -105px !important;
        margin: 0 auto;
        overflow: hidden;
    }
    .card {
        border-radius: 20px;
        border: none;
        width: 90%;
        height: 85%;
        max-width: none;
    }

    .card .photo-slider-container {
        height: 55%;
    }

    .card .photo-slide {
        width: 275px; /* Уменьшаем ширину для мобильных */
    }

    .card .name-age {
        font-size: 24px;
    }

    .card .photo-gallery img {
        width: 50px;
        height: 50px;
    }

    .card .about-section h4,
    .card .interests-section h4 {
        font-size: 16px;
    }

    .card .about-section p {
        font-size: 12px;
    }

    .card .interest-item {
        font-size: 12px;
        padding: 4px 12px;
    }

    .card .swipe-buttons button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .card button.book-button {
        padding: 6px 12px;
                font-size: 20px;
    }

    .card .magnifier-icon {
        font-size: 20px;
        top: 8px;
        right: 8px;
    }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 400px) {
    .card {
        width: 95%;
        height: 80%;
    }

    .card .photo-slider-container {
        height: 55%;
    }

    .card .photo-slide {
        width: 250px; /* Еще меньше для маленьких экранов */
    }

    .card .name-age {
        font-size: 20px;
    }

    .card .photo-gallery img {
        width: 45px;
        height: 45px;
    }

    .card button.book-button {
        padding: 5px 10px;
        font-size: 11px;
    }

    .card .magnifier-icon {
        font-size: 18px;
    }
}