/* CSS Variables for Blue Color Palette */
:root {
    --p-primary-50: #eff6ff;
    --p-primary-100: #dbeafe;
    --p-primary-200: #bfdbfe;
    --p-primary-300: #93c5fd;
    --p-primary-400: #60a5fa;
    --p-primary-500: #1F70C9;
    --p-primary-600: #0057B7;
    --p-primary-700: #1d4ed8;
    --p-primary-800: #1e40af;
    --p-primary-900: #1e3a8a;
    --p-primary-950: #172554;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background: var(--p-surface-50);
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    color: var(--p-text-color);
    font-size: 14px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    font-weight: 400;
    -webkit-tap-highlight-color: transparent;
    font-feature-settings: "cv02","cv03","cv04","cv11";
    font-variation-settings: normal;
    tab-size: 4;
}

.widget-container {
    background: var(--p-content-background);
    border-radius: var(--p-content-border-radius);
    box-shadow: var(--p-overlay-popover-shadow);
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--p-content-border-color);
    margin: 0;
    padding: 0;
}

.widget-header {
    background: linear-gradient(135deg, var(--p-primary-600, #0057B7) 0%, var(--p-primary-700, #1d4ed8) 100%);
    color: white;
    padding: 1.5rem 1.25rem;
    text-align: center;
    border-bottom: 2px solid var(--p-primary-700, #1d4ed8);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    position: relative;
}

.widget-header h2 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.widget-header p {
    font-size: 0.875rem;
    opacity: 0.95;
    color: white;
    margin: 0;
    line-height: 1.4;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.header-text { text-align: center; flex: 1; }

.user-greeting { position: absolute; left: 1.25rem; top: 50%; transform: translateY(-50%); font-size: 0.9rem; font-weight: 500; opacity: 0.95; color: white; line-height: 1.3; white-space: nowrap; }

.greeting-text {
    margin-right: 0.25rem;
}

.user-name {
    font-weight: 600;
}

.download-pdf-button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--p-primary-400, #60a5fa);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* Compact design for small widget sizes */
@media (max-width: 600px) {
    .download-pdf-button {
        font-size: 1.2rem;
        padding: 0.5rem;
        right: 0.75rem;
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        justify-content: center;
        gap: 0;
    }
    
    .pdf-text {
        display: none;
    }
    
    .pdf-icon {
        font-size: 1.2rem;
    }
    
    .header-content {
        gap: 0.5rem;
    }
    
    .header-text { flex: 1; min-width: 0; padding: 0 2.75rem 0 5.5rem; }
    
    .user-greeting { font-size: 0.8rem; left: 0.75rem; }
    
    .widget-header h2 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
    
    .widget-header p {
        font-size: 0.75rem;
        line-height: 1.3;
        margin: 0;
    }
    
    .widget-header {
        padding: 1rem 0.75rem;
    }
}

/* Special optimization for very small sizes */
@media (max-width: 400px) {
    .download-pdf-button {
        font-size: 1.1rem;
        padding: 0.4rem;
        right: 0.5rem;
        width: 2.2rem;
        height: 2.2rem;
        min-width: 2.2rem;
    }
    
    .pdf-text {
        display: none;
    }
    
    .pdf-icon {
        font-size: 1.1rem;
    }
    
    .user-greeting { font-size: 0.75rem; left: 0.5rem; }
    
    .widget-header h2 {
        font-size: 0.9rem;
    }
    
    .widget-header p {
        font-size: 0.7rem;
    }
    
    .widget-header {
        padding: 0.75rem 0.5rem;
    }
    
    .header-text {
        padding-right: 0.25rem;
    }
}

/* Additional optimization for extra small sizes */
@media (max-width: 350px) {
    .download-pdf-button {
        font-size: 1rem;
        padding: 0.3rem;
        right: 0.4rem;
        width: 2rem;
        height: 2rem;
        min-width: 2rem;
    }
    
    .pdf-icon {
        font-size: 1rem;
    }
    
    .user-greeting { font-size: 0.7rem; left: 0.4rem; }
    
    .widget-header {
        padding: 0.6rem 0.4rem;
    }
    
    .header-text {
        padding-right: 0.2rem;
    }
}

.download-pdf-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--p-primary-600, #0057B7);
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Hover effects for responsive mode */
@media (max-width: 600px) {
    .download-pdf-button:hover {
        transform: translateY(-50%) translateY(-1px);
    }
}

.download-pdf-button:active {
    transform: translateY(-50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Active effects for responsive mode */
@media (max-width: 600px) {
    .download-pdf-button:active {
        transform: translateY(-50%);
    }
}

.download-pdf-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(-50%);
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Disabled state for responsive mode */
@media (max-width: 600px) {
    .download-pdf-button:disabled {
        transform: translateY(-50%);
    }
}

.chat-container {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--p-surface-50, #f8fafc) 0%, var(--p-surface-100, #f1f5f9) 100%);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--p-surface-200, #e2e8f0) 50%, transparent 100%);
}

.message {
    margin: 0;
    display: flex;
    align-items: flex-start;
    animation: messageSlideIn 0.3s ease-out;
}

.message.user { justify-content: flex-end; }
.message.bot { justify-content: flex-start; }

.message-text {
    max-width: 75%;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 0.875rem;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    margin: 0.5rem 0;
    font-weight: 400;
}

.message.user .message-text {
    color: var(--p-primary-contrast-color);
}

.message.bot .message-text {
    color: var(--p-text-color);
}

.message.error .message-text {
    color: white;
    font-weight: 500;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.user .message-text {
    background: linear-gradient(135deg, var(--p-primary-500, #1F70C9) 0%, var(--p-primary-600, #0057B7) 100%);
    color: #ffffff;
    border-bottom-right-radius: var(--p-border-radius-xs);
    border: 1px solid var(--p-primary-600, #0057B7);
    box-shadow: 0 2px 8px rgba(31, 112, 201, 0.3), 0 1px 3px rgba(0,0,0,0.1);
}

.message.bot .message-text {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: var(--p-border-radius-xs);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}

.message.bot .message-text::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--tw-ring-color, rgb(59 130 246 / .5));
    border-radius: var(--p-border-radius-sm);
}

/* Styles for voice messages */
.message.voice .message-text {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0c4a6e;
}

.message.voice .message-text::before {
    background: #0ea5e9;
}

.input-container {
    padding: 1.5rem;
    background: linear-gradient(180deg, var(--p-content-background) 0%, var(--p-surface-50, #f9fafb) 100%);
    border-top: 2px solid var(--p-surface-200, #e5e7eb);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    position: relative;
}

.input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--p-surface-300, #d1d5db) 50%, transparent 100%);
}

.input-group { 
    display: flex; 
    gap: 0.75rem; 
    align-items: center; 
    max-width: 100%; 
    position: relative;
}

.input-field-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.voice-button {
    background: linear-gradient(135deg, var(--p-primary-500, #1F70C9) 0%, var(--p-primary-600, #0057B7) 100%);
    color: white;
    border: 2px solid var(--p-primary-600, #0057B7);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
    position: relative;
}

.voice-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--p-primary-400, #60a5fa) 0%, var(--p-primary-600, #0057B7) 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.voice-button:hover {
    background: linear-gradient(135deg, var(--p-primary-600, #0057B7) 0%, var(--p-primary-700, #1d4ed8) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border-color: var(--p-primary-600, #0057B7);
}

.voice-button:hover::before { opacity: 1; }

.voice-button.recording {
    background: linear-gradient(135deg, var(--p-red-500, #ef4444) 0%, var(--p-red-600, #dc2626) 100%);
    color: white;
    border-color: var(--p-red-400, #f87171);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    position: relative;
}

.voice-button.recording::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid var(--p-red-400, #f87171);
    border-radius: 50%;
    animation: recordingPulse 1.5s ease-in-out infinite;
    z-index: -1;
}

.voice-button.recording .voice-icon {
    animation: recordingIconPulse 0.8s ease-in-out infinite;
}

.voice-button:active {
    transform: scale(0.95);
}

.voice-button:disabled {
    background: var(--p-form-field-disabled-background);
    color: var(--p-form-field-disabled-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-button:has(+ .voice-input-container .voice-button.recording) {
    background: linear-gradient(135deg, var(--p-green-500, #22c55e) 0%, var(--p-green-600, #16a34a) 100%);
    border-color: var(--p-green-400, #4ade80);
    animation: sendButtonPulse 2s ease-in-out infinite;
}

@keyframes sendButtonPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
        transform: scale(1.05);
    }
}


@keyframes recordingPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
        transform: scale(1.1);
    }
}

@keyframes recordingIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Voice message styling */
.message.user.voice .message-content {
    background: linear-gradient(135deg, var(--p-primary-500, #1F70C9) 0%, var(--p-primary-600, #0057B7) 100%);
    position: relative;
}

.message.user.voice .message-content::before {
    content: '🎤';
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    opacity: 0.8;
}

.message.user.voice .message-content::after {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.5rem;
    height: 0.5rem;
    background: var(--p-primary-500, #1F70C9);
    border-radius: 50%;
    opacity: 0.6;
}

.message-input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--p-surface-200, #e5e7eb);
    border-radius: var(--p-border-radius-xl);
    outline: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: var(--p-surface-0, #ffffff);
    color: var(--p-form-field-color);
    font-family: inherit;
    min-height: 3rem;
    resize: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.message-input:focus {
    border-color: var(--p-primary-500, #1F70C9);
    box-shadow: 0 0 0 3px rgba(31, 112, 201, 0.1), inset 0 1px 2px rgba(0,0,0,0.05);
}

.message-input:hover {
    border-color: var(--p-surface-300, #d1d5db);
    box-shadow: 0 0 0 1px rgba(31, 112, 201, 0.05), inset 0 1px 2px rgba(0,0,0,0.05);
}

.message-input::placeholder { color: var(--p-form-field-placeholder-color); }

.voice-message-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: var(--p-border-radius-xl);
    animation: voiceIndicatorSlideIn 0.3s ease-out;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 10;
    min-height: 3rem;
}

.voice-message-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.2), transparent);
    animation: voiceIndicatorShine 2s infinite;
}

.voice-icon-animated {
    font-size: 1.2rem;
    animation: voiceIconPulse 1.5s ease-in-out infinite;
}

.voice-message-text {
    color: #0c4a6e;
    font-weight: 500;
    font-size: 0.875rem;
    flex: 1;
}

.voice-message-duration {
    color: #0369a1;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(14, 165, 233, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.voice-message-remove {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-message-remove:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: scale(1.1);
}

@keyframes voiceIndicatorSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes voiceIndicatorShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes voiceIconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.send-button {
    background: linear-gradient(135deg, var(--p-primary-500, #1F70C9) 0%, var(--p-primary-600, #0057B7) 100%);
    color: white;
    border: 2px solid var(--p-primary-600, #0057B7);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
    position: relative;
}

.send-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--p-primary-400, #60a5fa) 0%, var(--p-primary-600, #0057B7) 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.send-button:hover {
    background: linear-gradient(135deg, var(--p-primary-600, #0057B7) 0%, var(--p-primary-700, #1d4ed8) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border-color: var(--p-primary-600, #0057B7);
}

.send-button:hover::before { opacity: 1; }

.send-button:active {
    background: var(--p-button-primary-active-background);
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.send-button:disabled {
    background: var(--p-form-field-disabled-background);
    color: var(--p-form-field-disabled-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.typing-indicator {
    display: none;
    margin: 0.5rem 0;
    margin-left: 0;
    max-width: 75%;
    position: relative;
    animation: typingSlideIn 0.3s ease-out;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
}

.typing-content::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--p-primary-500, #1F70C9);
    border-radius: 2px;
}

.typing-text {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    font-style: normal;
}

.typing-dots {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--p-primary-500, #1F70C9);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingSlideIn {
    from { 
        opacity: 0; 
        transform: translateY(10px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes dotBounce {
    0%, 60%, 100% { 
        opacity: 0.4; 
        transform: translateY(0) scale(0.8); 
    }
    30% { 
        opacity: 1; 
        transform: translateY(-8px) scale(1.1); 
    }
}

.file-link {
    color: var(--p-primary-500, #1F70C9);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    margin: 0.25rem 0.25rem 0.25rem 0;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--p-primary-500, #1F70C9);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    cursor: pointer;
    max-width: calc(100% - 0.25rem);
    word-break: break-word;
    vertical-align: top;
    flex-shrink: 0;
}

.file-link:hover {
    background: #ffffff;
    border-color: var(--p-primary-500, #1F70C9);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(31, 112, 201, 0.15), 0 1px 3px rgba(0,0,0,0.08);
    color: var(--p-primary-600, #0057B7);
}

.file-link:active { 
    transform: translateY(0); 
    box-shadow: 0 2px 4px rgba(0,0,0,0.08); 
}

.file-link-error {
    color: #dc2626;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    margin: 0.5rem 0.25rem 0.5rem 0;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    max-width: 100%;
    word-break: break-word;
    vertical-align: top;
}

.attachments-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.75rem 0 0.25rem 0;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.inline-attachment {
    display: block;
    margin: 0.5rem 0 0.25rem 0;
    width: fit-content;
}

.file-link::before {
    content: "📎";
    margin-right: 0.4rem;
    font-size: 0.9em;
}

.message.bot .message-text {
    margin-bottom: 0;
}

.message.bot .attachments-container {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.attachments-carousel {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 0.25rem 0.25rem;
    margin-top: 0.5rem;
    width: 100%;
    scroll-snap-type: x mandatory;
    border-top: 1px solid var(--p-surface-200, #e5e7eb);
    background: transparent;
}

.attachments-carousel::-webkit-scrollbar { height: 8px; }
.attachments-carousel::-webkit-scrollbar-track { background: var(--p-surface-100, #f1f5f9); border-radius: 8px; }
.attachments-carousel::-webkit-scrollbar-thumb { background: var(--p-surface-300, #cbd5e1); border-radius: 8px; }

.attachments-carousel .file-link {
    scroll-snap-align: start;
    white-space: nowrap;
    background: #f8fafc;
    border-color: #e5e7eb;
    border-left-color: var(--p-primary-500, #1F70C9);
}

.attachments-carousel .file-link {
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
}

.message.bot .message-text {
    margin-bottom: 0;
}

.message.bot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text {
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message .message-text {
    white-space: pre-line;
}



.chat-container::-webkit-scrollbar { width: 10px; }
.chat-container::-webkit-scrollbar-track { background: var(--p-surface-100, #f1f5f9); border-radius: var(--p-border-radius-sm); border: 1px solid var(--p-surface-200, #e2e8f0); }
.chat-container::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--p-surface-300, #cbd5e1) 0%, var(--p-surface-400, #94a3b8) 100%); border-radius: var(--p-border-radius-sm); border: 2px solid var(--p-surface-100, #f1f5f9); box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); }
.chat-container::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--p-surface-400, #94a3b8) 0%, var(--p-surface-500, #64748b) 100%); box-shadow: inset 0 1px 2px rgba(0,0,0,0.2); }

.status-indicator { position: fixed; top: 1rem; right: 1rem; padding: 0.875rem 1.25rem; border-radius: var(--p-border-radius-lg); font-size: 0.875rem; font-weight: 600; z-index: 1000; animation: slideIn 0.3s ease; box-shadow: 0 6px 20px rgba(0,0,0,0.15); backdrop-filter: blur(12px); border: 2px solid rgba(255,255,255,0.2); text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.status-connected { background: linear-gradient(135deg, var(--p-green-500, #22c55e) 0%, var(--p-green-600, #16a34a) 100%); color: white; border-color: var(--p-green-400, #4ade80); }
.status-disconnected { background: linear-gradient(135deg, var(--p-red-500, #ef4444) 0%, var(--p-red-600, #dc2626) 100%); color: white; border-color: var(--p-red-400, #f87171); }
.status-error { background: linear-gradient(135deg, var(--p-orange-500, #f97316) 0%, var(--p-orange-600, #ea580c) 100%); color: white; border-color: var(--p-orange-400, #fb923c); }
@keyframes slideIn { from { transform: translateX(100%) scale(0.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }

.auth-error-container { text-align: center; padding: 2rem; background: var(--p-surface-50, #f9fafb); border: 2px solid var(--p-red-200, #fecaca); border-radius: var(--p-border-radius-lg); margin: 1rem; }
.auth-error-icon { font-size: 3rem; margin-bottom: 1rem; color: var(--p-red-500, #ef4444); }
.auth-error-title { margin-bottom: 1rem; color: var(--p-red-600, #dc2626); font-size: 1.25rem; font-weight: 600; }
.auth-error-message { margin-bottom: 1.5rem; color: var(--p-text-muted-color); line-height: 1.5; }
.auth-error-help { font-size: 0.875rem; color: var(--p-text-muted-color); opacity: 0.8; }

.file-indicator {
    position: relative;
    display: inline;
    cursor: pointer;
    color: var(--p-primary-500, #1F70C9);
    font-weight: bold;
    margin: 0 2px;
    font-size: 0.9em;
    vertical-align: super;
    line-height: 1;
    white-space: nowrap;
}

.file-indicator:hover {
    color: var(--p-primary-600, #0057B7);
    text-shadow: 0 0 3px rgba(31, 112, 201, 0.3);
}

.file-indicator::after {
    content: '*';
    font-size: 0.8em;
}

.file-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #374151;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
}

.file-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
}

.file-indicator:hover .file-tooltip {
    opacity: 1;
    visibility: visible;
}

.message-text .file-indicator {
    display: inline;
    white-space: nowrap;
}

.message-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-text .file-indicator {
    word-wrap: normal;
    overflow-wrap: normal;
}

@media (max-width: 768px) {
    .widget-container { width: 100%; height: 100vh; border-radius: 0; }
    .message-text { max-width: 85%; }
    .chat-container { padding: 1rem; }
    .input-container { padding: 1rem; }
    .widget-header { padding: 1rem; }
    .auth-error-container { margin: 0.5rem; padding: 1.5rem; }
    
    .file-tooltip {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        max-width: 150px;
    }
}

.voice-instructions {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 8px;
    line-height: 1.4;
}

.voice-instructions small {
    font-size: inherit;
}

/* Auth Form Styles */
.auth-form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.auth-form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-form-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.auth-form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.auth-form-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0;
}

.auth-form {
    width: 100%;
    max-width: 320px;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.auth-form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--p-primary-500, #1F70C9);
    box-shadow: 0 0 0 3px rgba(31, 112, 201, 0.1);
}

.auth-form-actions {
    margin-top: 1.5rem;
}

.auth-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--p-primary-500, #1F70C9) 0%, var(--p-primary-600, #0057B7) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.auth-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--p-primary-600, #0057B7) 0%, var(--p-primary-700, #1d4ed8) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(31, 112, 201, 0.3);
}

.auth-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-top: 1rem;
    text-align: center;
}

.auth-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.auth-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.auth-error-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 0.5rem;
}

.auth-error-message {
    font-size: 0.9rem;
    color: #7f1d1d;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.auth-error-actions {
    margin-top: 1rem;
}

.auth-retry-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-retry-btn:hover {
    background: #b91c1c;
}

@media (max-width: 768px) {
    .auth-form-container {
        padding: 1rem;
    }
    
    .auth-form {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .auth-form-icon {
        font-size: 2.5rem;
    }
    
    .auth-form-title {
        font-size: 1.25rem;
    }
}


