/* Callback Popup Styles - Theme Integrated */

/* CSS Custom Properties for easy customization */
.callback-popup-overlay {
    --popup-primary-color: #007cba; /* Primary button color - change this to match your theme */
    --popup-primary-hover: #005a87; /* Primary hover color */
    --popup-secondary-color: #6c757d; /* Secondary text color */
    --popup-success-color: #28a745; /* Success message color */
    --popup-error-color: #dc3545; /* Error message color */
    --popup-background: #ffffff; /* Popup background */
    --popup-border-radius: 12px; /* Border radius for modern look */
    --popup-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); /* Shadow for depth */
    --popup-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth transitions */
}

/* Overlay */
.callback-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--popup-transition);
}

.callback-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container */
.callback-popup-container {
    background: var(--popup-background);
    border-radius: var(--popup-border-radius);
    box-shadow: var(--popup-shadow);
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: var(--popup-transition);
}

.callback-popup-overlay.active .callback-popup-container {
    transform: scale(1) translateY(0);
}

/* Header */
.callback-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--popup-border-radius) var(--popup-border-radius) 0 0;
}

.callback-popup-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #212529;
    letter-spacing: -0.025em;
}

.callback-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--popup-secondary-color);
    padding: 8px;
    border-radius: 6px;
    transition: var(--popup-transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.callback-popup-close:hover {
    color: #495057;
    border-color: #adb5bd;
    background-color: #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Content */
.callback-popup-content {
    padding: 28px;
}

/* Form Container */
.callback-popup-form {
    margin: 0;
}

/* CF7 Form Styling */
.callback-popup-content .wpcf7 {
    margin: 0;
}

.callback-popup-content .wpcf7-form p {
    margin-bottom: 20px;
}

.callback-popup-content .wpcf7-form p:last-child {
    margin-bottom: 0;
}

.callback-popup-content .wpcf7-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.callback-popup-content .wpcf7-form input[type="text"],
.callback-popup-content .wpcf7-form input[type="tel"],
.callback-popup-content .wpcf7-form input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: var(--popup-transition);
    background: #ffffff;
    color: #212529;
}

.callback-popup-content .wpcf7-form input[type="text"]:focus,
.callback-popup-content .wpcf7-form input[type="tel"]:focus,
.callback-popup-content .wpcf7-form input[type="email"]:focus {
    border-color: var(--popup-primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.callback-popup-content .wpcf7-form .wpcf7-submit,
.callback-popup-form input[type="submit"] {
    background: var(--popup-primary-color);
    color: #ffffff;
    border: none;
    /* padding: 14px 28px; */
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    transition: var(--popup-transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 50px;
    line-height: 43px;
    outline: none;
}

.callback-popup-content .wpcf7-form .wpcf7-submit:hover,
.callback-popup-form input[type="submit"]:hover {
    background: var(--popup-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.callback-popup-content .wpcf7-form .wpcf7-submit:disabled,
.callback-popup-form input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* CF7 Response Messages */
.callback-popup-content .wpcf7-response-output {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
}

.callback-popup-content .wpcf7-response-output.wpcf7-mail-sent-ok {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.callback-popup-content .wpcf7-response-output.wpcf7-validation-errors {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Fallback Form Styling */
.callback-popup-form p {
    margin-bottom: 20px;
}

.callback-popup-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.callback-popup-form input[type="text"],
.callback-popup-form input[type="tel"],
.callback-popup-form input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: var(--popup-transition);
    background: #ffffff;
    color: #212529;
}

.callback-popup-form input[type="text"]:focus,
.callback-popup-form input[type="tel"]:focus,
.callback-popup-form input[type="email"]:focus {
    border-color: var(--popup-primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Message Styles */
.callback-popup-message {
    padding: 20px;
    border-radius: 8px;
    /* margin-top: 16px; */
    text-align: center;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.callback-popup-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.callback-popup-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.callback-popup-message-close {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(21, 87, 36, 0.3);
    color: #155724;
    cursor: pointer;
    font-size: 16px;
    margin-top: 12px;
    /* padding: 8px 16px; */
    border-radius: 6px;
    transition: var(--popup-transition);
}

.callback-popup-message-close:hover {
    color: #ffffff;
    border-color: #155724;
    background-color: #155724;
    box-shadow: 0 2px 8px rgba(21, 87, 36, 0.3);
}

/* Error message close button styling */
.callback-popup-message-error .callback-popup-message-close {
    border-color: rgba(220, 53, 69, 0.3);
    color: #721c24;
}

.callback-popup-message-error .callback-popup-message-close:hover {
    color: #ffffff;
    border-color: #dc3545;
    background-color: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .callback-popup-container {
        width: 95%;
        margin: 20px;
        max-height: 90vh;
    }

    .callback-popup-header {
        padding: 20px 24px 16px;
    }

    .callback-popup-header h3 {
        font-size: 20px;
    }

    .callback-popup-content {
        padding: 24px 20px;
    }

    .callback-popup-close {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .callback-popup-header {
        padding: 16px 20px 12px;
    }

    .callback-popup-header h3 {
        font-size: 18px;
    }

    .callback-popup-content {
        padding: 20px 16px;
    }

    .callback-popup-content .wpcf7-form input[type="text"],
    .callback-popup-content .wpcf7-form input[type="tel"],
    .callback-popup-content .wpcf7-form input[type="email"],
    .callback-popup-form input[type="text"],
    .callback-popup-form input[type="tel"],
    .callback-popup-form input[type="email"] {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .callback-popup-content .wpcf7-form .wpcf7-submit,
    .callback-popup-form input[type="submit"] {
        /* padding: 16px 24px; */
        font-size: 16px;
    }
}

/* Loading state */
.callback-popup-container.submitting {
    pointer-events: none;
}

.callback-popup-container.submitting::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.callback-popup-container.submitting::before {
    content: "";
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--popup-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Focus states for accessibility */
.callback-popup-close:focus,
.callback-popup-content .wpcf7-form input:focus,
.callback-popup-form input:focus,
.callback-popup-message-close:focus {
    outline: 2px solid var(--popup-primary-color);
    outline-offset: 2px;
}

/* Phone validation error styling */
.phone-validation-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    font-weight: 500;
    animation: fadeInError 0.3s ease-out;
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Valid phone input styling */
.callback-popup-content .wpcf7-form input[type="tel"]:valid,
.callback-popup-form input[type="tel"]:valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25) !important;
}

/* Invalid phone input styling */
.callback-popup-content .wpcf7-form input[type="tel"]:invalid,
.callback-popup-form input[type="tel"]:invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}

/* Prevent body scroll when popup is open */
body.callback-popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Mobile Safari fix - prevent scroll issues */
@supports (-webkit-touch-callout: none) {
    body.callback-popup-open {
        position: fixed !important;
        overflow: hidden !important;
        width: 100% !important;
    }
}

/* Print styles */
@media print {
    .callback-popup-overlay {
        display: none !important;
    }
}
