/*
 * Plugin Name: CF7 WhatsApp Integration - Custom Form
 * Description: Custom styles for the CF7 WhatsApp Integration form.
 */

/* Base form styling */
.cf7-whatsapp-form-wrapper {
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.cf7-whatsapp-form-group {
    display: flex !important;
  flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.cf7-whatsapp-form-group .cf7-whatsapp-form-field.width-50 {
     flex: 0 0 calc(50% - 10px) !important;
    min-width: 230px  !important;
}

.cf7-whatsapp-form-group .cf7-whatsapp-form-field.width-100 {
    flex: 0 0 100%;
    min-width: auto;
}

.cf7-whatsapp-form-group.full-width .cf7-whatsapp-form-field {
    flex: 1 1 100%;
    min-width: auto;
}

.cf7-whatsapp-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.cf7-whatsapp-form-field input[type="text"],
.cf7-whatsapp-form-field input[type="email"],
.cf7-whatsapp-form-field input[type="tel"],
.cf7-whatsapp-form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    color: #555;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.cf7-whatsapp-form-field input[type="text"]:focus,
.cf7-whatsapp-form-field input[type="email"]:focus,
.cf7-whatsapp-form-field input[type="tel"]:focus,
.cf7-whatsapp-form-field textarea:focus {
    border-color: #114b5f;
    box-shadow: 0 0 0 3px rgba(17, 75, 95, 0.2);
    outline: none;
}

.cf7-whatsapp-form-field textarea {
    min-height: 120px;
    resize: vertical;
}

/* Submit button styling */
.cf7-whatsapp-submit-button {
    display: block;
    width: 100%;
    padding: 15px 25px;
    background-color: #114b5f; /* Custom background color */
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cf7-whatsapp-submit-button:hover {
    background-color: #0d3a4a;
    transform: translateY(-2px);
}

.cf7-whatsapp-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Form response message */
#form-response-message {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    display: none;
}

#form-response-message.success {
    background-color: #e6ffe6;
    color: #28a745;
    border: 1px solid #28a745;
}

#form-response-message.error {
    background-color: #ffe6e6;
    color: #dc3545;
    border: 1px solid #dc3545;
}

/* Global Overlay Styling */
#cf7-whatsapp-global-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Transparent dark overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0; /* Initially hidden */
    visibility: hidden; /* Initially hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#cf7-whatsapp-global-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cf7-whatsapp-overlay-content {
    background-color: #ffffff;
    padding: 40px 50px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#cf7-whatsapp-overlay-text-content {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* Spinner Styling */
.cf7-whatsapp-spinner {
    border: 6px solid #f3f3f3; /* Light grey */
    border-top: 6px solid #114b5f; /* Blue */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    display: none; /* Hidden by default */
}

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

/* Checkmark Icon Styling */
.cf7-whatsapp-checkmark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: none;
    stroke-width: 4;
    stroke: #28a745;
    stroke-miterlimit: 10;
}

.cf7-whatsapp-checkmark.show {
    display: block;
}

.cf7-whatsapp-checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 4;
    stroke-miterlimit: 10;
    stroke: #28a745;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.cf7-whatsapp-checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {

    .cf7-whatsapp-form-group {
        flex-direction: column;
        gap: 15px;
    }

    .cf7-whatsapp-form-group .cf7-whatsapp-form-field.width-50,
    .cf7-whatsapp-form-group .cf7-whatsapp-form-field.width-100 {
        flex: 1 1 100%;
        min-width: unset;
    }

    .cf7-whatsapp-overlay-content {
        padding: 30px;
        width: 80%;
    }

    #cf7-whatsapp-overlay-text-content {
        font-size: 20px;
    }
}