/* CHATBOT WIDGET STYLES - COLLET BRANDING */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/outfit/outfit-300.ttf') format('truetype');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/outfit/outfit-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/outfit/outfit-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/outfit/outfit-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/outfit/outfit-700.ttf') format('truetype');
}

#chatbot-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --collet-magenta: #ff1d85;
    --collet-magenta-dark: #c41563;
    --collet-gradient: linear-gradient(135deg, #ff1d85 0%, #c41563 100%);
    --collet-glass-light: rgba(255, 255, 255, 0.82);
    --collet-glass-dark: rgba(20, 26, 38, 0.88);
}

/* Toggle Button */
.chat-toggle {
    width: 65px;
    height: 65px;
    background: var(--collet-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.65), 0 0 15px rgba(255, 255, 255, 0.35);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 12px 30px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.5);
}

.chat-toggle svg {
    transition: transform 0.4s ease;
}

.chat-toggle:hover svg {
    transform: rotate(5deg);
}

.notification-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 390px;
    height: 600px;
    background: var(--collet-glass-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    color: #1e293b;
    transform-origin: bottom right;
}

.chat-window.hidden {
    opacity: 0;
    transform: translateY(30px) scale(0.8);
    pointer-events: none;
}

/* Dark Theme */
.chat-window.dark {
    background: var(--collet-glass-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

/* Header */
.chat-header {
    background: var(--collet-gradient);
    color: white;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.header-info h3 {
    margin: 0 0 3px 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    opacity: 0.95;
    font-weight: 400;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.15); }
}

.header-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* GDPR Consent Overlay */
.gdpr-consent-overlay {
    position: absolute;
    top: 68px; /* Below header */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    transition: all 0.3s ease;
    text-align: center;
}

.chat-window.dark .gdpr-consent-overlay {
    background: rgba(15, 23, 42, 0.98);
}

.gdpr-content {
    max-width: 310px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: slideUp 0.5s ease;
}

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

.gdpr-content h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--collet-magenta);
}

.gdpr-content p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: #475569;
}

.chat-window.dark .gdpr-content p {
    color: #94a3b8;
}

.gdpr-content p a {
    color: var(--collet-magenta);
    text-decoration: underline;
    font-weight: 500;
}

.gdpr-content p a:hover {
    color: var(--collet-magenta-dark);
}

.gdpr-consent-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* Messages Container */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: transparent;
    transition: filter 0.3s ease;
    position: relative;
}

.chat-messages.hidden-content,
.chat-input-container.hidden-content {
    filter: blur(4px);
    pointer-events: none;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeInMsg 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes fadeInMsg {
    to { opacity: 1; transform: translateY(0); }
}

.message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--collet-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(255, 29, 133, 0.2);
}

.user-message .message-avatar {
    background: #0f172a;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.chat-window.dark .user-message .message-avatar {
    background: #f8fafc;
    color: #0f172a;
}

.message-content {
    flex: 1;
}

.message-text {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 13.5px;
    white-space: pre-wrap;
    background: #f1f5f9;
    color: #1e293b;
    border-top-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.chat-window.dark .message-text {
    background: #1e293b;
    color: #e2e8f0;
}

.user-message .message-text {
    background: var(--collet-gradient);
    color: white;
    border-top-left-radius: 16px;
    border-top-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(255, 29, 133, 0.15);
}

.message-text strong {
    font-weight: 600;
}

.message-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 5px;
    text-align: left;
    padding-left: 4px;
}

.user-message .message-time {
    text-align: right;
    padding-right: 4px;
}

/* Clickable Options / Suggestions in chat bubble */
.clickable-option {
    display: block;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 29, 133, 0.2);
    color: var(--collet-magenta);
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 12.5px;
    text-decoration: none;
}

.chat-window.dark .clickable-option {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 29, 133, 0.3);
}

.clickable-option:hover {
    background: var(--collet-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 29, 133, 0.15);
}

/* Chat Input Container */
.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
    z-index: 10;
}

.chat-window.dark .chat-input-container {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 25px;
    outline: none;
    font-size: 16px; /* Mindestens 16px verhindert iOS Safari Auto-Zoom beim Fokussieren */
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    font-family: inherit;
}

.chat-window.dark .chat-input {
    border: 1px solid #475569;
    background: rgba(30, 41, 59, 0.9);
    color: #f8fafc;
}

.chat-input:focus {
    border-color: var(--collet-magenta);
    box-shadow: 0 0 0 3px rgba(255, 29, 133, 0.12);
}

.chat-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.chat-window.dark .chat-input:disabled {
    background: #0f172a;
    border-color: #1e293b;
}

.chat-send {
    width: 44px;
    height: 44px;
    background: var(--collet-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(255, 29, 133, 0.2);
    flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(255, 29, 133, 0.3);
}

.chat-send:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

.chat-window.dark .chat-send:disabled {
    background: #334155;
    color: #64748b;
}

/* Forms in Chat Window */
.message-text form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    text-align: left;
    width: 100%;
    min-width: 240px;
}

.message-text form label {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    margin-bottom: -4px;
}

