/* Основные стили виджета */
.dienstleistungen-widget {
    margin: 20px 0;
}

.dienstleistungen-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-align: center;
}

.dienstleistungen-description {
    font-size: 1.1em;
    text-align: center;
    margin-bottom: 30px;
    opacity: 0.8;
}

/* Сетка услуг */
.dienstleistungen-grid {
    display: grid;
    gap: 30px;
    margin: 20px 0;
}

.dienstleistungen-grid.columns-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.dienstleistungen-grid.columns-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dienstleistungen-grid.columns-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Карточки услуг */
.service-card {
    position: relative;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    height: 280px;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.service-image {
    position: relative;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

.service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.service-card:hover .service-image img {
    transform: scale(1.08);
}

/* Градиентный оверлей */
.service-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.1) 40%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.service-card:hover .service-image::after {
    opacity: 0.9;
}

/* Контент карточки */
.service-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 25px 20px 20px;
    color: white;
    z-index: 2;
	width: 100%;
	height: 100%;
	text-align: center;
}

.service-title {
    font-size: 1.4em!important;
    margin: 0 0 8px 0!important;
    color: white!important;
    line-height: 1.2!important;
}

.service-excerpt {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    margin: 0 0 15px 0;
    font-size: 0.9em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease 0.1s;
}

.service-card:hover .service-excerpt {
    opacity: 1;
    transform: translateY(0);
}

/* Кнопка "Подробнее" */
.service-more-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.service-card:hover .service-more-btn {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.service-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.service-more-btn:hover::before {
    left: 100%;
}

.service-more-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Попап-окно */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.popup-container {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popupAppear 0.3s ease-out;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-content-wrapper {
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.popup-header h2 {
    margin: 0;
    font-size: 1.8em!important;
}

.popup-close {
    background: none;
    border: none!important;
    font-size: 40px!important;
    color: #999;
    cursor: pointer;
    padding: 0!important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center; 
    transition: all 0.3s ease;
}

.popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Галерея в попапе */
.popup-gallery {
    position: relative;
    margin-bottom: 30px;
}

.gallery-slider {
    position: relative;
    height: 300px;
    overflow: hidden;
    border-radius: 0;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-slide.active {
    opacity: 1;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.gallery-prev,
.gallery-next {
     background: white !important;
    border: none;
    width: 50px; 
    border-radius: 50%;
    font-size: 60px !important;
    cursor: pointer; 
    pointer-events: all; 
    color: #A57E60 !important;
    line-height: 30px !important;
    padding: 0 !important;
    display: block;
    padding-bottom: 18px !important;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: white;
    transform: scale(1.1);
}

/* Описания в попапе */
.popup-descriptions {
    padding: 30px;
}

.description-block {
    margin-bottom: 25px;
}

.description-block:last-child {
    margin-bottom: 0;
}

.description-block h3 {
    font-size: 1.4em!important;
    margin: 0 0 15px 0; 
}

.description-block p {
    line-height: 1.7;
    color: #555;
    margin: 0;
    font-size: 1em;
}

/* Адаптивность */
@media (max-width: 768px) {
    .dienstleistungen-grid.columns-3,
    .dienstleistungen-grid.columns-4 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .dienstleistungen-grid.columns-2 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .service-card {
        height: 250px;
    }
    
    .service-content {
        padding: 20px 15px 15px;
    }
    
    .service-title {
        font-size: 1.2em;
    }
    
    .service-excerpt {
        font-size: 0.85em;
        margin: 0 0 12px 0;
    }
    
    .service-more-btn {
        padding: 10px 20px;
        font-size: 0.85em;
    }
    
    .popup-container {
        margin: 10px;
        max-height: 95vh;
    }
    
    .popup-header {
        padding: 20px;
    }
    
    .popup-header h2 {
        font-size: 1.5em;
    }
    
    .popup-descriptions {
        padding: 20px;
    }
    
    .gallery-slider {
        height: 250px;
    }
    
    .gallery-nav {
        padding: 0 10px;
    }
    
    .gallery-prev,
    .gallery-next {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .dienstleistungen-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .service-card {
        height: 220px;
    }
    
    .dienstleistungen-title {
        font-size: 2em;
    }
    
    .service-content {
        padding: 15px 12px 12px;
    }
    
    .service-title {
        font-size: 1.1em;
        margin: 0 0 6px 0;
    }
    
    .service-excerpt {
        font-size: 0.8em;
        margin: 0 0 10px 0;
    }
    
    .service-more-btn {
        padding: 8px 16px;
        font-size: 0.8em;
    }
    
    /* Мобильные карточки - показывать кнопку всегда */
    .service-excerpt {
        opacity: 1;
        transform: translateY(0);
    }
    
    .service-more-btn {
        opacity: 1;
        transform: translateY(0);
    }
    
    .popup-header {
        padding: 15px;
    }
    
    .popup-descriptions {
        padding: 15px;
    }
    
    .gallery-slider {
        height: 200px;
    }
}

/* Анимации загрузки карточек */
.service-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.service-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Дополнительные эффекты при наведении */
@media (min-width: 769px) {
    .service-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(0deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.7));
        opacity: 1;
        transition: opacity 0.3s ease;
        z-index: 1;
        pointer-events: none;
    }
    
    .service-card:hover::before {
		background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.4));
    }
}

/* Улучшенная типографика */
.service-title {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
	text-align: center;
}

/* Дополнительные стили для админки */
.gallery-placeholder {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    height: 150px;
    width: 150px;
    display: inline-block;
    margin: 5px;
}

/* Улучшение accessibility */
.service-more-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.popup-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Плавная прокрутка для popup */
.popup-content-wrapper {
    scroll-behavior: smooth;
}