/**
 * EoE Agent WordPress Interface Styles
 * Professional medical interface design with accessibility features
 */

/* Main Container */
#eoe-chat-container {
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    position: relative;
}

/* Header */
#eoe-chat-header {
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
    color: white;
    padding: 20px 24px;
    text-align: center;
    color: #FFFFFF;
}

#eoe-chat-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

#eoe-chat-header .disclaimer {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
    line-height: 1.4;
    color: yellowgreen;
}

/* Messages Container */
#eoe-chat-messages {
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 300px;
    max-height: 500px;
    scroll-behavior: smooth;
}

#eoe-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#eoe-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#eoe-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#eoe-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styles */
.eoe-message {
    display: flex;
    align-items: flex-end;
    margin-bottom: 16px;
    gap: 12px;
}

.eoe-user-message {
    flex-direction: row-reverse;
}

.eoe-bot-message {
    flex-direction: row;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #e2e8f0;
}

.eoe-bot-message .message-avatar {
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
    color: white;
}

.eoe-user-message .message-avatar {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
    color: white;
}

.message-bubble {
    max-width: 90%;
    position: relative;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    text-align: left;
}

.eoe-bot-message .message-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #2d3748;
}

.eoe-user-message .message-content {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
}

.message-time {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 4px;
    text-align: right;
}

.eoe-user-message .message-time {
    text-align: left;
}

.message-metadata {
    margin-top: 8px;
}

.message-metadata small {
    color: #48bb78;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
}

.message-metadata small::before {
    content: "✓";
    margin-right: 4px;
    font-weight: bold;
}

/* Typing Indicator */
#eoe-typing-indicator {
    padding: 8px 20px;
    color: #718096;
    font-style: italic;
    font-size: 0.875rem;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.6;
    }
    to {
        opacity: 1;
    }
}

/* Input Container */
#eoe-chat-input-container {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 20px;
}

#eoe-chat-form .input-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#eoe-chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s ease;
    outline: none;
}

#eoe-chat-input:focus {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#eoe-chat-input::placeholder {
    color: #a0aec0;
}

#eoe-send-btn {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
}

#eoe-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2c5282 0%, #2a4365 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#eoe-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Error Messages */
#eoe-error-message {
    background: #fed7d7;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 16px 20px;
    font-size: 0.875rem;
}

#eoe-error-message p {
    margin: 0;
}

/* Error Message Type */
.eoe-message.eoe-error-message .message-content {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* Responsive Design */
@media (max-width: 768px) {
    #eoe-chat-container {
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        height: 100vh;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    #eoe-chat-messages {
        flex: 1;
        min-height: auto;
        max-height: none;
        padding: 16px;
    }
    
    #eoe-chat-header {
        padding: 16px 20px;
    }
    
    #eoe-chat-input-container {
        padding: 16px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    #eoe-chat-form .input-group {
        gap: 8px;
    }
    
    #eoe-send-btn {
        padding: 12px 16px;
        font-size: 0.875rem;
    }
    
    #eoe-chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .message-content {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    #eoe-chat-header h3 {
        font-size: 1.125rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #eoe-chat-container {
        border: 2px solid #000;
    }
    
    #eoe-chat-input {
        border: 2px solid #000;
    }
    
    #eoe-send-btn {
        background: #000;
        border: 2px solid #000;
    }
    
    .eoe-bot-message .message-content {
        border: 2px solid #000;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #eoe-chat-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    #eoe-chat-messages {
        background: #1a202c;
    }
    
    .eoe-bot-message .message-content {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #eoe-chat-input-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    #eoe-chat-input {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #eoe-chat-input::placeholder {
        color: #718096;
    }
    
    #eoe-typing-indicator {
        background: #1a202c;
        border-color: #4a5568;
        color: #a0aec0;
    }
}

/* Print Styles */
@media print {
    #eoe-chat-input-container,
    #eoe-typing-indicator,
    #eoe-error-message {
        display: none !important;
    }
    
    #eoe-chat-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    #eoe-chat-messages {
        max-height: none;
        overflow: visible;
    }
}

/* Accessibility Improvements */
.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 Indicators */
*:focus {
    outline: 2px solid #3182ce;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #eoe-chat-messages {
        scroll-behavior: auto;
    }
}