#oca-chat-container {
    width: 600px; /* Overridden by inline CSS from settings */
    max-width: 95%;
    height: 510px; /* Overridden by inline CSS from settings */
    max-height: 95vh;
    margin: 20px auto;
    margin-bottom: 60px;
    background: #fefefe;
    border: 1px solid #b0b0b0;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#oca-chat-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}


#oca-pdf-sidebar.hidden {
    width: 0; /* Hide the sidebar by collapsing its width */
    border-right: none; /* Remove border when hidden */
    padding: 0; /* Remove any padding to ensure it’s fully collapsed */
}













#oca-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.oca-chat-header {
    padding: 10px;
    background: #fefefe;
    border-bottom: 1px solid #b0b0b0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.oca-header-right {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between elements */
}

#oca-voice-select {
    padding: 2px 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    height: 30px; /* Match the height of icon buttons */
    min-width: 180px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

#oca-voice-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
#oca-voice-select:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
}
#oca-voice-select.oca-voice-hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Speed control visibility */
.oca-speed-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    vertical-align: middle;
    position: relative;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.oca-speed-control.oca-voice-hidden {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    pointer-events: none;
}

/* Speed slider styling */
.oca-speed-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 160px !important;
    height: 4px;
    border-radius: 2px;
    background: #3b82f6;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
}

.oca-speed-slider.active {
    height: 6px;
    background: #2563eb;
}

.oca-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

.oca-speed-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

.oca-speed-slider::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
    transition: all 0.2s ease;
}

.oca-speed-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.4);
}

.oca-speed-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #3b82f6;
    border: none;
}

/* Speed value display */
.oca-speed-value {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 28px;
    text-align: center;
    display: inline-block;
    transition: all 0.2s ease;
}

.oca-speed-value.updating {
    transform: scale(1.1);
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

#oca-toggle-tts,
#oca-download-chat,
#oca-clear-chat {
    display: inline-block; /* Use inline-block for vertical alignment */
    vertical-align: middle; /* Align with the dropdown */
    margin-left: 5px; /* Space between icon buttons */
}

.oca-icon-button {
    min-width: 0 !important; /* Override any inherited min-width */
    width: 30px !important;
    height: 30px !important;
    padding: 5px !important;
    background: #e5e7eb;
    color: #4a5568;
    border: none;
    border-radius: 50% !important;
    font-size: 16px !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important; /* Center vertically */
    justify-content: center !important; /* Center horizontally */
    box-sizing: border-box !important;
    -webkit-border-radius: 50% !important;
    -moz-border-radius: 50% !important;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0 !important; /* Prevent flexbox from shrinking the buttons */
}
.oca-icon-button:hover {
    background: #d1d5db;
}

/* Specific rule for the TTS toggle button to change the icon based on muted state */
#oca-toggle-tts.muted i:before {
    content: '\f6a9'; /* Speaker muted icon */
}
#oca-toggle-tts:not(.muted) i:before {
    content: '\f028'; /* Speaker on icon */
}

/* Reasoning toggle active state */
#oca-toggle-reasoning.active {
    background: #3b82f6;
    color: #ffffff;
}
#oca-toggle-reasoning.active:hover {
    background: #2563eb;
}

.oca-icon-button i {
    font-size: 16px !important;
    display: flex !important; /* Ensure the icon respects flex centering */
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important; /* Remove any default margins */
    padding: 0 !important; /* Remove any default padding */
}

#oca-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f6f8;
    border-bottom: 1px solid #b0b0b0;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #3b82f6 #f5f6f8; /* Firefox */
}
#oca-chat-messages::-webkit-scrollbar {
    width: 8px;
}
#oca-chat-messages::-webkit-scrollbar-track {
    background: #f5f6f8;
    border-radius: 10px;
}
#oca-chat-messages::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 10px;
}
#oca-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

#oca-chat-messages p {
    margin: 15px 0;
    padding: 12px 18px;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    word-wrap: break-word;
}

#oca-chat-messages p strong {
    color: #1f2937;
}

.oca-user-message {
    background: #dcf8c6 !important; /* Light green background like WhatsApp/iMessage */
    color: #1f2937 !important;
    border-radius: 16px !important;
    margin-left: auto !important; /* Right-align user messages */
    margin-right: 0 !important; /* Ensure it stays right */
    max-width: 80% !important;
    padding: 12px 18px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    word-wrap: break-word !important;
    text-align: left !important; /* Text inside stays left-aligned for readability */
}
.oca-user-message::before {
    content: '' !important;
    position: absolute !important;
    right: -10px !important;
    top: 12px !important;
    width: 0 !important;
    height: 0 !important;
    border-top: 5px solid transparent !important;
    border-bottom: 5px solid transparent !important;
    border-left: 10px solid #dcf8c6 !important; /* Match the green background */
}

