/* TopTexasHouses Lead Capture - Popup Styles */

/* Reset and base */
.tth-lc-popup-overlay,
.tth-lc-popup-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Overlay backdrop */
.tth-lc-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;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    animation: tth-lc-fade-in 0.3s ease;
}

@keyframes tth-lc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Popup container */
.tth-lc-popup-container {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: tth-lc-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tth-lc-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close button */
.tth-lc-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.tth-lc-close-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
    transform: rotate(90deg);
}

/* Popup header */
.tth-lc-popup-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 30px 30px 25px;
    text-align: center;
    border-radius: 16px 16px 0 0;
}

.tth-lc-popup-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.tth-lc-popup-header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Form styles */
.tth-lc-form {
    padding: 25px 30px 30px;
}

/* Form rows */
.tth-lc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 0;
}

.tth-lc-form-group {
    margin-bottom: 18px;
}

.tth-lc-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.tth-lc-form-group .required {
    color: #ef4444;
}

/* Input fields */
.tth-lc-form input[type="text"],
.tth-lc-form input[type="email"],
.tth-lc-form input[type="tel"],
.tth-lc-form select,
.tth-lc-form textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #fafafa;
    color: #1f2937;
    transition: all 0.2s ease;
}

.tth-lc-form input:focus,
.tth-lc-form select:focus,
.tth-lc-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.tth-lc-form input::placeholder,
.tth-lc-form textarea::placeholder {
    color: #9ca3af;
}

.tth-lc-form input:hover,
.tth-lc-form select:hover,
.tth-lc-form textarea:hover {
    border-color: #d1d5db;
}

/* Select dropdown styling */
.tth-lc-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Textarea */
.tth-lc-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Submit button */
.tth-lc-submit-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.tth-lc-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.tth-lc-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.35);
}

.tth-lc-submit-btn:hover::before {
    left: 100%;
}

.tth-lc-submit-btn:active {
    transform: translateY(0);
}

.tth-lc-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Success message */
.tth-lc-success {
    text-align: center;
    padding: 30px 20px;
    animation: tth-lc-success-fade-in 0.5s ease;
}

@keyframes tth-lc-success-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tth-lc-success .success-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 36px;
    color: white;
    animation: tth-lc-success-bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tth-lc-success-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.tth-lc-success h3 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 12px;
}

.tth-lc-success p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
}

/* Error message */
.tth-lc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    margin-top: 15px;
}

.tth-lc-error p {
    color: #dc2626;
    font-size: 14px;
    margin: 0;
}

/* Trigger button (for shortcode) */
.tth-lc-trigger-button {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(30, 58, 138, 0.3);
}

.tth-lc-trigger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.4);
}

.tth-lc-trigger-button:active {
    transform: translateY(0);
}

/* Responsive design */
@media (max-width: 600px) {
    .tth-lc-popup-container {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .tth-lc-popup-header {
        padding: 25px 20px 20px;
    }
    
    .tth-lc-popup-header h2 {
        font-size: 20px;
    }
    
    .tth-lc-form {
        padding: 20px;
    }
    
    .tth-lc-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .tth-lc-form-group {
        margin-bottom: 15px;
    }
    
    .tth-lc-close-btn {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* Loading state for submit button */
.tth-lc-submit-btn.loading {
    pointer-events: none;
}

.tth-lc-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: tth-lc-spin 0.8s linear infinite;
}

@keyframes tth-lc-spin {
    to { transform: rotate(360deg); }
}

/* Hide popup initially */
.tth-lc-popup-overlay.hidden {
    display: none;
}

/* Input validation styles */
.tth-lc-form input:invalid:not(:placeholder-shown),
.tth-lc-form select:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.tth-lc-form input[type="email"]:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

/* Focus visible for accessibility */
.tth-lc-form input:focus-visible,
.tth-lc-form select:focus-visible,
.tth-lc-form textarea:focus-visible,
.tth-lc-submit-btn:focus-visible,
.tth-lc-trigger-button:focus-visible,
.tth-lc-close-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Scrollbar styling for popup */
.tth-lc-popup-container::-webkit-scrollbar {
    width: 6px;
}

.tth-lc-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tth-lc-popup-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.tth-lc-popup-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}