/* Professional Live Chat Form Styles - Production Ready */

/* CSS Reset and Base Styles */
#wp-livechat-form-container {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #1a202c;
    background: #ffffff;
    position: relative;
}

#wp-livechat-form-container *,
#wp-livechat-form-container *::before,
#wp-livechat-form-container *::after {
    box-sizing: inherit;
}

/* Main Container */
.livechat-form-wrapper {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    background: #ffffff;
}

.livechat-form-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    position: relative;
}

/* Professional Header */
.livechat-form-header {
    background: #ffffff;
    color: #1f2937;
    padding: 40px 32px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid #e5e7eb;
}

.livechat-form-icon {
    width: 72px;
    height: 72px;
    background: transparent;
    color: inherit;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 28px;
    border: none;
}

.livechat-form-title {
    /* Plain styling without z-index */
}

.livechat-form-title h2 {
    margin: 0 0 12px 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.livechat-form-title p {
    margin: 0;
    font-size: 18px;
    opacity: 0.9;
    font-weight: 400;
}

/* Status Messages */
.livechat-form-status {
    margin: 24px 32px;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    border-left: 4px solid transparent;
}

.livechat-form-status.success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #22c55e;
}

.livechat-form-status.error {
    background: #fef2f2;
    color: #dc2626;
    border-left-color: #ef4444;
}

.livechat-form-status.info {
    background: #eff6ff;
    color: #1d4ed8;
    border-left-color: #3b82f6;
}

/* Form Sections */
.livechat-form {
    padding: 32px;
}

/* Two Column Layout */
.livechat-form-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.livechat-form-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.livechat-form-section {
    margin-bottom: 0;
}

.livechat-form-section.full-width {
    grid-column: 1 / -1;
    margin-top: 40px;
}

.livechat-section-title {
    margin: 0 0 24px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.livechat-section-title i {
    color: #000080;
    font-size: 18px;
}

/* Form Layout */
.livechat-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.livechat-form-group {
    margin-bottom: 24px;
    position: relative;
}

.livechat-form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
}

.livechat-required {
    color: #ef4444;
    font-weight: 700;
    margin-left: 2px;
}

/* Email Verification Note */
.livechat-verification-note {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #60a5fa;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.livechat-security-section .livechat-verification-note {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #60a5fa;
    backdrop-filter: blur(10px);
}

.livechat-note-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #000080;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.livechat-note-content {
    flex: 1;
}

.livechat-note-content h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: #000080;
}

.livechat-note-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #000066;
}

/* Form Inputs */
.livechat-form-input,
.livechat-form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #8796A5;
    border-radius: 5px;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2937;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    outline: none;
    appearance: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.livechat-form-input:focus,
.livechat-form-textarea:focus {
    outline: none;
    border-color: #000080;
    box-shadow: 0 0 0 3px rgba(0, 0, 128, 0.1);
    background: #fafbff;
}