.oca-assistant-message {
    position: relative !important;
    background: #e3f2fd !important; /* Light blue background for AI messages */
    color: #1f2937 !important;
    border-radius: 16px !important;
    margin-left: 0 !important; /* Left-align AI messages */
    margin-right: auto !important; /* Ensure it stays left */
    max-width: 80% !important;
    padding: 12px 32px 12px 18px !important; /* Increased right padding for TTS button */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    word-wrap: break-word !important;
    display: block !important; /* Ensure it acts as a block container */
    text-align: left !important; /* Text inside stays left-aligned for readability */
}
.oca-assistant-message::before {
    content: '' !important;
    position: absolute !important;
    left: -10px !important;
    top: 12px !important;
    width: 0 !important;
    height: 0 !important;
    border-top: 5px solid transparent !important;
    border-bottom: 5px solid transparent !important;
    border-right: 10px solid #e3f2fd !important; /* Match the blue background */
}

/* Typing animation for streaming assistant messages */
.oca-assistant-message.typing .oca-markdown-content {
    position: relative;
    display: inline-block; /* Ensure cursor aligns with text */
}
.oca-assistant-message.typing .oca-markdown-content::after {
    content: '|';
    position: absolute;
    right: -0.5em;
    top: 0;
    color: #3b82f6; /* Match assistant link color for consistency */
    font-weight: bold;
    font-size: 1em; /* Match text size */
    animation: blink 0.7s step-end infinite;
}

.oca-error {
    background: #ffebee;
    color: #b71c1c;
    border-radius: 8px;
    padding: 10px 15px;
    margin: 10px 0;
    max-width: 80%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.oca-markdown-content {
    display: block;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-wrap: break-word;
    overflow: hidden; /* Contain floated elements */
    text-align: left; /* Explicitly set left alignment for all content */
}
.oca-markdown-content::after {
    content: '';
    display: block;
    clear: both; /* Clear the float from TTS button */
}
.oca-markdown-content > * {
    margin: 0.5em 0;
    text-align: left; /* Ensure all child elements are left-aligned */
}
.oca-markdown-content h1, .oca-markdown-content h2, .oca-markdown-content h3 {
    margin: 0.5em 0;
    color: #1f2937;
    font-weight: 600;
}
.oca-markdown-content h1 { font-size: 1.5em; }
.oca-markdown-content h2 { font-size: 1.25em; }
.oca-markdown-content h3 { font-size: 1.1em; }
.oca-markdown-content p,
.oca-markdown-content li {
    margin: 0.5em 0;
    padding: 0;
    background: transparent !important; /* Override any inherited background */
    box-shadow: none !important; /* Override any inherited shadow */
    font-size: 1em;
    display: block; /* Use block to ensure proper alignment and flow */
}
.oca-markdown-content ul,
.oca-markdown-content ol {
    margin: 0.5em 0 0.5em 1.5em;
    padding: 0;
    background: transparent !important; /* Ensure no background */
    box-shadow: none !important; /* Ensure no shadow */
    display: block; /* Ensure proper list rendering */
}
.oca-markdown-content li {
    margin-bottom: 0.25em;
    padding: 0;
    background: transparent !important; /* Remove background from list items */
    box-shadow: none !important; /* Remove shadow from list items */
    display: list-item; /* Preserve bullet styling */
}
.oca-markdown-content code {
    background: #f1f3f4;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}
.oca-markdown-content pre {
    background: #f1f3f4;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    margin: 0.5em 0;
}
.oca-markdown-content pre code {
    background: none;
    padding: 0;
}
.oca-markdown-content a {
    color: #3b82f6;
    text-decoration: underline;
}
.oca-markdown-content a:hover {
    color: #2563eb;
}
.oca-markdown-content blockquote {
    border-left: 4px solid #d1d5db;
    padding: 0.5em 1em;
    margin: 0.5em 0;
    color: #4b5563;
    background: #f9fafb;
}

/* Ensure quick replies are separated from the message */
.oca-quick-replies {
    margin-top: 10px !important;
    text-align: left !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    margin-left: 0 !important; /* Left-align with assistant message */
    margin-right: auto !important; /* Ensure it stays left */
    max-width: 80% !important; /* Match message width */
    visibility: visible !important;
    opacity: 1 !important;
}

.oca-quick-replies-initial {
    margin-top: 20px;
    text-align: left !important;
    padding: 15px 0;
    display: flex;
    justify-content: flex-start !important;
    gap: 10px;
    flex-wrap: wrap;
}

.oca-voice-warning {
    font-size: 14px;
    padding: 5px 10px;
    background: #ffebee;
    border-radius: 4px;
    display: none;
}

#oca-chat-form {
    display: flex;
    padding: 15px;
    background: #fefefe;
    border-top: 1px solid #b0b0b0;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.oca-input-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
}

#oca-chat-form input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    padding-right: 80px; /* Increased to make room for both icons */
    border: 1px solid #c0c0c0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
    width: 100%;
    min-width: 0;
}
#oca-chat-form input[type="text"]:focus {
    border-color: #3b82f6;
}

