/* SKG Chatbot Widget - Drift-style floating chat */

:root {
    --skg-brand-color: #8B5CF6;
}

/* Floating Button */
.skg-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--skg-brand-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
    transition: transform 0.2s, box-shadow 0.2s;
}

.skg-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

.skg-chat-button img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.skg-chat-button.hidden {
    display: none;
}

/* Chat Panel */
.skg-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: 70vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.skg-chat-panel.active {
    display: flex;
    animation: skgSlideUp 0.3s ease-out;
}

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

/* Header */
.skg-chat-header {
    background: var(--skg-brand-color);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.skg-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.skg-chat-avatar img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* Use bank icon for avatar */
.skg-chat-avatar {
    background-image: url('new-bank-picto.svg');
    background-size: 24px 24px;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1); /* Convert red icon to white */
}

.skg-chat-avatar img {
    display: none; /* Hide the robot icon */
}

.skg-chat-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.skg-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.skg-status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: skgPulse 2s infinite;
}

@keyframes skgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.skg-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.skg-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
.skg-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
}

.skg-message {
    margin-bottom: 16px;
    display: flex;
    animation: skgFadeIn 0.3s ease-out;
}

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

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

.skg-message.assistant {
    justify-content: flex-start;
}

.skg-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.skg-message.assistant .skg-message-bubble {
    background: var(--skg-brand-color);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.skg-message.user .skg-message-bubble {
    background: #e5e7eb;
    color: #111827;
    border-bottom-right-radius: 4px;
}

/* Formatted Content Styles */
.skg-message-bubble a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s;
}

.skg-message-bubble a:hover {
    opacity: 0.8;
}

.skg-message.assistant .skg-message-bubble a {
    color: #fff;
    text-decoration: underline;
}

.skg-message.user .skg-message-bubble a {
    color: var(--skg-brand-color);
}

.skg-message-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
}

.skg-message-bubble ul,
.skg-message-bubble ol {
    margin: 8px 0;
    padding-left: 24px;
}

.skg-message-bubble li {
    margin: 4px 0;
    line-height: 1.6;
}

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

.skg-message-bubble p:first-child {
    margin-top: 0;
}

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

.skg-message-bubble strong,
.skg-message-bubble b {
    font-weight: 600;
}

.skg-message-bubble em,
.skg-message-bubble i {
    font-style: italic;
}

.skg-message-bubble h1,
.skg-message-bubble h2,
.skg-message-bubble h3,
.skg-message-bubble h4,
.skg-message-bubble h5,
.skg-message-bubble h6 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.skg-message-bubble h4 {
    font-size: 16px;
}

.skg-message-bubble h5 {
    font-size: 15px;
}

.skg-message-bubble h6 {
    font-size: 14px;
}

/* Media Container (Images and Post Cards) */
.skg-media-container {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skg-media-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.skg-message.assistant .skg-media-card {
    background: rgba(255, 255, 255, 0.15);
}

.skg-message.user .skg-media-card {
    background: rgba(0, 0, 0, 0.05);
}

.skg-media-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px 8px 0 0;
}

.skg-media-content {
    padding: 12px;
}

.skg-media-title {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.skg-message.assistant .skg-media-title {
    color: #fff;
}

.skg-message.user .skg-media-title {
    color: #111827;
}

.skg-media-button {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
    margin-top: 4px;
}

.skg-media-button:hover {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

.skg-message.user .skg-media-button {
    background: var(--skg-brand-color);
    color: #fff;
}

.skg-message.user .skg-media-button:hover {
    opacity: 0.9;
}

.skg-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Sources */
.skg-message-sources {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.skg-message-sources strong {
    display: block;
    margin-bottom: 4px;
}

.skg-source-item {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 4px;
    margin-bottom: 4px;
}

/* Quick Replies / Chips */
.skg-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px;
    animation: skgFadeIn 0.3s ease-out;
}

.skg-quick-reply {
    padding: 8px 16px;
    border: 1.5px solid var(--skg-brand-color);
    background: #fff;
    color: var(--skg-brand-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.skg-quick-reply:hover {
    background: var(--skg-brand-color);
    color: #fff;
    transform: translateY(-2px);
}

/* Input Area */
.skg-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.skg-consent-notice {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.4;
}

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

.skg-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.skg-chat-input:focus {
    border-color: var(--skg-brand-color);
}

.skg-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--skg-brand-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.skg-send-button:hover:not(:disabled) {
    transform: scale(1.1);
}

.skg-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.skg-send-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Loading Indicator */
.skg-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.skg-typing-dot {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: skgTyping 1.4s infinite;
}

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

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

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

/* Welcome Message */
.skg-welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.skg-welcome-message h4 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 18px;
}

.skg-welcome-message p {
    margin: 0 0 20px;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .skg-chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .skg-chat-header {
        border-radius: 0;
    }
    
    .skg-chat-button {
        bottom: 16px;
        right: 16px;
    }
}

/* Scrollbar styling */
.skg-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.skg-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.skg-chat-messages::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.skg-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Post Cards */
.skg-posts-container {
    margin-top: 12px;
}

.skg-post-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.skg-post-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.skg-post-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.skg-post-content {
    padding: 16px;
}

.skg-post-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.skg-post-excerpt {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skg-post-button {
    display: inline-block;
    background: var(--skg-brand-color);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.skg-post-button:hover {
    background: #7c3aed;
    color: white;
    text-decoration: none;
}

/* Responsive post cards */
@media (max-width: 480px) {
    .skg-post-card {
        margin-bottom: 8px;
    }
    
    .skg-post-content {
        padding: 12px;
    }
    
    .skg-post-title {
        font-size: 15px;
    }
    
    .skg-post-excerpt {
        font-size: 13px;
    }
    
    .skg-post-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Default Action Buttons */
.skg-default-buttons {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.skg-default-btn {
    flex: 1;
    padding: 8px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.skg-default-btn:hover {
    background: var(--skg-brand-color);
    color: white;
    border-color: var(--skg-brand-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.skg-default-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

