/* ===== МОДАЛЬНЫЕ ОКНА ===== */

/* Оверлей */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Базовое модальное окно */
.modal {
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    position: relative;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--glow-blue);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Кнопка закрытия - исправлена: теперь поверх всего */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2100; /* Выше всего */
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-close:hover {
    background: var(--neon-magenta);
    color: white;
    transform: rotate(90deg) scale(1.1);
    border-color: var(--neon-magenta);
    box-shadow: var(--glow-magenta);
}

/* Заголовок модального окна */
.modal-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-header h3 {
    color: var(--neon-blue);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контент модального окна с прокруткой */
.modal-scrollable {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

/* МОДАЛЬНОЕ ОКНО ТУРА */
.tour-modal-content {
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: rgba(15, 15, 25, 0.95);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.tour-modal-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-right: 60px; /* Место для кнопки закрытия */
}

.tour-modal-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.tour-modal-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--neon-blue);
    transform: translateX(-3px);
}

.tour-modal-header-title {
    color: var(--neon-blue);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tour-modal-scrollable {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

.tour-modal-details {
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 2rem;
}

/* Галерея в модальном окне */
.tour-modal-gallery {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.tour-modal-main-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    transition: opacity 0.3s;
    box-shadow: var(--shadow-sm);
}

.tour-modal-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.tour-modal-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    opacity: 0.8;
}

.tour-modal-thumb:hover {
    border-color: var(--neon-blue);
    transform: scale(0.98);
    opacity: 1;
}

.tour-modal-thumb.active {
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
    opacity: 1;
}

/* Информация о туре */
.tour-modal-info {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.tour-modal-title {
    font-size: 2rem;
    color: var(--neon-blue);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.tour-modal-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.tour-modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-sm);
}

.tour-modal-features {
    margin: 1.5rem 0;
}

.tour-modal-features h3 {
    color: var(--amber);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tour-modal-route {
    margin: 1.5rem 0;
}

.tour-modal-route h3 {
    color: var(--neon-blue);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.route-points-detailed {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.route-point-detailed {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.route-point-detailed:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 243, 255, 0.2);
}

.point-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-magenta));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: var(--glow-blue);
}

.point-info h4 {
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    font-size: 1rem;
}

.point-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.tour-modal-dates {
    margin: 1.5rem 0;
}

.tour-modal-dates h3 {
    color: var(--amber);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-dates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.3rem;
}

.modal-date-option {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.modal-date-option:hover {
    background: rgba(0, 243, 255, 0.05);
    border-color: var(--neon-blue);
}

.modal-date-option.selected {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-blue);
    box-shadow: var(--glow-blue);
}

.modal-date-option.selected::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 5px;
    color: var(--neon-green);
    font-size: 0.8rem;
}

.modal-date-option.no-seats {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-book-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-magenta));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.modal-book-btn:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 243, 255, 0.3);
}

.modal-book-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
}

/* МОДАЛЬНОЕ ОКНО БЛОГА */
.blog-modal-content {
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: rgba(15, 15, 25, 0.95);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.blog-modal-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    padding-right: 60px; /* Место для кнопки закрытия */
}

.blog-modal-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.blog-modal-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--neon-blue);
    transform: translateX(-3px);
}

.blog-modal-scrollable {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 70px);
}

.blog-modal-category {
    display: inline-block;
    padding: 0.3rem 1rem;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-blue);
    border-radius: 20px;
    color: var(--neon-blue);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.blog-modal-title {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.blog-modal-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-modal-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-modal-main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.3s;
    box-shadow: var(--shadow-md);
}

.blog-modal-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.blog-modal-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    opacity: 0.7;
}

.blog-modal-thumb:hover,
.blog-modal-thumb.active {
    opacity: 1;
    border-color: var(--neon-blue);
    transform: scale(0.98);
}

.blog-modal-text {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.1rem;
}

.blog-modal-text p {
    margin-bottom: 1.5rem;
}

.blog-modal-text h2 {
    color: var(--neon-blue);
    margin: 2rem 0 1rem;
    font-size: 1.8rem;
}

.blog-modal-text h3 {
    color: var(--amber);
    margin: 1.8rem 0 1rem;
    font-size: 1.5rem;
}