.livechat-form-input:hover,
.livechat-form-textarea:hover {
    border-color: #6b7280;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.livechat-form-input::placeholder,
.livechat-form-textarea::placeholder {
    color: #6b7280;
    font-weight: 400;
    opacity: 1;
}

.livechat-form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

/* Form Help Text */
.livechat-form-help {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.4;
}

/* Form Errors */
.livechat-form-error {
    margin-top: 8px;
    font-size: 14px;
    color: #dc2626;
    display: none;
    font-weight: 500;
}

.livechat-form-group.error .livechat-form-error {
    display: block;
}

.livechat-form-group.error .livechat-form-input,
.livechat-form-group.error .livechat-form-textarea {
    border-color: #dc2626;
    background: #fef2f2;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Ensure all input types have consistent border */
input[type="text"].livechat-form-input,
input[type="email"].livechat-form-input,
input[type="number"].livechat-form-input,
textarea.livechat-form-textarea {
    border: 1px solid #8796A5;
}

/* Ensure placeholder text meets WCAG AA contrast requirements (4.5:1) */
input::placeholder,
textarea::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
}

/* Security Section */
.livechat-security-section {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 32px;
    margin-top: 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Email Verification Section - Clean Text Only */
.livechat-email-verification-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 20px 0;
    margin-top: 0;
    position: relative;
    box-shadow: none;
}

.livechat-security-section .livechat-section-title {
    margin-bottom: 24px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.livechat-security-section .livechat-section-title i {
    color: #000080;
    font-size: 18px;
}

.livechat-email-verification-section .livechat-section-title {
    margin-bottom: 10px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

/* CAPTCHA Styling */
.livechat-captcha-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.livechat-captcha-question {
    background: #f8fafc;
    color: #1f2937;
    border: 1px solid #8796A5;
    padding: 18px 24px;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(135, 150, 165, 0.1);
    flex: 1;
    margin-bottom: 16px;
}

.livechat-captcha-refresh {
    background: #000080;
    color: #ffffff;
    border: 2px solid #000080;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 128, 0.2);
}

.livechat-captcha-refresh:hover {
    background: #000066;
    border-color: #000066;
    transform: rotate(90deg);
    box-shadow: 0 4px 8px rgba(0, 0, 128, 0.3);
}

.livechat-captcha-refresh:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.livechat-captcha-input {
    max-width: 160px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 16px auto 0;
    display: block;
    border: 1px solid #8796A5;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 12px 14px;
    border-radius: 5px;
    color: #1f2937;
}

.livechat-captcha-input:focus {
    border-color: #000080;
    box-shadow: 0 0 0 3px rgba(0, 0, 128, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
}

.livechat-captcha-input:hover {
    border-color: #6b7280;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.livechat-captcha-input::placeholder {
    color: #6b7280;
    font-weight: 400;
    opacity: 1;
}

/* Email Verification Button Styles */
.livechat-verify-btn {
    background: #000080;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.livechat-verify-btn:hover {
    background: #000066;
    color: white;
}

.livechat-verify-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.livechat-verify-btn.verified {
    background: #10b981;
    cursor: default;
}

.livechat-verify-btn.verified:hover {
    background: #10b981;
}

/* Remove duplicate icons in verified state */
.livechat-verify-btn.verified i:not(:first-child) {
    display: none;
}

/* Verification Row Styling */
.livechat-verification-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.livechat-verification-row .livechat-form-input {
    flex: 1;
}

.livechat-verification-row .livechat-verify-btn {
    flex-shrink: 0;
}

/* Honeypot Field (Hidden) */
.livechat-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.livechat-honeypot input {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    border: none;
    background: transparent;
    font-size: 0;
    color: transparent;
    outline: none;
}

/* Submit Section */
.livechat-submit-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 32px;
    text-align: center;
}

.livechat-submit-btn {
    background: #000080;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    justify-content: center;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(0, 0, 128, 0.3);
    outline: none;
}

.livechat-submit-btn:hover {
    background: #000066;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 128, 0.4);
}

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

.livechat-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.livechat-submit-btn:disabled .livechat-btn-text {
    color: #ffffff;
    opacity: 0.9;
}

/* Remove duplicate icons in verified submit button */
.livechat-submit-btn.btn-verified .livechat-btn-content i:not(:first-child) {
    display: none;
}

@keyframes pulseSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    }
    100% {
        transform: scale(1);
    }
}

/* Removed disabled::before rule */

.livechat-btn-content,
.livechat-btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.livechat-btn-loading {
    display: none;
}

.livechat-submit-btn.loading .livechat-btn-content {
    display: none;
}

.livechat-submit-btn.loading .livechat-btn-loading {
    display: flex;
}

/* Footer Information */
.livechat-form-footer {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.livechat-security-notice,
.livechat-response-time {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

.livechat-security-notice i {
    color: #10b981;
    font-size: 16px;
}

.livechat-response-time i {
    color: #f59e0b;
    font-size: 16px;
}

/* Accessibility Enhancements */
.livechat-form-input:focus-visible,
.livechat-form-textarea:focus-visible,
.livechat-submit-btn:focus-visible {
    outline: 2px solid #000080;
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Pulse Animation for Online Status */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .livechat-form-wrapper {
        padding: 16px;
    }
    
    .livechat-verification-note {
        padding: 12px;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .livechat-note-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .livechat-note-content h4 {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .livechat-note-content p {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .livechat-form-container {
        border-radius: 12px;
    }
    
    .livechat-form-header {
        padding: 32px 24px;
    }
    
    .livechat-form-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
        background: transparent;
        border: none;
        margin-bottom: 20px;
    }
    
    .livechat-form-title h2 {
        font-size: 28px;
    }
    
    .livechat-form-title p {
        font-size: 16px;
    }
    
    .livechat-form {
        padding: 24px;
    }
    
    .livechat-form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Two column layout becomes single column on mobile */
    .livechat-form-columns {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .livechat-form-column {
        gap: 24px;
    }
    
    .livechat-form-section {
        margin-bottom: 0;
    }
    
    .livechat-form-section.full-width {
        margin-top: 32px;
    }
    
    .livechat-section-title {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .livechat-security-section {
        padding: 24px;
        margin-top: 24px;
        border-radius: 8px;
        border: 1px solid #d1d5db;
    }
    
    .livechat-email-verification-section {
        padding: 20px 0;
        margin-top: 20px;
        border: none;
        border-radius: 0;
    }
    
    .livechat-verification-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .livechat-verification-row .livechat-form-input {
        max-width: none;
        width: 100%;
    }
    
    .livechat-verification-row .livechat-verify-btn {
        width: 100%;
        justify-content: center;
    }
    
    .livechat-captcha-question {
        font-size: 16px;
        padding: 14px 18px;
        margin-bottom: 12px;
    }
    
    .livechat-captcha-refresh {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }
    
    .livechat-captcha-input {
        max-width: 120px;
        font-size: 16px;
        margin-top: 12px;
    }
    
    .livechat-submit-btn {
        width: 100%;
        padding: 16px 24px;
    }
    
    .livechat-form-footer {
        margin-top: 24px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .livechat-form-wrapper {
        padding: 12px;
    }
    
    .livechat-verification-note {
        padding: 10px;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .livechat-note-icon {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
    
    .livechat-note-content h4 {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .livechat-note-content p {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .livechat-form-container {
        border-radius: 8px;
    }
    
    .livechat-form-header {
        padding: 24px 20px;
    }
    
    .livechat-form-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
        background: transparent;
        border: none;
        margin-bottom: 16px;
    }
    
    .livechat-form-title h2 {
        font-size: 24px;
    }
    
    .livechat-form-title p {
        font-size: 15px;
    }
    
    .livechat-form {
        padding: 20px;
    }
    
    .livechat-form-input,
    .livechat-form-textarea {
        padding: 12px 14px;
        font-size: 16px;
    }
    
    .livechat-security-section {
        padding: 20px;
        border: 1px solid #d1d5db;
        border-radius: 8px;
    }
    
    .livechat-email-verification-section {
        padding: 15px 0;
        border: none;
        border-radius: 0;
    }
    
    .livechat-verification-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .livechat-verification-row .livechat-form-input {
        max-width: none;
        width: 100%;
    }
    
    .livechat-verification-row .livechat-verify-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }
    
    .livechat-captcha-question {
        font-size: 15px;
        padding: 12px 16px;
    }
    
    .livechat-captcha-input {
        max-width: 120px;
        font-size: 16px;
    }
    
    .livechat-captcha-container {
        gap: 8px;
    }
    
    .livechat-captcha-refresh {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .livechat-submit-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .livechat-form-input,
    .livechat-form-textarea {
        border-width: 3px;
    }
    
    .livechat-form-header {
        background: #000000;
    }
    
    .livechat-submit-btn {
        background: #000000;
        border: 2px solid #ffffff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
    
    /* No animation effects needed */
}

/* Dark Mode Prevention */
@media (prefers-color-scheme: dark) {
    #wp-livechat-form-container {
        background: #ffffff;
        color: #1a202c;
    }
    
    .livechat-form-container {
        background: #ffffff;
        border-color: #e2e8f0;
    }
    
    .livechat-form-input,
    .livechat-form-textarea {
        background: #ffffff;
        color: #1f2937;
        border-color: #d1d5db;
    }
}

/* Print Styles */
@media print {
    .livechat-form-header {
        background: #ffffff;
        color: #000000;
        border: 1px solid #000000;
    }
    
    .livechat-submit-btn {
        background: #ffffff;
        color: #000000;
        border: 1px solid #000000;
    }
    
    .livechat-security-section {
        border: 1px solid #000000;
    }
}