.oca-voice-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #00ff08;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease;
    opacity: 0.7;
}
.oca-voice-icon:hover {
    color: #07970e;
    opacity: 1;
}
.oca-voice-icon.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.oca-voice-icon.listening {
    color: #dc3545;
    animation: pulse 1s infinite;
    opacity: 1;
}

/* Input icon button for reasoning toggle */
.oca-input-icon-button {
    position: absolute;
    right: 40px; /* Position to the left of the microphone icon */
    top: 50%;
    transform: translateY(-50%);
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    background: rgba(156, 163, 175, 0.2); /* Subtle gray background for inactive state */
    border: 1px solid #d1d5db;
    border-radius: 50% !important; /* Make it perfectly circular */
    color: #374151; /* Darker gray for better contrast */
    font-size: 16px; /* Increased from 14px for better visibility */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}
.oca-input-icon-button:hover {
    background: #e5e7eb;
    color: #374151; /* Keep gray color on hover when inactive */
    border-color: #9ca3af;
    transform: translateY(-50%) scale(1.05); /* Slight scale effect on hover */
}
.oca-input-icon-button:active {
    transform: translateY(-50%) scale(0.95); /* Press effect */
}
.oca-input-icon-button.active,
#oca-toggle-reasoning.active,
.oca-reasoning-toggle.active {
    background: rgba(156, 163, 175, 0.2) !important; /* Keep subtle gray background */
    color: #f59e0b !important; /* Golden yellow for "lit" effect */
    border-color: #f59e0b !important; /* Golden border */
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4) !important; /* Golden glow effect */
}
.oca-input-icon-button.active:hover,
#oca-toggle-reasoning.active:hover,
.oca-reasoning-toggle.active:hover {
    background: rgba(156, 163, 175, 0.3) !important; /* Slightly more prominent gray on hover */
    color: #f59e0b !important; /* Keep golden yellow on hover */
    border-color: #d97706 !important; /* Darker golden border on hover */
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6) !important; /* Enhanced golden glow on hover */
}

/* Voice input tooltip */
.oca-voice-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    margin-bottom: 5px;
}
.oca-voice-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 10px;
    border: 5px solid transparent;
    border-top-color: #333;
}
.oca-voice-icon:hover .oca-voice-tooltip {
    opacity: 1;
    visibility: visible;
}

.oca-action-button {
    min-width: 180px; /* Kept as requested */
    padding: 0 12px;
    height: 34px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    gap: 5px;
}
.oca-action-button:hover {
    background: #1e3a8a; /* Much darker blue on hover */
}
#oca-upload-image:hover,
#oca-upload-pdf:hover {
    background: #1e3a8a !important; /* Much darker blue on hover */
}
#oca-phone-upload-btn {
    opacity: 1 !important;
}
#oca-phone-upload-btn:hover {
    background: #1e3a8a !important; /* Same hover color as action buttons */
    opacity: 1 !important;
}
#oca-chat-form .oca-action-button[type="submit"] {
    width: 60px;
}
#oca-chat-form .oca-action-button[type="submit"]:hover {
    background: #1e3a8a !important; /* Much darker blue on hover */
}
#oca-chat-form .oca-action-button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.oca-send-text {
    display: inline-block;
}

.oca-processing-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Voice button specific styles */
#oca-voice-input.listening {
    /* Removed background color change - icon will be red instead */
    animation: pulse 1s infinite;
}
#oca-voice-input.listening i:before {
    content: '\f130'; /* microphone-slash icon */
    color: #dc3545; /* Make the microphone icon red when recording */
}
#oca-voice-input.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Base button class for shared styles */
.oca-button {
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Reset padding, override in specific classes */
    margin: 0; /* Reset margin, override in specific classes */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); /* Shared shadow */
    border-radius: 8px; /* Shared border radius */
    min-width: 0; /* Override global button min-width */
    height: auto; /* Override global button height */
}

