/* Popup Main Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transition: transform 0.3s ease;
    transform: scale(0.8);
    /* Custom scrollbar for webkit browsers */
    scrollbar-width: thin;
    scrollbar-color: #007bff #f1f1f1;
}

.popup-overlay.active .popup-container {
    transform: scale(1);
}

.popup-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.popup-content {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #28a745 #f8f9fa;
}

/* Popup Images */
.popup-image {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Image Positions */
.popup-image-top {
    margin-bottom: 15px;
}

.popup-image-bottom {
    margin-top: 15px;
}

.popup-with-image-left,
.popup-with-image-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.popup-with-image-left .popup-image,
.popup-with-image-right .popup-image {
    flex: 0 0 auto;
    max-width: 45%;
    object-fit: contain;
}

.popup-with-image-left .popup-text,
.popup-with-image-right .popup-text {
    flex: 1;
}

/* Image Only Mode */
.popup-image-only {
    padding: 0;
    overflow: hidden;
}

.popup-image-only .popup-header {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    z-index: 1;
}

.popup-image-only .popup-title {
    display: none;
}

.popup-image-only .popup-content {
    padding: 0;
}

.popup-image-only .popup-image {
    width: 100%;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
}

/* Background Image Mode */
.popup-with-background-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
}

.popup-with-background-image .popup-content {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 0 0 15px 15px;
}

.popup-with-background-image .popup-header {
    background-color: rgba(0, 0, 0, 0.5);
    border-bottom-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Close Button */
.popup-close {
    background: linear-gradient(45deg, #dc3545, #c82333);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220,53,69,0.3);
}

.popup-close:hover {
    background: linear-gradient(45deg, #c82333, #a71e2a);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(220,53,69,0.5);
}

.popup-image-only .popup-close {
    color: #fff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
    font-size: 2rem;
    padding: 10px;
    background: rgba(220,53,69,0.8);
}

/* Position Styles */
.popup-container[data-position="top"] {
    margin-top: 50px;
    align-self: flex-start;
}

.popup-container[data-position="bottom"] {
    margin-bottom: 50px;
    align-self: flex-end;
}

.popup-container[data-position="top-left"] {
    margin-top: 50px;
    margin-left: 50px;
    align-self: flex-start;
}

.popup-container[data-position="top-right"] {
    margin-top: 50px;
    margin-right: 50px;
    align-self: flex-start;
}

.popup-container[data-position="bottom-left"] {
    margin-bottom: 50px;
    margin-left: 50px;
    align-self: flex-end;
}

.popup-container[data-position="bottom-right"] {
    margin-bottom: 50px;
    margin-right: 50px;
    align-self: flex-end;
}

/* Popup Custom Scrollbar Styles */

.popup-container::-webkit-scrollbar {
    width: 8px;
}

.popup-container::-webkit-scrollbar-track {
    background: linear-gradient(90deg, #f1f1f1, #e8e8e8);
    border-radius: 10px;
    box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
}

.popup-container::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.popup-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    transform: scale(1.1);
}

.popup-container::-webkit-scrollbar-thumb:active {
    background: linear-gradient(45deg, #004085, #002752);
}

/* Popup Content Scrollbar */
.popup-content {
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #28a745 #f8f9fa;
}

.popup-content::-webkit-scrollbar {
    width: 6px;
}

.popup-content::-webkit-scrollbar-track {
    background: linear-gradient(90deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    margin: 5px 0;
}

.popup-content::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #28a745, #20c997);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Animated Scrollbar */
@keyframes scrollGlow {
    0% { box-shadow: 0 0 5px rgba(0,123,255,0.3); }
    50% { box-shadow: 0 0 15px rgba(0,123,255,0.6); }
    100% { box-shadow: 0 0 5px rgba(0,123,255,0.3); }
}

.popup-container::-webkit-scrollbar-thumb:hover {
    animation: scrollGlow 2s infinite;
}

/* Modern Popup Enhancements */
.popup-overlay {
    backdrop-filter: blur(5px);
    background: rgba(0,0,0,0.6);
}

.popup-container {
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
}

.popup-image {
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    cursor: pointer;
}

.popup-close {
    background: linear-gradient(45deg, #dc3545, #c82333);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220,53,69,0.3);
}

.popup-close:hover {
    background: linear-gradient(45deg, #c82333, #a71e2a);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(220,53,69,0.5);
}

/* Responsive Scrollbar */
@media (max-width: 768px) {
    .popup-container::-webkit-scrollbar {
        width: 6px;
    }
    
    .popup-content::-webkit-scrollbar {
        width: 4px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .popup-with-image-left,
    .popup-with-image-right {
        flex-direction: column;
    }
    
    .popup-with-image-left .popup-image,
    .popup-with-image-right .popup-image {
        max-width: 100%;
        margin: 0 0 15px 0;
    }
    
    .popup-with-image-right .popup-image {
        order: 1;
    }
    
    .popup-with-image-right .popup-text {
        order: 2;
    }
    
    .popup-container {
        max-width: 95%;
        margin: 20px;
    }
    
    .popup-container::-webkit-scrollbar {
        width: 6px;
    }
    
    .popup-content::-webkit-scrollbar {
        width: 4px;
    }
}