/**
 * GHOUD MailChimp Popup Styles
 * Properly positions popup overlay and container
 */

/* Overlay - Full screen backdrop */
.ghoud-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.ghoud-popup-overlay.active {
    display: flex;
    opacity: 1;
}

/* Container - Centered popup box */
.ghoud-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
    z-index: 1000000;
}

.ghoud-popup-overlay.active .ghoud-popup-container {
    transform: scale(1);
}

/* Close button */
.ghoud-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    z-index: 1000001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.ghoud-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #000;
    transform: rotate(90deg);
}

.ghoud-popup-close:focus {
    outline: 2px solid #00c3ff;
    outline-offset: 2px;
}

/* Content area */
.ghoud-popup-content {
    padding: 40px 30px 30px;
    position: relative;
}

/* Form container */
#ghoud-popup-form-container {
    position: relative;
}

.ghoud-popup-form {
    display: none;
}

.ghoud-popup-form.active {
    display: block;
}

/* Success state */
.ghoud-popup-container.ghoud-popup-success {
    animation: successPulse 0.5s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Form styling improvements */
.ghoud-popup-content form {
    margin: 0;
}

.ghoud-popup-content .mc4wp-form {
    margin: 0;
}

.ghoud-popup-content .mc4wp-form-fields {
    margin: 0;
}

.ghoud-popup-content .mc4wp-form-fields p {
    margin-bottom: 20px;
}

.ghoud-popup-content .mc4wp-form-fields label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.ghoud-popup-content .mc4wp-form-fields input[type="email"],
.ghoud-popup-content .mc4wp-form-fields input[type="text"],
.ghoud-popup-content .mc4wp-form-fields input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ghoud-popup-content .mc4wp-form-fields input[type="email"]:focus,
.ghoud-popup-content .mc4wp-form-fields input[type="text"]:focus,
.ghoud-popup-content .mc4wp-form-fields input[type="tel"]:focus {
    outline: none;
    border-color: #00c3ff;
}

.ghoud-popup-content .mc4wp-form-fields input[type="submit"],
.ghoud-popup-content .mc4wp-form-fields button[type="submit"] {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #ff6400 0%, #ff8533 100%);
    border: 2px solid #ff6400;
    border-radius: 6px;
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.ghoud-popup-content .mc4wp-form-fields input[type="submit"]:hover,
.ghoud-popup-content .mc4wp-form-fields button[type="submit"]:hover {
    background: linear-gradient(135deg, #ff8533 0%, #ff6400 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 100, 0, 0.3);
}

.ghoud-popup-content .mc4wp-form-fields input[type="submit"]:disabled,
.ghoud-popup-content .mc4wp-form-fields button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading state */
.ghoud-popup-content form.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Error and success messages */
.ghoud-form-error,
.ghoud-form-success {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
}

.ghoud-form-error {
    background: rgba(255, 100, 0, 0.1);
    border: 2px solid #ff6400;
    color: #ff6400;
    box-shadow: 0 0 15px rgba(255, 100, 0, 0.3);
}

.ghoud-form-success {
    background: rgba(0, 195, 255, 0.1);
    border: 2px solid #00c3ff;
    color: #00c3ff;
    box-shadow: 0 0 15px rgba(0, 195, 255, 0.3);
}

/* MailChimp response messages */
.ghoud-popup-content .mc4wp-response {
    margin-top: 20px;
}

.ghoud-popup-content .mc4wp-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ghoud-popup-content .mc4wp-alert.mc4wp-success {
    background: rgba(0, 195, 255, 0.1);
    border: 2px solid #00c3ff;
    color: #00c3ff;
}

.ghoud-popup-content .mc4wp-alert.mc4wp-error {
    background: rgba(255, 100, 0, 0.1);
    border: 2px solid #ff6400;
    color: #ff6400;
}

/* Prevent body scroll when popup is open */
body.ghoud-popup-open {
    overflow: hidden !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .ghoud-popup-overlay {
        padding: 10px;
    }
    
    .ghoud-popup-container {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .ghoud-popup-content {
        padding: 30px 20px 20px;
    }
    
    .ghoud-popup-close {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .ghoud-popup-content {
        padding: 25px 15px 15px;
    }
    
    .ghoud-popup-content .mc4wp-form-fields input[type="email"],
    .ghoud-popup-content .mc4wp-form-fields input[type="text"],
    .ghoud-popup-content .mc4wp-form-fields input[type="tel"] {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .ghoud-popup-content .mc4wp-form-fields input[type="submit"],
    .ghoud-popup-content .mc4wp-form-fields button[type="submit"] {
        font-size: 14px;
        padding: 12px 15px;
    }
}

/* Animation for form loading */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
