/**
 * Popup System Styles
 * 
 * @package Zahyst_Maybutnogo
 */

/* Base Popup Wrapper */
.zm-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.zm-popup-wrapper.zm-popup-visible {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.zm-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Popup Container */
.zm-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.zm-popup-visible .zm-popup-container {
    transform: scale(1);
}

/* Position Classes */
.zm-popup-position-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
}

.zm-popup-visible .zm-popup-position-center {
    transform: translate(-50%, -50%) scale(1);
}

.zm-popup-position-top {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-top {
    transform: translateX(-50%) translateY(0) scale(1);
}

.zm-popup-position-bottom {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%) translateY(20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-bottom {
    transform: translateX(-50%) translateY(0) scale(1);
}

.zm-popup-position-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    transform: translate(-20px, -20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-top-left {
    transform: translate(0, 0) scale(1);
}

.zm-popup-position-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    transform: translate(20px, -20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-top-right {
    transform: translate(0, 0) scale(1);
}

.zm-popup-position-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
    transform: translate(-20px, 20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-bottom-left {
    transform: translate(0, 0) scale(1);
}

.zm-popup-position-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    transform: translate(20px, 20px) scale(0.8);
}

.zm-popup-visible .zm-popup-position-bottom-right {
    transform: translate(0, 0) scale(1);
}

/* Close Button */
.zm-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

.zm-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
    color: #000;
}

.zm-popup-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Popup Content */
.zm-popup-content {
    padding: 40px 30px 30px;
    line-height: 1.6;
}

.zm-popup-content > *:first-child {
    margin-top: 0;
}

.zm-popup-content > *:last-child {
    margin-bottom: 0;
}

/* Content Styling */
.zm-popup-content h1,
.zm-popup-content h2,
.zm-popup-content h3,
.zm-popup-content h4,
.zm-popup-content h5,
.zm-popup-content h6 {
    margin-top: 0;
    margin-bottom: 15px;
    line-height: 1.3;
}

.zm-popup-content p {
    margin-bottom: 15px;
}

.zm-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.zm-popup-content form {
    margin: 20px 0;
}

.zm-popup-content input[type="text"],
.zm-popup-content input[type="email"],
.zm-popup-content input[type="tel"],
.zm-popup-content input[type="url"],
.zm-popup-content textarea,
.zm-popup-content select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.zm-popup-content input:focus,
.zm-popup-content textarea:focus,
.zm-popup-content select:focus {
    outline: none;
    border-color: #007bff;
}

.zm-popup-content button[type="submit"],
.zm-popup-content input[type="submit"] {
    background: #007bff;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.zm-popup-content button[type="submit"]:hover,
.zm-popup-content input[type="submit"]:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* Animation: Fade */
.zm-animation-fade {
    animation: zmFadeIn 0.3s ease;
}

@keyframes zmFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation: Slide Up */
.zm-animation-slide-up {
    animation: zmSlideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zmSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation: Slide Down */
.zm-animation-slide-down {
    animation: zmSlideDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zmSlideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation: Slide Left */
.zm-animation-slide-left {
    animation: zmSlideLeft 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zmSlideLeft {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation: Slide Right */
.zm-animation-slide-right {
    animation: zmSlideRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zmSlideRight {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation: Zoom */
.zm-animation-zoom {
    animation: zmZoom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zmZoom {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animation: None */
.zm-animation-none {
    animation: none;
}

/* Scrollbar Styling */
.zm-popup-container::-webkit-scrollbar {
    width: 8px;
}

.zm-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 12px 12px 0;
}

.zm-popup-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.zm-popup-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
    .zm-popup-container {
        max-width: 95% !important;
        width: 95% !important;
        max-height: 85vh;
        border-radius: 8px;
    }

    .zm-popup-content {
        padding: 35px 20px 20px;
    }

    .zm-popup-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    /* Adjust positions for mobile */
    .zm-popup-position-top-left,
    .zm-popup-position-top-right,
    .zm-popup-position-bottom-left,
    .zm-popup-position-bottom-right {
        left: 2.5%;
        right: auto;
        width: 95%;
    }

    .zm-popup-position-top-left,
    .zm-popup-position-top-right {
        top: 10px;
    }

    .zm-popup-position-bottom-left,
    .zm-popup-position-bottom-right {
        bottom: 10px;
    }
}

@media screen and (max-width: 480px) {
    .zm-popup-content h1 {
        font-size: 24px;
    }

    .zm-popup-content h2 {
        font-size: 20px;
    }

    .zm-popup-content h3 {
        font-size: 18px;
    }

    .zm-popup-content {
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .zm-popup-container {
        background: #1e1e1e;
        color: #ffffff;
    }

    .zm-popup-close {
        background: rgba(255, 255, 255, 0.05);
        color: #ffffff;
    }

    .zm-popup-close:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .zm-popup-content input[type="text"],
    .zm-popup-content input[type="email"],
    .zm-popup-content input[type="tel"],
    .zm-popup-content input[type="url"],
    .zm-popup-content textarea,
    .zm-popup-content select {
        background: #2a2a2a;
        border-color: #444;
        color: #ffffff;
    }

    .zm-popup-container::-webkit-scrollbar-track {
        background: #2a2a2a;
    }

    .zm-popup-container::-webkit-scrollbar-thumb {
        background: #555;
    }

    .zm-popup-container::-webkit-scrollbar-thumb:hover {
        background: #777;
    }
}

/* Accessibility */
.zm-popup-wrapper[aria-hidden="true"] {
    display: none;
}

/* Print */
@media print {
    .zm-popup-wrapper {
        display: none !important;
    }
}

/* Performance Optimization */
.zm-popup-wrapper * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus trap for accessibility */
.zm-popup-wrapper:focus-within {
    outline: none;
}

/* Custom utility classes */
.zm-popup-content .text-center {
    text-align: center;
}

.zm-popup-content .text-right {
    text-align: right;
}

.zm-popup-content .text-left {
    text-align: left;
}

.zm-popup-content .mb-0 {
    margin-bottom: 0 !important;
}

.zm-popup-content .mt-0 {
    margin-top: 0 !important;
} 