/**
 * Country Based Smart Popup Styles
 * 
 * These styles provide the base layout and animations for the popup.
 * Many properties can be overridden by Elementor style controls.
 */

/* Popup Overlay */
.country-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

/* Show state */
.country-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Popup Content Container */
.country-popup-content {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 30px;
    position: relative;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: scale(0.8) translateY(-50px);
    transition: transform 0.3s ease;
    color: #333333;
}

/* Content animation when shown */
.country-popup-overlay.show .country-popup-content {
    transform: scale(1) translateY(0);
}

/* Close Button */
.country-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666666;
    cursor: pointer;
    padding: 5px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.country-popup-close:hover,
.country-popup-close:focus {
    color: #333333;
    background-color: rgba(0, 0, 0, 0.05);
    outline: none;
}

.country-popup-close:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 186, 0.3);
}

/* Header Section */
.country-popup-header {
    margin-bottom: 25px;
    padding-right: 30px; /* Space for close button */
}

/* Heading */
.country-popup-heading {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    color: inherit;
}

/* Description */
.country-popup-description {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: inherit;
    opacity: 0.8;
}

/* Buttons Container */
.country-popup-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Individual Buttons */
.country-popup-button {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background-color: #007cba;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    text-align: center;
    line-height: 1.4;
}

.country-popup-button:hover {
    background-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 186, 0.3);
}

.country-popup-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 123, 186, 0.2);
}

.country-popup-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.3);
}

/* Button Variants */
.country-popup-button-us {
    /* Specific styles for US button if needed */
}

.country-popup-button-canada {
    /* Specific styles for Canada button if needed */
}

/* Responsive Design */
@media (max-width: 768px) {
    .country-popup-overlay {
        padding: 15px;
    }
    
    .country-popup-content {
        padding: 25px 20px;
        max-width: none;
        margin: 0;
    }
    
    .country-popup-header {
        padding-right: 25px;
        margin-bottom: 20px;
    }
    
    .country-popup-heading {
        font-size: 20px;
    }
    
    .country-popup-description {
        font-size: 14px;
    }
    
    .country-popup-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .country-popup-button {
        min-width: auto;
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .country-popup-overlay {
        padding: 10px;
    }
    
    .country-popup-content {
        padding: 20px 15px;
    }
    
    .country-popup-header {
        padding-right: 20px;
    }
    
    .country-popup-close {
        top: 10px;
        right: 10px;
        font-size: 20px;
        width: 30px;
        height: 30px;
    }
    
    .country-popup-heading {
        font-size: 18px;
    }
    
    .country-popup-description {
        font-size: 14px;
        line-height: 1.4;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .country-popup-content {
        border: 2px solid #000000;
    }
    
    .country-popup-button {
        border: 2px solid transparent;
    }
    
    .country-popup-button:focus {
        border-color: #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .country-popup-overlay,
    .country-popup-content,
    .country-popup-close,
    .country-popup-button {
        transition: none;
    }
    
    .country-popup-content {
        transform: none;
    }
    
    .country-popup-overlay.show .country-popup-content {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .country-popup-overlay {
        display: none !important;
    }
}

/* Focus Management */
.country-popup-overlay * {
    outline-offset: 2px;
}

/* RTL Support */
[dir="rtl"] .country-popup-close {
    right: auto;
    left: 15px;
}

[dir="rtl"] .country-popup-header {
    padding-right: 0;
    padding-left: 30px;
}

@media (max-width: 768px) {
    [dir="rtl"] .country-popup-header {
        padding-left: 25px;
    }
}

@media (max-width: 480px) {
    [dir="rtl"] .country-popup-close {
        left: 10px;
    }
    
    [dir="rtl"] .country-popup-header {
        padding-left: 20px;
    }
}

/* Animation Keyframes */
@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popupSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
}

/* Loading State (for future enhancement) */
.country-popup-loading {
    position: relative;
}

.country-popup-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .country-popup-content {
        background-color: #2c2c2c;
        color: #ffffff;
    }
    
    .country-popup-close {
        color: #cccccc;
    }
    
    .country-popup-close:hover,
    .country-popup-close:focus {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .country-popup-description {
        opacity: 0.9;
    }
}