/* Feedback button styles */
.oca-feedback-btn {
    background: #ffffff;
    font-size: 12px;
    padding: 2px 4px;
    color: #4a5568;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.oca-feedback-btn:hover {
    background: #f8f9fa;
    border-color: #cbd5e1;
}
.oca-feedback-btn:hover .fa-thumbs-up {
    color: #90EE90;
}
.oca-feedback-btn:hover .fa-thumbs-down {
    color: #FFB6C1;
}

/* TTS play/pause button styles */
.oca-tts-control {
    float: right;
    margin: 0 0 3px 8px;
    padding: 5px 10px; /* Increased from 4px 8px */
    background: #3b82f6; /* Overridden by inline CSS from oca-enqueue.php */
    color: #ffffff; /* Overridden by inline CSS */
    font-size: 10px;
    gap: 2px;
    height: 24px; /* Increased from 20px */
}
.oca-tts-control:hover {
    background: #2563eb;
}
.oca-tts-control.playing i:before {
    content: '\f04c';
}
.oca-tts-control.paused i:before {
    content: '\f04b';
}
.oca-tts-control.loading i:before {
    content: '\f110';
    animation: spin 1s linear infinite;
}
.oca-tts-control.paused-loading i:before {
    content: '\f04b';
}

/* TTS controls container */
.oca-message-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.oca-tts-controls-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    width: fit-content;
    margin-left: auto;
    margin-right: 0;
    margin-top: 0; /* Remove top margin since it's now in a flex container */
}



/* Quick reply button styles */
.oca-quick-reply {
    padding: 8px 16px;
    background: #a5d6a7; /* Overridden by inline CSS */
    color: #1e4620; /* Overridden by inline CSS */
    font-size: 18px;
    white-space: nowrap;
    height: 30px; /* Optional: Enforce a taller height for larger text */
}
.oca-quick-reply:hover {
    background: #81c784;
}

.oca-feedback {
    margin-left: 10px; /* Keep spacing */
    display: inline-flex; /* Use flex for inline alignment */
    gap: 5px; /* Space between buttons */
    align-items: center; /* Vertically center buttons */
    width: 100%; /* Allow full width expansion */
    justify-content: flex-start; /* Align buttons to the left */
}

.oca-icon-button i,
#oca-chat-container i.fa,
#oca-chat-container i.fas {
    font-size: 16px !important;
    display: flex !important; /* Ensure the icon respects flex centering */
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important; /* Remove any default margins */
    padding: 0 !important; /* Remove any default padding */
}

@media (max-width: 768px) {
    #oca-chat-container {
        margin: 10px auto;
        margin-bottom: 40px;
    }
    #oca-chat-messages p {
        font-size: 14px;
        padding: 12px 18px;
    }
    .oca-quick-reply {
        font-size: 18px;
        padding: 6px 12px;
        height: 28px; /* Optional: Slightly smaller height */
    }
    #oca-chat-form {
        padding: 10px;
        gap: 5px;
    }
    .oca-input-container {
        min-width: 150px;
    }
    #oca-chat-form input[type="text"], .oca-action-button {
        padding: 0 10px;
        padding-right: 80px; /* Account for both icons on mobile */
        height: 30px;
        font-size: 12px;
    }
    #oca-chat-form .oca-action-button[type="submit"] {
        width: 50px;
    }
    .oca-processing-spinner {
        width: 12px;
        height: 12px;
        border-width: 2px;
    }
    .oca-assistant-message {
        padding: 10px 28px 10px 14px; /* Adjusted padding for smaller screens */
    }
    .oca-user-message {
        padding: 10px 14px;
    }
    .oca-tts-controls-container {
        gap: 4px;
        padding: 6px 8px;
        margin-top: 0; /* Remove top margin in mobile as well */
    }
    .oca-tts-control {
        font-size: 9px;
        padding: 4px 8px;
        height: 22px;
    }
    .oca-tts-control.loading i:before {
        content: '\f110';
        animation: spin 1s linear infinite;
    }
    .oca-tts-control.paused-loading i:before {
        content: '\f04b';
    }
    .oca-feedback-btn {
        font-size: 10px;
        height: 18px; /* Optional: Slightly smaller height */
    }
    /* Adjust typing animation for smaller screens */
    .oca-assistant-message.typing .oca-markdown-content::after {
        font-size: 0.9em; /* Slightly smaller cursor */
        right: -0.4em;
    }
}