.blog-modal-text h4 {
    color: var(--neon-green);
    margin: 1.5rem 0 0.8rem;
    font-size: 1.2rem;
}

.blog-modal-text ul,
.blog-modal-text ol {
    margin: 1.5rem 0 2rem 2rem;
}

.blog-modal-text li {
    margin-bottom: 0.5rem;
}

.blog-modal-text blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid var(--neon-blue);
    font-style: italic;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.blog-modal-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
}

.blog-modal-cta {
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid rgba(0, 243, 255, 0.1);
}

.blog-modal-cta h3 {
    color: var(--neon-blue);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.blog-modal-cta .book-btn {
    margin-top: 1.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-magenta));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-modal-cta .book-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 243, 255, 0.3);
}

/* МОДАЛЬНОЕ ОКНО ВЫБОРА ТУРА ДЛЯ БРОНИРОВАНИЯ */
.booking-tour-modal .modal {
    max-width: 900px;
    padding: 2rem;
    padding-top: 3rem; /* Дополнительный отступ сверху для кнопки закрытия */
}

.booking-tour-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem;
}

.booking-tour-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.booking-tour-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    border-color: var(--neon-blue);
}

.booking-tour-card h4 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.booking-tour-price {
    color: var(--neon-green);
    font-size: 1.4rem;
    font-weight: 700;
}

.booking-tour-duration {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.booking-tour-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.booking-select-tour-btn {
    width: 100%;
    padding: 0.6rem;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--neon-blue);
    border-radius: var(--radius-sm);
    color: var(--neon-blue);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: auto;
}

.booking-select-tour-btn:hover {
    background: var(--neon-blue);
    color: white;
}

.booking-select-tour-btn.selected {
    background: var(--neon-green);
    border-color: var(--neon-green);
    color: var(--deep-space);
}

/* Кастомный скроллбар для модальных окон */
.tour-modal-scrollable::-webkit-scrollbar,
.blog-modal-scrollable::-webkit-scrollbar,
.booking-tour-cards-grid::-webkit-scrollbar {
    width: 4px;
}

.tour-modal-scrollable::-webkit-scrollbar-track,
.blog-modal-scrollable::-webkit-scrollbar-track,
.booking-tour-cards-grid::-webkit-scrollbar-track {
    background: rgba(10, 10, 15, 0.5);
}

.tour-modal-scrollable::-webkit-scrollbar-thumb,
.blog-modal-scrollable::-webkit-scrollbar-thumb,
.booking-tour-cards-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-magenta));
    border-radius: 2px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .tour-modal-details {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tour-modal-gallery {
        max-height: 350px;
    }

    .tour-modal-main-image {
        height: 200px;
    }
    
    .blog-modal-main-image {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .tour-modal-header,
    .blog-modal-header {
        padding: 0.8rem 1rem;
        padding-right: 50px;
    }
    
    .tour-modal-scrollable,
    .blog-modal-scrollable {
        padding: 1.5rem;
    }
    
    .tour-modal-title {
        font-size: 1.6rem;
    }
    
    .blog-modal-title {
        font-size: 1.8rem;
    }
    
    .blog-modal-main-image {
        height: 250px;
    }
    
    .tour-modal-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .blog-modal-thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
    
    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 1rem;
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 576px) {
    .modal-overlay {
        padding: 5px;
    }
    
    .tour-modal-header,
    .blog-modal-header {
        padding: 0.6rem 0.8rem;
        padding-right: 45px;
    }
    
    .tour-modal-back,
    .blog-modal-back {
        padding: 0.3rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .tour-modal-header-title {
        font-size: 1rem;
    }
    
    .tour-modal-scrollable,
    .blog-modal-scrollable {
        padding: 1rem;
    }
    
    .tour-modal-title {
        font-size: 1.4rem;
    }
    
    .blog-modal-title {
        font-size: 1.5rem;
    }
    
    .tour-modal-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .modal-dates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tour-modal-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tour-modal-main-image {
        height: 180px;
    }
    
    .blog-modal-main-image {
        height: 200px;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        top: 8px;
        right: 8px;
    }
}

@media (max-width: 400px) {
    .modal-dates-grid {
        grid-template-columns: 1fr;
    }
    
    .tour-modal-thumbnails {
        grid-template-columns: repeat(2, 1fr);
    }
}