.chat-window.dark .message-text form label {
    color: #94a3b8;
}

.message-text form input[type="text"],
.message-text form input[type="email"],
.message-text form textarea {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 16px; /* Mindestens 16px verhindert iOS Safari Auto-Zoom beim Fokussieren */
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.chat-window.dark .message-text form input[type="text"],
.chat-window.dark .message-text form input[type="email"],
.chat-window.dark .message-text form textarea {
    border: 1px solid #475569;
    background: #0f172a;
    color: #f8fafc;
}

.message-text form input:focus,
.message-text form textarea:focus {
    border-color: var(--collet-magenta);
}

.message-text form textarea {
    resize: vertical;
    min-height: 50px;
}

.message-text form input[type="button"] {
    background: var(--collet-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    margin-top: 4px;
}

.message-text form input[type="button"]:hover {
    box-shadow: 0 4px 10px rgba(255, 29, 133, 0.2);
    transform: translateY(-1px);
}

/* File Upload in Form */
.form-file-upload {
    margin-top: 4px;
    margin-bottom: 4px;
}

.file-select-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.btn-select-file {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.chat-window.dark .btn-select-file {
    background: #1e293b;
    border: 1px solid #475569;
    color: #cbd5e1;
}

.btn-select-file:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.chat-window.dark .btn-select-file:hover {
    background: #334155;
    border-color: #64748b;
}

.selected-file-info {
    font-size: 11px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.chat-window.dark .selected-file-info {
    color: #94a3b8;
}


/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
    background: #f1f5f9;
    border-radius: 16px;
    border-top-left-radius: 2px;
    align-self: flex-start;
    width: 60px;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.chat-window.dark .typing-indicator {
    background: #1e293b;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* File Upload & Modals */
.file-upload-overlay, .agent-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

.upload-content, .modal-content {
    background: white;
    border-radius: 16px;
    padding: 25px;
    max-width: 290px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.dark .upload-content,
.chat-window.dark .modal-content {
    background: #1e293b;
    color: #f8fafc;
}

@keyframes scaleUp {
    from { transform: scale(0.9); } to { transform: scale(1); }
}

.upload-content h4, .modal-content h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 700;
}

.upload-content p, .modal-content p {
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

.chat-window.dark .upload-content p,
.chat-window.dark .modal-content p {
    color: #94a3b8;
}

.modal-actions, .upload-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--collet-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(255, 29, 133, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.chat-window.dark .btn-secondary {
    color: #e2e8f0;
    border: 1px solid #475569;
}

.btn-secondary:hover {
    background: #f1f5f9;
}

.chat-window.dark .btn-secondary:hover {
    background: #334155;
}

/* Utility Classes */
.hidden { display: none !important; }

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chatbot-widget {
        bottom: 15px;
        right: 15px;
    }
    .chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 110px);
        bottom: 75px;
    }
}

/* Blockiert jegliches Scrollen auf html und body, wenn der Chat geoeffnet ist */
html.chatbot-open,
body.chatbot-open {
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
}

/* 
   Blockiert das Scrollen aller direkten Kinder des Body, die NICHT der Chatbot sind.
   Dies loest das Scrollen bei Svelte-Apps, da dort oft ein innerer Container wie #app scrollt.
*/
html.chatbot-open body > *:not(#chatbot-widget) {
    overflow: hidden !important;
    height: 100vh !important;
    pointer-events: none !important; /* Verhindert auch, dass JavaScript-Scroll-Events auf der Hauptseite ausgeloest werden */
}

/* Fallback-Sperre ueber :has, falls JS blockiert oder verzoegert ist */
html:has(#chat-window:not(.hidden)),
body:has(#chat-window:not(.hidden)) {
    overflow: hidden !important;
}

html:has(#chat-window:not(.hidden)) body > *:not(#chatbot-widget),
body:has(#chat-window:not(.hidden)) > *:not(#chatbot-widget) {
    overflow: hidden !important;
    height: 100vh !important;
}

/* Honeypot field for bot protection */
.form-hp {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Attachment and Voice Buttons */
.attachment-btn, .voice-btn {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: #475569;
}

.chat-window.dark .attachment-btn, .chat-window.dark .voice-btn {
    background: #334155;
    color: #cbd5e1;
}

.attachment-btn:hover, .voice-btn:hover {
    background: var(--collet-gradient);
    color: white;
    transform: scale(1.05);
}

.attachment-btn:disabled, .voice-btn:disabled {
    background: #e2e8f0;
    color: #cbd5e1;
    cursor: not-allowed;
    transform: none !important;
}

.chat-window.dark .attachment-btn:disabled, .chat-window.dark .voice-btn:disabled {
    background: #1e293b;
    color: #475569;
}

.voice-btn.recording {
    background: #ef4444 !important;
    color: white !important;
    animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Upload Area within Upload Overlay */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 30px 20px;
    margin: 20px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: #f8fafc;
}

.chat-window.dark .upload-area {
    border-color: #475569;
    background: #0f172a;
}

.upload-area:hover, .upload-area.highlight {
    border-color: var(--collet-magenta);
    background: rgba(255, 29, 133, 0.04);
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}


