/* Base styles for all popups */
.ufp-popup-container {
    position: fixed;
    background-color: #fff; /* Default background from settings */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Tailwind-like shadow */
    transition: all 0.3s ease-in-out;
    z-index: 9999;
    opacity: 0; /* Default hidden state */
    visibility: hidden; /* For screen readers */
    pointer-events: none; /* Allow clicks through when hidden */
}

/* Specific positioning for all popups */
#feedback-initial-popup,
#feedback-thankyou-popup {
    bottom: 20px;
    right: 20px;
    width: auto;
    min-width: 280px;
    max-width: 90vw;
}

/* Specific styling for the initial popup content */
#feedback-initial-popup .ufp-popup-content,
#feedback-thankyou-popup .ufp-popup-content {
    display: flex;
    align-items: center;
    gap: 15px; /* Spacing between elements */
    justify-content: space-between;
    width: 100%;
}

/* Full form popup positioning */
#feedback-full-form-popup {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Centered */
    width: 100%; /* Default to full width for small screens */
    max-width: 450px; /* Max width for larger screens */
    height: auto;
    max-height: 90vh; /* Prevent overflow on tall content */
    overflow-y: auto; /* Scroll if content is too long */

    /* Hide scrollbar for Chrome, Safari and Opera */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
/* Hide scrollbar for Chrome, Safari and Opera */
#feedback-full-form-popup::-webkit-scrollbar {
    display: none;
}


/* Full form popup content */
#feedback-full-form-popup .ufp-popup-content {
    display: block;
    width: 100%;
    padding: 10px; /* Add some padding internally */
}

/* Hidden states */
.ufp-initial-hidden, .ufp-full-hidden, .ufp-thankyou-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important; /* Force display none to take element out of flow */
}

/* Show popup state */
.ufp-show-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: block; /* The default for popups */
}
#feedback-initial-popup.ufp-show-popup,
#feedback-thankyou-popup.ufp-show-popup {
    display: flex; /* Override for initial popup to be a flex container */
}


/* Animations */
/* Fade */
.fade.ufp-show-popup { opacity: 1; }
.fade.ufp-hide-popup { opacity: 0; }

/* Slide Up */
.slide_up.ufp-popup-container { transform: translateY(100%); } /* Initial state */
.slide_up.ufp-show-popup { transform: translateY(0%); opacity: 1; }
.slide_up.ufp-hide-popup { transform: translateY(100%); opacity: 0; }
/* Override for full form popup to slide from center */
#feedback-full-form-popup.slide_up.ufp-popup-container { transform: translate(-50%, 100%); }
#feedback-full-form-popup.slide_up.ufp-show-popup { transform: translate(-50%, -50%); opacity: 1; }
#feedback-full-form-popup.slide_up.ufp-hide-popup { transform: translate(-50%, 100%); opacity: 0; }


/* Zoom In */
.zoom_in.ufp-popup-container { transform: scale(0.5); } /* Initial state */
.zoom_in.ufp-show-popup { transform: scale(1); opacity: 1; }
.zoom_in.ufp-hide-popup { transform: scale(0.5); opacity: 0; }
/* Override for full form popup to zoom from center */
#feedback-full-form-popup.zoom_in.ufp-popup-container { transform: translate(-50%, -50%) scale(0.5); }
#feedback-full-form-popup.zoom_in.ufp-show-popup { transform: translate(-50%, -50%) scale(1); opacity: 1; }
#feedback-full-form-popup.zoom_in.ufp-hide-popup { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }


/* Close button styling */
.ufp-close-btn {
    cursor: pointer;
    font-size: 1.5rem; /* Larger for better tap target */
    line-height: 1;
    color: #9ca3af; /* Tailwind gray-400 */
    position: absolute;
    top: 10px;
    right: 15px;
    padding: 5px;
    transition: color 0.2s ease-in-out;
}
.ufp-close-btn:hover {
    color: #4b5563; /* Tailwind gray-700 */
}

/* Button styling */
.ufp-button-group {
    display: flex;
    gap: 10px;
}
.ufp-button {
    background-color: #3b82f6; /* Tailwind blue-500 */
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 0.375rem; /* Tailwind rounded-md */
    border: none;
    cursor: pointer;
    font-weight: 600; /* Tailwind font-semibold */
    transition: background-color 0.2s ease-in-out;
    white-space: nowrap; /* Prevent "Yes" from wrapping */
}
.ufp-button:hover {
    background-color: #2563eb; /* Tailwind blue-600 */
}

.ufp-button-secondary {
    background-color: #f3f4f6; /* Tailwind gray-100 */
    color: #4b5563; /* Tailwind gray-700 */
}
.ufp-button-secondary:hover {
    background-color: #e5e7eb; /* Tailwind gray-200 */
}

/* Text styling */
.ufp-text-base {
    margin: 0;
    line-height: 1.5; /* Tailwind leading-relaxed */
    color: #1f2937; /* Tailwind gray-800 */
    font-size: var(--ufp-text-size, 16px); /* Use CSS variable for text size */
}

.ufp-form-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5rem; /* Tailwind text-2xl */
    font-weight: 700; /* Tailwind font-bold */
    color: #1f2937;
    text-align: center;
}

/* Contact Form 7 specific adjustments for a cleaner look */
#feedback-full-form-popup .wpcf7-form-control-wrap {
    margin-bottom: 15px;
}
#feedback-full-form-popup label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500; /* Tailwind font-medium */
    color: #374151; /* Tailwind gray-700 */
}
#feedback-full-form-popup input[type="text"],
#feedback-full-form-popup input[type="email"],
#feedback-full-form-popup textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db; /* Tailwind gray-300 */
    border-radius: 0.375rem; /* Tailwind rounded-md */
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05); /* Subtle inner shadow */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    font-size: inherit; /* Inherit from popup text size */
}
#feedback-full-form-popup input[type="text"]:focus,
#feedback-full-form-popup input[type="email"]:focus,
#feedback-full-form-popup textarea:focus {
    border-color: #60a5fa; /* Tailwind blue-400 */
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.5); /* Tailwind ring-2 blue-300 */
}

#feedback-full-form-popup .wpcf7-list-item {
    display: inline-block;
    margin-right: 15px;
}
#feedback-full-form-popup .wpcf7-list-item input[type="radio"] {
    margin-right: 5px;
}

#feedback-full-form-popup input[type="submit"] {
    background-color: #10b981; /* Tailwind green-500 */
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out;
    width: auto; /* Don't force full width */
    margin-top: 20px;
    display: block; /* Center submit button */
    margin-left: auto;
    margin-right: auto;
}
#feedback-full-form-popup input[type="submit"]:hover {
    background-color: #059669; /* Tailwind green-600 */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #feedback-initial-popup,
    #feedback-thankyou-popup {
        bottom: 10px;
        right: 10px;
        left: 10px; /* Make it stretch across the bottom */
        max-width: none; /* Allow full width up to max-content */
        width: auto; /* Let content dictate width */
    }

    #feedback-initial-popup .ufp-popup-content,
    #feedback-thankyou-popup .ufp-popup-content {
        flex-wrap: wrap; /* Allow content to wrap */
        justify-content: center; /* Center items when wrapped */
        text-align: center;
        gap: 10px;
    }
    
    #feedback-initial-popup .ufp-button {
        width: 100%;
    }

    /* Corrected centering for the main feedback form */
    #feedback-full-form-popup {
        width: calc(100% - 20px);
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: none; /* Allow full width */
    }
    
    .ufp-close-btn {
        top: 5px;
        right: 5px;
    }
}