/* PayPal AI Agent - God Level Accessibility Styles */

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

/* AI Chatbox - Enhanced Accessibility */
.ai-chatbox {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: 'PayPal Pro', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transform: translateY(calc(100% - 60px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #E6E6E6;
    outline: none;
}

.ai-chatbox:focus {
    outline: 3px solid #0070BA;
    outline-offset: 2px;
}

.ai-chatbox.open {
    transform: translateY(0);
}

/* Chatbox Header */
.chatbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0070BA 0%, #009CDE 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbox-header:hover {
    background: linear-gradient(135deg, #005EA6 0%, #0088CC 100%);
}

.chatbox-header:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: -3px;
}

.chatbox-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.agent-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.agent-status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbox-toggle {
    font-size: 24px;
    font-weight: 700;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.chatbox-header:hover .chatbox-toggle {
    background: rgba(255, 255, 255, 0.1);
}

/* Chatbox Body */
.chatbox-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F5F7FA;
    max-height: 400px;
    scroll-behavior: smooth;
}

.chatbox-body:focus {
    outline: 2px solid #0070BA;
    outline-offset: -2px;
}

.chatbox-body::-webkit-scrollbar {
    width: 8px;
}

.chatbox-body::-webkit-scrollbar-track {
    background: transparent;
}

.chatbox-body::-webkit-scrollbar-thumb {
    background: #C1C8CD;
    border-radius: 4px;
}

.chatbox-body::-webkit-scrollbar-thumb:hover {
    background: #A8B2B9;
}

/* Messages */
.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-message {
    align-items: flex-end;
}

.agent-message {
    align-items: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #0070BA;
    color: white;
    border-bottom-right-radius: 4px;
}

.agent-message .message-content {
    background: white;
    color: #000000;
    border: 1px solid #E6E6E6;
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content strong {
    font-weight: 700;
}

.agent-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #F0F7FF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #0070BA;
}

.message-time {
    font-size: 11px;
    color: #6B7280;
    padding: 0 4px;
}

/* Typing Indicator */
.typing .typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0070BA;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.chatbox-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #E6E6E6;
    border-radius: 0 0 16px 16px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-action-btn {
    padding: 8px 12px;
    background: #F5F7FA;
    border: 1px solid #E6E6E6;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.quick-action-btn.primary {
    background: #0070BA;
    color: white;
    border: 1px solid #0070BA;
    font-weight: 600;
}

.quick-action-btn.primary:hover {
    background: #005EA6;
    border-color: #005EA6;
}

.quick-action-btn.primary:focus {
    outline: 2px solid #0070BA;
    outline-offset: 2px;
}

.quick-action-btn:hover {
    background: #E6E6E6;
    border-color: #C1C8CD;
}

.quick-action-btn:focus {
    outline: 2px solid #0070BA;
    outline-offset: 2px;
}

.quick-action-btn:active {
    transform: scale(0.98);
}

.input-container {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.chatbox-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #E6E6E6;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.chatbox-input:focus {
    outline: none;
    border-color: #0070BA;
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.1);
}

.send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0070BA;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #005EA6;
}

.send-btn:focus {
    outline: 2px solid #0070BA;
    outline-offset: 2px;
}

.send-btn:active {
    transform: scale(0.95);
}

.admin-request-btn {
    width: 100%;
    padding: 12px;
    background: #F5F7FA;
    border: 2px solid #E6E6E6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.admin-request-btn:hover {
    background: #E6E6E6;
    border-color: #C1C8CD;
}

.admin-request-btn:focus {
    outline: 2px solid #0070BA;
    outline-offset: 2px;
}

/* Welcome Message */
.welcome-message {
    margin-bottom: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ai-chatbox {
        border: 3px solid #000000;
    }
    
    .chatbox-header {
        background: #000000;
    }
    
    .message-content {
        border: 2px solid #000000;
    }
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-chatbox {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .chatbox-body {
        max-height: calc(100vh - 200px);
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
    }
}

/* Focus Visible (for keyboard navigation) */
.quick-action-btn:focus-visible,
.send-btn:focus-visible,
.admin-request-btn:focus-visible,
.chatbox-input:focus-visible,
.chatbox-header:focus-visible {
    outline: 3px solid #0070BA;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .ai-chatbox {
        display: none;
    }
}

