/* Advanced Popup Newsletter Styles */
.apn-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.apn-overlay.show {
    opacity: 1;
}

.apn-popup {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    transition: transform 0.3s ease;
    position: relative;
}

.apn-overlay.show .apn-popup {
    transform: scale(1);
}

.apn-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
    border-bottom: 1px solid #eee;
}

.apn-popup-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.apn-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.apn-close-btn:hover {
    color: #333;
}

.apn-popup-body {
    padding: 20px;
}

.apn-popup-body p,
.apn-content-wrapper {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.apn-content-wrapper {
    /* Allow HTML content to be displayed properly */
}

.apn-content-wrapper h1,
.apn-content-wrapper h2,
.apn-content-wrapper h3 {
    color: #333;
    margin-bottom: 15px;
}

.apn-content-wrapper ul,
.apn-content-wrapper ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

.apn-content-wrapper li {
    margin-bottom: 8px;
}

.apn-content-wrapper strong {
    color: #333;
    font-weight: bold;
}

.apn-form {
    margin-top: 20px;
}

.apn-form-group {
    margin-bottom: 15px;
}

.apn-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.apn-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.apn-btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apn-btn:hover {
    transform: translateY(-1px);
}

.apn-btn:active {
    transform: translateY(0);
}

.apn-btn-primary {
    background-color: #007bff;
    color: white;
}

.apn-btn-primary:hover {
    background-color: #0056b3;
}

.apn-message {
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    font-weight: 500;
}

.apn-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.apn-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.apn-confirmation-popup {
    text-align: center;
}

.apn-confirmation-popup h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.apn-confirmation-popup p {
    margin-bottom: 25px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .apn-popup {
        width: 95%;
        margin: 10px;
    }
    
    .apn-popup-header {
        padding: 15px 15px 0;
    }
    
    .apn-popup-header h3 {
        font-size: 20px;
    }
    
    .apn-popup-body {
        padding: 15px;
    }
    
    .apn-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .apn-popup {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .apn-popup-header {
        padding: 20px 20px 10px;
    }
    
    .apn-popup-body {
        padding: 20px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Animation for popup appearance */
@keyframes apnSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.apn-popup {
    animation: apnSlideIn 0.3s ease-out;
}

/* Loading state */
.apn-btn.loading {
    position: relative;
    color: transparent;
}

.apn-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: apnSpin 0.8s linear infinite;
}

@keyframes apnSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility */
.apn-close-btn:focus,
.apn-btn:focus,
.apn-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .apn-popup {
        border: 2px solid #000;
    }
    
    .apn-input {
        border-width: 3px;
    }
}

/* Example custom CSS that users can modify */
/*
Example CSS to customize the popup:

.apn-popup {
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 3px solid #ff6b6b;
}

.apn-popup-header h3 {
    color: #ff6b6b;
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.apn-popup-body p {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.8;
}

.apn-btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    border: none;
    border-radius: 25px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.apn-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.apn-input {
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    font-size: 16px;
    padding: 15px;
}

.apn-input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

/* Animation for popup entrance */
@keyframes apnBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-100px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    70% {
        transform: scale(0.9) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.apn-popup {
    animation: apnBounceIn 0.6s ease-out;
}

/* Custom close button */
.apn-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ff6b6b;
    color: white;
    font-size: 20px;
}

.apn-close-btn:hover {
    background: #ff5252;
    transform: rotate(90deg);
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .apn-popup {
        width: 95%;
        max-width: none;
        margin: 10px;
    }
    
    .apn-popup-header h3 {
        font-size: 20px;
    }
    
    .apn-btn {
        padding: 15px;
        font-size: 18px;
    }
}
*/

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .apn-overlay,
    .apn-popup,
    .apn-btn,
    .apn-input,
    .apn-close-btn {
        transition: none;
    }
    
    .apn-popup {
        animation: none;
    }
}