/**
 * Text Talk Popup Styles
 *
 * Modern, responsive styling for the SMS popup form
 * All styles are scoped to prevent conflicts with other site elements
 */

/* Popup Container */
.text-talk-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.text-talk-popup.active {
    opacity: 1;
    visibility: visible;
}

/* Overlay */
.text-talk-popup .text-talk-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.text-talk-popup.active .text-talk-overlay {
    opacity: 1;
}

/* Modal */
.text-talk-popup .text-talk-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    background: #333; /* Dark gray background */
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: all 0.3s ease-in-out;
    transform: translateY(100px) scale(0.9);
    opacity: 0;
}

.text-talk-popup.active .text-talk-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Header */
.text-talk-popup .text-talk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #68b42f; /* Bright green background */
    color: white;
}

.text-talk-popup .text-talk-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.text-talk-popup .text-talk-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.text-talk-popup .text-talk-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Content */
.text-talk-popup .text-talk-content {
    padding: 24px;
    background: #333; /* Dark gray background */
}

/* Form */
.text-talk-popup .text-talk-form {
    margin: 0;
}

/* Disable browser default validation styles */
.text-talk-popup .text-talk-form input:invalid,
.text-talk-popup .text-talk-form textarea:invalid {
    box-shadow: none;
}

.text-talk-popup .text-talk-form input:invalid:focus,
.text-talk-popup .text-talk-form textarea:invalid:focus {
    box-shadow: 0 0 0 3px rgba(104, 180, 47, 0.1);
}

/* Hide browser default validation messages */
.text-talk-popup .text-talk-form input::-webkit-validation-bubble-message,
.text-talk-popup .text-talk-form textarea::-webkit-validation-bubble-message {
    display: none;
}

.text-talk-popup .form-group {
    margin-bottom: 20px;
}

.text-talk-popup .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: white; /* White text for dark background */
    font-size: 14px;
}

.text-talk-popup .form-group label::after {
    content: " *";
    color: #ff6b6b; /* Red color for asterisk */
    font-weight: bold;
}

.text-talk-popup .form-group input,
.text-talk-popup .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    background: white;
    color: #333;
}

.text-talk-popup .form-group input:focus,
.text-talk-popup .form-group textarea:focus {
    outline: none;
    border-color: #68b42f;
    box-shadow: 0 0 0 3px rgba(104, 180, 47, 0.1);
}

.text-talk-popup .form-group input::placeholder,
.text-talk-popup .form-group textarea::placeholder {
    color: #999;
}

.text-talk-popup .form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Textarea Container */
.text-talk-popup .textarea-container {
    position: relative;
}

/* Character Count */
.text-talk-popup .char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: #ccc; /* Light gray for dark background */
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

.text-talk-popup .char-count.warning {
    color: #ff6b35;
}

/* Submit Button */
.text-talk-popup .text-talk-submit {
    width: 100%;
    padding: 14px 24px;
    background: #333; /* Dark gray background */
    color: #68b42f; /* Green text */
    border: 2px solid #68b42f; /* Green border */
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
}

.text-talk-popup .text-talk-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(104, 180, 47, 0.3);
    background: #68b42f;
    color: white;
}

.text-talk-popup .text-talk-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading Animation */
.text-talk-popup .ti-spin {
    animation: text-talk-spin 1s linear infinite;
}

@keyframes text-talk-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error Messages */
.text-talk-popup .error-message {
    color: #ff6b6b; /* Lighter red for dark background */
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
    padding: 6px 10px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ff6b6b;
    display: none;
    position: relative;
    z-index: 10;
    clear: both;
}

.text-talk-popup .error-message:not(:empty) {
    display: block;
}

/* Ensure error messages appear under their respective fields */
.text-talk-popup #phone-error {
    margin-top: 6px;
    display: none;
}

.text-talk-popup #message-error {
    margin-top: 6px;
    display: none;
}

.text-talk-popup #captcha-error {
    margin-top: 6px;
    display: none;
}

.text-talk-popup #text-talk-captcha {
    margin-top: 8px;
}

/* Success Message */
.text-talk-popup .text-talk-success {
    text-align: center;
    padding: 20px 0;
}

.text-talk-popup .success-icon {
    width: 60px;
    height: 60px;
    background: #27ae60;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 24px;
}

.text-talk-popup .text-talk-success h4 {
    margin: 0 0 10px;
    color: #27ae60;
    font-size: 18px;
}

.text-talk-popup .text-talk-success p {
    margin: 0 0 20px;
    color: #666;
}

.text-talk-popup .text-talk-close-btn {
    padding: 10px 20px;
    background: #2399F0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.text-talk-popup .text-talk-close-btn:hover {
    background: #1a7bc8;
}

/* Body scroll lock */
body.text-talk-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .text-talk-popup .text-talk-modal {
        width: 350px;
        bottom: 15px;
        right: 15px;
    }

    .text-talk-popup .text-talk-header {
        padding: 16px 20px;
    }

    .text-talk-popup .text-talk-header h3 {
        font-size: 18px;
    }

    .text-talk-popup .text-talk-content {
        padding: 20px;
    }

    .text-talk-popup .form-group input,
    .text-talk-popup .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .text-talk-popup .text-talk-modal {
        width: 320px;
        bottom: 10px;
        right: 10px;
    }

    .text-talk-popup .text-talk-header {
        padding: 12px 16px;
    }

    .text-talk-popup .text-talk-content {
        padding: 16px;
    }
}

/* Animation for form elements */
.text-talk-popup .form-group input,
.text-talk-popup .form-group textarea,
.text-talk-popup .text-talk-submit {
    animation: text-talk-fadeInUp 0.3s ease-out;
}

@keyframes text-talk-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus styles for accessibility */
.text-talk-popup .text-talk-close:focus,
.text-talk-popup .text-talk-submit:focus,
.text-talk-popup .text-talk-close-btn:focus {
    outline: 2px solid #2399F0;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-talk-popup .text-talk-modal {
        border: 2px solid #000;
    }

    .text-talk-popup .text-talk-submit {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .text-talk-popup,
    .text-talk-popup .text-talk-modal,
    .text-talk-popup .text-talk-submit,
    .text-talk-popup .form-group input,
    .text-talk-popup .form-group textarea {
        transition: none;
    }

    .text-talk-popup .ti-spin {
        animation: none;
    }
}
