/* WP Live Chat Styles */

.wp-livechat-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Form Styles */
#wp-livechat-form-container .card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#wp-livechat-form-container .card-header {
    border-bottom: none;
    border-radius: 0.375rem 0.375rem 0 0 !important;
}

#wp-livechat-form-container .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#wp-livechat-form-container .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 500;
}

#wp-livechat-form-container .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Email Verification Styles */
#email-verification-section {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

#email-verification-section.verified {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #10b981;
    position: relative;
    animation: verifiedGlow 0.5s ease;
}

#email-verification-section.verified::before {
    content: '\2713';
    position: absolute;
    top: 10px;
    right: 15px;
    color: #10b981;
    font-size: 24px;
    font-weight: bold;
}

@keyframes verifiedGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(16, 185, 129, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

#email-verification-section .livechat-form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

#email-verification-section .input-group,
.livechat-verification-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
}

#email-verification-section .livechat-form-control,
#verification_code {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #8796A5;
    border-radius: 5px 0 0 5px;
    font-size: 16px;
    transition: border-color 0.15s ease-in-out;
    background: #ffffff;
    color: #1f2937;
}

#email-verification-section .livechat-form-control:focus,
#verification_code:focus {
    border-color: #4f46e5;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#email-verification-section .livechat-form-control::placeholder,
#verification_code::placeholder {
    color: #6b7280;
    opacity: 1;
}

#email-verification-section .livechat-form-control.is-valid {
    border-color: #28a745;
    padding-right: 40px;
}

#send-code-btn,
.livechat-verify-btn {
    padding: 10px 20px;
    background: #000080;
    color: white;
    border: 1px solid #000080;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    white-space: nowrap;
    min-width: 120px;
}

#send-code-btn:hover:not(:disabled),
.livechat-verify-btn:hover:not(:disabled) {
    background: #000066;
    border-color: #000066;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 128, 0.3);
}

#send-code-btn:disabled,
.livechat-verify-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

#email-verification-section .livechat-form-help {
    margin-top: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

#email-verification-section .livechat-form-help.text-success {
    color: #28a745;
}

#email-verification-section .livechat-form-help.text-danger {
    color: #dc3545;
}

#verification_code {
    font-size: 20px;
    letter-spacing: 5px;
    text-align: center;
    font-weight: 600;
}

#verification_code::placeholder {
    letter-spacing: normal;
    font-size: 14px;
    font-weight: normal;
}

/* Chat Interface Styles */
#wp-livechat-interface {
    height: 600px;
    display: flex;
    flex-direction: column;
}

#wp-livechat-interface .card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#wp-livechat-interface .card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    flex-shrink: 0;
}

#wp-livechat-interface .card-body.py-2 {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    min-height: 0;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 1rem;
}

.message-sent {
    justify-content: flex-end;
}

.message-received {
    justify-content: flex-start;
}

.message-system {
    justify-content: center;
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
    position: relative;
}

.message-sent .message-bubble {
    background-color: #000080;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-received .message-bubble {
    background-color: #000080;
    color: white;
    border: 1px solid #000080;
    border-bottom-left-radius: 0.25rem;
}

.message-system .message-bubble {
    background-color: #e9ecef;
    color: #6c757d;
    font-style: italic;
    text-align: center;
    border-radius: 1rem;
    max-width: 80%;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.message-sent .message-sender {
    color: rgba(255, 255, 255, 0.8);
}

.message-content {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
}

.message-sent .message-content a {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    font-size: 0.6875rem;
    opacity: 0.7;
    text-align: right;
}

.message-system .message-time {
    text-align: center;
}

/* Message Input */
#wp-livechat-interface .card-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1rem;
}

#message-form {
    gap: 0.5rem;
}

#message-input {
    border-radius: 5px;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
}

#message-input:focus {
    border-color: #000080;
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 128, 0.25);
}

#send-btn {
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.input-group-text.btn {
    border-radius: 0 1.5rem 1.5rem 0;
    border-left: none;
}

/* File Upload Progress */
#upload-progress {
    animation: fadeIn 0.3s ease-in-out;
}

#upload-progress .progress {
    height: 0.5rem;
    border-radius: 0.25rem;
}

/* Status Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Connection Status */
#connection-status {
    transition: all 0.3s ease;
}

#connection-status.bg-success {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Typing Indicator */
#typing-indicator {
    animation: fadeIn 0.3s ease-in-out;
}

/* Scrollbar Styles */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

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

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

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.message {
    animation: slideInUp 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wp-livechat-container {
        margin: 0;
        padding: 0 1rem;
    }
    
    #wp-livechat-interface {
        height: 500px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    #wp-livechat-interface .card-header h5 {
        font-size: 1rem;
    }
    
    #wp-livechat-interface .card-header small {
        font-size: 0.75rem;
    }
    
    .messages-container {
        padding: 0.75rem;
    }
    
    #message-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #send-btn {
        width: 100%;
        border-radius: 1.5rem;
        height: 2.5rem;
    }
}

@media (max-width: 480px) {
    #wp-livechat-interface {
        height: 400px;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 0.5rem 0.75rem;
    }
    
    .messages-container {
        padding: 0.5rem;
    }
    
    .messages-list {
        gap: 0.75rem;
    }
}

/* Loading States */
.btn-loading .spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Form Validation */
.was-validated .form-control:valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.94-.94 1.38 1.38 3.84-3.84.94.94-4.78 4.78z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4M8.2 4.6l-2.4 2.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Accessibility */
.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;
}

/* Focus States */
.btn:focus,
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .message-bubble {
        border: 2px solid currentColor;
    }
    
    .message-sent .message-bubble {
        background-color: #000066;
    }
    
    .message-received .message-bubble {
        background-color: white;
        border-color: #333;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wp-livechat-container {
        color: #fff;
    }
    
    .messages-container {
        background-color: #2d3748;
    }
    
    .message-received .message-bubble {
        background-color: #4a5568;
        color: #fff;
        border-color: #718096;
    }
    
    .message-system .message-bubble {
        background-color: #4a5568;
        color: #a0aec0;
    }
    
    .card {
        background-color: #1a202c;
        border-color: #2d3748;
    }
    
    .card-footer {
        background-color: #1a202c;
        border-color: #2d3748;
    }
    
    .form-control {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #fff;
    }
    
    .form-control:focus {
        background-color: #2d3748;
        border-color: #0d6efd;
        color: #fff;
    }
} 