@media (max-width: 480px) {
    #oca-chat-container {
        margin: 5px auto;
        margin-bottom: 20px;
    }
    #oca-chat-form {
        flex-direction: column;
        align-items: stretch;
    }
    .oca-input-container {
        width: 100%;
    }
    .oca-quick-replies, .oca-quick-replies-initial {
        gap: 5px;
    }
    .oca-quick-reply {
        font-size: 18px;
        padding: 4px 8px;
        height: 26px; /* Optional: Slightly smaller height */
    }
    .oca-assistant-message {
        padding: 8px 24px 8px 12px; /* Further adjusted padding */
    }
    .oca-user-message {
        padding: 8px 12px;
    }
    .oca-tts-controls-container {
        gap: 3px;
        padding: 5px 6px;
        margin-top: 0; /* Remove top margin in mobile as well */
    }
    .oca-tts-control {
        font-size: 8px;
        padding: 3px 6px;
        height: 20px;
    }
    .oca-tts-control.loading i:before {
        content: '\f110';
        animation: spin 1s linear infinite;
    }
    .oca-tts-control.paused-loading i:before {
        content: '\f04b';
    }
    .oca-feedback-btn {
        font-size: 8px;
        padding: 1px 2px;
        height: 16px; /* Optional: Even smaller height */
    }
    /* Adjust typing animation for smaller screens */
    .oca-assistant-message.typing .oca-markdown-content::after {
        font-size: 0.8em; /* Even smaller cursor */
        right: -0.3em;
    }
    /* Adjust input icon button for mobile */
    .oca-input-icon-button {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        font-size: 12px;
        right: 35px;
        border-radius: 50% !important; /* Ensure it stays circular on mobile */
        padding: 0 !important;
        margin: 0 !important;
    }
    /* Adjust input padding for mobile to accommodate smaller icons */
    .oca-chat-input {
        padding-right: 65px;
    }
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Status display styles */
.oca-status {
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.oca-status.batch {
    background: #f0f7ff;
    border: 1px solid #4a90e2;
}
.oca-status.ai-tagging {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
    border: 1px solid #6c5ce7;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.1);
}
.oca-status-text {
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}
.oca-status-processing {
    color: #6c5ce7;
}
.oca-status-success {
    color: #00b894;
}
.oca-status-error {
    color: #e17055;
}
.oca-typing-indicator {
    font-style: italic;
    animation: oca-typing 1.5s infinite;
}
@keyframes oca-typing {
    0%, 60%, 100% { opacity: 1; }
    30% { opacity: 0.3; }
}
.oca-assistant-message.typing .oca-markdown-content {
    position: relative;
}

/* Feedback Form Styles */
.oca-feedback-form {
    margin-top: 10px;
    width: 100% !important;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.oca-feedback-rating {
    margin-bottom: 8px;
    padding: 0 12px;
    text-align: center;
}

.oca-rating-display {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.oca-feedback-input-container {
    margin-bottom: 10px;
    padding: 0 12px;
}

.oca-feedback-comment {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.oca-feedback-comment:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.oca-feedback-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 0 12px 12px 12px;
}

.oca-feedback-submit {
    padding: 8px 16px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.oca-feedback-submit:hover:not(:disabled) {
    background: #2563eb;
}

.oca-feedback-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.oca-feedback-cancel {
    padding: 8px 16px;
    background: #f3f4f6;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.oca-feedback-cancel:hover {
    background: #e5e7eb;
}

.oca-feedback-retry {
    padding: 6px 12px;
    background: #f59e0b;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 5px;
}

.oca-feedback-retry:hover {
    background: #d97706;
}

.oca-feedback-success {
    color: #059669;
    font-weight: 500;
    font-size: 14px;
}

.oca-feedback-error {
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 5px;
}

/* Mobile responsiveness for feedback form */
@media (max-width: 768px) {
    .oca-feedback-form {
        padding: 0;
        margin-top: 8px;
        width: 100% !important;
    }

    .oca-feedback-rating {
        padding: 0 10px;
    }

    .oca-feedback-input-container {
        padding: 0 10px;
    }

    .oca-feedback-comment {
        font-size: 13px;
        min-height: 35px;
    }

    .oca-feedback-buttons {
        gap: 6px;
        padding: 0 10px 10px 10px;
    }

    .oca-feedback-submit,
    .oca-feedback-cancel {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .oca-feedback-form {
        padding: 0;
        margin-top: 6px;
        width: 100% !important;
    }

    .oca-feedback-rating {
        padding: 0 8px;
    }

    .oca-feedback-input-container {
        padding: 0 8px;
    }

    .oca-feedback-comment {
        font-size: 12px;
        min-height: 30px;
    }

    .oca-feedback-buttons {
        gap: 6px;
        padding: 0 8px 8px 8px;
    }

    .oca-feedback-submit,
    .oca-feedback-cancel {
        padding: 5px 10px;
        font-size: 12px;
    }
}