/**
 * Popup Ads CSS
 * Styling cho popup quảng cáo trang chủ
 */

/* Overlay */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none;
    backdrop-filter: blur(2px);
}

/* Popup Container */
.popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    width: 500px;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animation khi hiển thị */
.popup-container.popup-show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Close Button */
.popup-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #666;
}

.popup-close-btn:hover {
    background: rgba(255, 0, 0, 0.1);
    color: #ff0000;
    transform: scale(1.1);
}

.popup-close-btn i {
    font-size: 14px;
}

/* Popup Content */
.popup-content {
    padding: 30px;
    text-align: center;
    position: relative;
}

/* Title */
.popup-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0 0 20px 0;
    line-height: 1.3;
}

/* Image */
.popup-image {
    margin-bottom: 20px;
}

.popup-image img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
}

/* Body Content */
.popup-body {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 0;
}

.popup-body p {
    margin-bottom: 15px;
}

.popup-body p:last-child {
    margin-bottom: 0;
}

.popup-body a {
    color: #007cba;
    text-decoration: none;
}

.popup-body a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        max-width: 400px;
        margin: 0 10px;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .popup-content {
        padding: 20px;
    }
    
    .popup-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    .popup-body {
        font-size: 14px;
    }
    
    .popup-close-btn {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
    }
    
    .popup-close-btn i {
        font-size: 12px;
    }
    
    .popup-image img {
        max-height: 40vh;
    }
}

@media (max-width: 480px) {
    .popup-container {
        width: 98%;
        max-width: 350px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .popup-content {
        padding: 15px;
    }
    
    .popup-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .popup-body {
        font-size: 13px;
    }
    
    .popup-image img {
        max-height: 35vh;
    }
}

/* Animation cho mobile */
@media (max-width: 768px) {
    .popup-container {
        transform: translate(-50%, -50%) scale(0.8);
    }
    
    .popup-container.popup-show {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Hover effect khi có link */
.popup-content[style*="cursor: pointer"]:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Loading animation nếu cần */
.popup-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .popup-container {
        background: #2c2c2c;
        color: #ffffff;
    }
    
    .popup-title {
        color: #ffffff;
    }
    
    .popup-body {
        color: #cccccc;
    }
    
    .popup-close-btn {
        background: rgba(255, 255, 255, 0.1);
        color: #cccccc;
    }
    
    .popup-close-btn:hover {
        background: rgba(255, 0, 0, 0.2);
        color: #ff6666;
    }
}

/* Body scroll lock when popup is open */
body.overlay-open {
    overflow: hidden;
}

/* Accessibility */
.popup-container:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.popup-close-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .popup-overlay {
        background-color: rgba(0, 0, 0, 0.9);
    }
    
    .popup-container {
        border: 2px solid #000000;
    }
    
    .popup-close-btn {
        border: 1px solid #000000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .popup-container {
        transition: opacity 0.2s ease;
        transform: translate(-50%, -50%) scale(1);
    }
    
    .popup-container.popup-show {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .popup-close-btn {
        transition: background-color 0.2s ease;
    }
    
    .popup-close-btn:hover {
        transform: none;
    }
}
