/* Slate PopUp Styles */

.slate-popup-wrapper {
    display: inline-block;
}

.slate-popup-trigger-button {
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 0;
}

/* Button types */
.slate-popup-trigger-button.btn-type-filled {
    border: none;
}

.slate-popup-trigger-button.btn-type-outline {
    background-color: transparent !important;
    border-style: solid;
}

.slate-popup-trigger-button.btn-type-ghost {
    background-color: transparent !important;
    border-style: solid;
    box-shadow: none;
}

.slate-popup-trigger-button.btn-type-link {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none;
    text-decoration: underline;
}

.slate-popup-trigger-button.btn-type-link:hover {
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

/* Icon positioning */
.slate-popup-trigger-button .slate-trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.slate-popup-trigger-button .slate-trigger-icon svg,
.slate-popup-trigger-button .slate-trigger-icon i {
    display: block;
    width: 1em;
    height: 1em;
}

/* Full width wrapper */
.slate-popup-wrapper.btn-full-width {
    display: block;
}

.slate-popup-trigger-image {
    cursor: pointer;
    display: inline-block;
    line-height: 0;
}

.slate-popup-trigger-image img {
    display: block;
    width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

.slate-popup-trigger-image:hover img {
    opacity: 0.8;
}

/* Overlay */
.slate-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    overflow: auto;
    padding: 20px;
}

.slate-popup-overlay.active {
    display: flex;
}

.slate-popup-overlay[data-position="center"] {
    align-items: center;
    justify-content: center;
}

.slate-popup-overlay[data-position="bottom"] {
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0;
}

/* Content */
.slate-popup-content {
    position: relative;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0; /* Скрываем до анимации */
    visibility: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Когда overlay активен - показываем контент */
.slate-popup-overlay.active .slate-popup-content {
    opacity: 1;
    visibility: visible;
}

.slate-popup-overlay[data-position="bottom"] .slate-popup-content {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    max-height: 90vh;
}

.slate-popup-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.slate-popup-overlay[data-position="bottom"] .slate-popup-body {
    max-height: calc(90vh - 40px);
}

/* Close Button */
.slate-popup-close {
    position: absolute;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    top: 10px;
}

/* Left side */
.slate-popup-close-left {
    left: 10px;
    right: auto;
}

/* Right side */
.slate-popup-close-right {
    right: 10px;
    left: auto;
}

.slate-popup-close:hover {
    transform: rotate(90deg);
}

/* Image */
.slate-popup-image-wrapper {
    line-height: 0;
    text-align: center;
}

.slate-popup-image {
    height: auto;
    display: inline-block;
    margin: 0 auto;
}

/* Title */
.slate-popup-title {
    font-size: 28px;
    font-weight: bold;
    padding: 0 20px;
    margin: 20px 0;
}

/* Text */
.slate-popup-text {
    padding: 0 20px;
    margin: 15px 0;
    line-height: 1.6;
}

/* Buttons */
.slate-popup-buttons {
    display: flex;
    gap: 15px;
    padding: 20px;
    flex-wrap: wrap;
}

.slate-popup-button {
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.slate-popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* Shortcode block */
.slate-popup-shortcode {
    padding: 0 20px 10px;
}

.slate-popup-shortcode > * {
    max-width: 100%;
}

@media (max-width: 767px) {
    .slate-popup-shortcode {
        padding: 0 15px 10px;
    }
}

/* Progress Bar */
.slate-carousel-progressbar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}

.slate-carousel-progressbar-fill {
    height: 100%;
    background: #0073aa;
    transition: width 0.3s ease;
    width: 0%;
}

/* Grid Layout for Multiple Slides */
.slate-popup-carousel.grid-mode {
    display: grid;
    gap: 10px;
}

.slate-popup-carousel.grid-mode .slate-popup-carousel-slide {
    display: block !important;
}

.slate-popup-carousel.grid-mode .slate-carousel-prev,
.slate-popup-carousel.grid-mode .slate-carousel-next {
    display: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 0;
        transform: scale(1.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes rotate {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes bounce {
    0% {
        opacity: 0;
        transform: translateY(-100px);
    }
    50% {
        transform: translateY(10px);
    }
    70% {
        transform: translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flip {
    from {
        opacity: 0;
        transform: rotateY(-180deg);
    }
    to {
        opacity: 1;
        transform: rotateY(0);
    }
}


.slate-popup-content.fadeIn {
    animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.slideDown {
    animation: slideDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.slideUp {
    animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.slideLeft {
    animation: slideLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.slideRight {
    animation: slideRight 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.zoomIn {
    animation: zoomIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.zoomOut {
    animation: zoomOut 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.rotate {
    animation: rotate 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.bounce {
    animation: bounce 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.flip {
    animation: flip 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.slate-popup-content.flip {
    animation: flip 0.7s ease-out;
}

/* Responsive */
@media (max-width: 1024px) {
    .slate-popup-title {
        font-size: 24px;
    }
}

@media (max-width: 767px) {
    .slate-popup-title {
        font-size: 22px;
        padding: 0 15px;
    }
    
    .slate-popup-text {
        padding: 0 15px;
        font-size: 14px;
    }
    
    .slate-popup-buttons {
        padding: 15px;
        flex-direction: column;
    }
    
    .slate-popup-button {
        width: 100% !important;
    }

    /* Trigger button full width on mobile */
    .slate-popup-trigger-button.slate-trigger-mobile-fw {
        width: 100%;
        display: block;
    }

    /* Мобильное закругление — переопределяет bottom-popup правило если задано */
    .slate-popup-overlay[data-position="bottom"] .slate-popup-content.has-mobile-radius {
        border-bottom-left-radius: var(--slate-mobile-radius, 0px) !important;
        border-bottom-right-radius: var(--slate-mobile-radius, 0px) !important;
    }
}

@media (max-width: 480px) {
    .slate-popup-overlay {
        padding: 10px;
    }
    
    .slate-popup-overlay[data-position="bottom"] {
        padding-bottom: 0;
    }
    
    .slate-popup-close {
        width: 28px !important;
        height: 28px !important;
        font-size: 18px !important;
    }
}
