/* Chat Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 72px;
    height: 72px;
    background-color: #02111B;
    color: #00A7E1;
    border: 2px solid #00A7E1;
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: all 0.3s ease;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    background-color: rgba(2, 17, 27, 0.9);
}

.chat-toggle-logo {
    width: 42px;
    height: 42px;
    filter: brightness(0) saturate(100%) invert(64%) sepia(94%) saturate(3937%) hue-rotate(174deg) brightness(101%) contrast(101%);
}

.chat-toggle.chat-hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 384px;
    height: 600px;
    background: #02111B;
    border: 1px solid #0F2944;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    z-index: 40;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.chat-widget.chat-open {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid #0F2944;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #02111B;
    border-radius: 16px 16px 0 0;
}

.chat-title {
    color: #00A7E1;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.chat-close {
    background: none;
    border: none;
    color: #00A7E1;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chat-close:hover {
    background: rgba(0, 167, 225, 0.1);
}

/* Message List */
.message-list {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    background: #02111B;
}

.message-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.user-message {
    justify-content: flex-end;
}

.model-message {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap; /* KRITISK - bevarer linjeskift */
    word-wrap: break-word;
}

.user-bubble {
    background: #00A7E1;
    color: white;
    border-bottom-right-radius: 4px;
}

.model-bubble {
    background: #0F2944;
    color: #E5F4FD;
    border-bottom-left-radius: 4px;
    border: 1px solid #1E3A52;
    margin-right: 32px;
    white-space: pre-wrap; /* KRITISK for AI-svar */
}

.message-avatar {
    width: 32px;
    height: 32px;
    background: #00A7E1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Chat Form */
.chat-form {
    padding: 20px 24px;
    border-top: 1px solid #0F2944;
    background: #02111B;
    border-radius: 0 0 16px 16px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #0F2944;
    border-radius: 12px;
    background: #0F2944;
    color: #E5F4FD;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: #00A7E1;
}

.chat-input::placeholder {
    color: #6B7280;
}

.chat-send-button {
    background: #00A7E1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-send-button:hover {
    background: #0891B2;
}

.chat-send-button:disabled {
    background: #6B7280;
    cursor: not-allowed;
}

/* Loading Animation */
.loading-bubble {
    background: #0F2944;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    border: 1px solid #1E3A52;
    margin-right: 32px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #00A7E1;
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Scrollbar */
.scrollbar-thin::-webkit-scrollbar {
    width: 8px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #0A1A2A;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: #00A7E1;
    border-radius: 4px;
    border: 2px solid #0A1A2A;
}

.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: #00A7E1 #0A1A2A;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 10px;
    }
    
    .chat-toggle {
        right: 20px;
        bottom: 20px;
    }
}

/* ===== CONSENT MODAL STYLING ===== */
.chat-consent-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-consent-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
}

.chat-consent-container {
    background: #02111B !important;
    color: #E5F4FD !important;
    border: 1px solid #0F2944;
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s ease;
}

.chat-consent-overlay.show .chat-consent-container {
    transform: scale(1) translateY(0);
}

.chat-consent-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #0F2944;
}

.chat-consent-header h3 {
    margin: 0 0 8px 0 !important;
    font-size: 20px !important;
    font-weight: 600;
    color: #00A7E1 !important;
}

.chat-consent-header p {
    margin: 0 !important;
    color: rgba(229, 244, 253, 0.8) !important;
    font-size: 14px !important;
    line-height: 1.5;
}

.chat-consent-info {
    padding: 20px 24px;
    background: rgba(15, 41, 68, 0.5);
    border: 1px solid #0F2944;
    border-radius: 12px;
    margin: 0 24px 20px;
}

.chat-consent-info h4 {
    margin: 0 0 12px 0 !important;
    font-size: 16px !important;
    font-weight: 600;
    color: #00A7E1 !important;
}

.chat-consent-info ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.chat-consent-info ul li {
    color: #E5F4FD !important;
    font-size: 14px !important;
    line-height: 1.6;
    margin-bottom: 4px;
}

.chat-consent-buttons {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
}

.consent-chat-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-align: center;
}

.consent-chat-btn-primary {
    background: #00A7E1;
    color: white;
}

.consent-chat-btn-primary:hover {
    background: #0891B2;
    transform: translateY(-1px);
}

.consent-chat-btn-secondary {
    background: #6b7280;
    color: white;
}

.consent-chat-btn-secondary:hover {
    background: #4b5563;
}

.chat-consent-footer {
    padding: 20px 24px;
    border-top: 1px solid #0F2944;
    background: rgba(4, 28, 44, 0.3);
    border-radius: 0 0 16px 16px;
    text-align: center;
}

.consent-legal-text {
    margin: 0 0 12px 0 !important;
    font-size: 12px !important;
    color: rgba(229, 244, 253, 0.7) !important;
    line-height: 1.4;
}

.privacy-link {
    font-size: 12px;
    color: #00A7E1;
    text-decoration: none;
}

.privacy-link:hover {
    text-decoration: underline;
}

.chat-declined-message {
    padding: 24px;
    text-align: center;
    display: none;
}

.chat-declined-message.show {
    display: block;
}

.chat-declined-message h3 {
    margin: 0 0 16px 0 !important;
    font-size: 18px !important;
    font-weight: 600;
    color: #00A7E1 !important;
}

.chat-declined-message p {
    margin: 0 0 16px 0 !important;
    color: #E5F4FD !important;
    font-size: 14px !important;
}

.alternative-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alternative-contact a {
    color: #00A7E1 !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.alternative-contact a:hover {
    text-decoration: underline;
}

/* Override main site CSS */
.chat-consent-overlay p,
.chat-consent-overlay h3,
.chat-consent-overlay h4 {
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    margin: inherit !important;
}

/* Modal state management */
body.modal-open {
    overflow: hidden !important;
}

.hidden {
    display: none !important;
}