/* ===== Kowalski Chatbot Widget ===== */

.kowalski-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* Chat Toggle Button - The Penguin */
.kowalski-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--primary, #09e3dc);
    background: var(--bg-card, #161b22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(9, 227, 220, 0.3), 0 2px 8px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    padding: 0;
}

.kowalski-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(9, 227, 220, 0.45), 0 3px 12px rgba(0,0,0,0.5);
    border-color: #09e3dc;
}

.kowalski-toggle:active {
    transform: scale(0.96);
}

.kowalski-toggle .penguin-icon {
    width: 48px;
    height: 48px;
    transition: transform 0.3s ease;
}

.kowalski-toggle:hover .penguin-icon {
    transform: rotate(-8deg);
}

.kowalski-toggle .close-icon {
    display: none;
    font-size: 24px;
    color: var(--text-bright, #fff);
}

.kowalski-widget.open .kowalski-toggle .penguin-icon {
    display: none;
}

.kowalski-widget.open .kowalski-toggle .close-icon {
    display: block;
}

/* Greeting bubble */
.kowalski-greeting {
    position: absolute;
    bottom: 76px;
    right: 0;
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border, #30363d);
    border-radius: 12px;
    padding: 10px 16px;
    white-space: nowrap;
    font-size: 0.875rem;
    color: var(--text, #e6edf3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.kowalski-greeting.show {
    opacity: 1;
    transform: translateY(0);
}

.kowalski-greeting::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: var(--bg-card, #161b22);
    border-right: 1px solid var(--border, #30363d);
    border-bottom: 1px solid var(--border, #30363d);
    transform: rotate(45deg);
}

/* Notification dot */
.kowalski-toggle .notif-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    background: #f85149;
    border-radius: 50%;
    border: 2px solid var(--bg-card, #161b22);
    display: none;
}

/* Chat Window */
.kowalski-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: var(--bg-dark, #0d1117);
    border: 1px solid var(--border, #30363d);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(9, 227, 220, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn 0.25s ease;
}

.kowalski-widget.open .kowalski-chat {
    display: flex;
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.kowalski-chat-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(9, 227, 220, 0.12), rgba(9, 227, 220, 0.04));
    border-bottom: 1px solid var(--border, #30363d);
    display: flex;
    align-items: center;
    gap: 12px;
}

.kowalski-chat-header .header-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.kowalski-chat-header .header-info h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-bright, #fff);
}

.kowalski-chat-header .header-info p {
    margin: 2px 0 0 0;
    font-size: 0.75rem;
    color: var(--primary, #09e3dc);
}

.kowalski-chat-header .header-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.kowalski-chat-header .header-actions button {
    background: none;
    border: none;
    color: var(--text-muted, #7d8590);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.kowalski-chat-header .header-actions button:hover {
    color: var(--text-bright, #fff);
    background: rgba(255,255,255,0.08);
}

/* Chat Messages */
.kowalski-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 280px;
    max-height: 340px;
    scrollbar-width: thin;
    scrollbar-color: var(--border, #30363d) transparent;
}

.kowalski-messages::-webkit-scrollbar {
    width: 5px;
}

.kowalski-messages::-webkit-scrollbar-track {
    background: transparent;
}

.kowalski-messages::-webkit-scrollbar-thumb {
    background: var(--border, #30363d);
    border-radius: 4px;
}

.kowalski-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.kowalski-msg.bot {
    align-self: flex-start;
}

.kowalski-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.kowalski-msg .msg-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin-top: 2px;
}

.kowalski-msg.user .msg-avatar {
    display: none;
}

.kowalski-msg .msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text, #e6edf3);
    word-wrap: break-word;
}

.kowalski-msg.bot .msg-bubble {
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border, #30363d);
    border-bottom-left-radius: 4px;
}

.kowalski-msg.user .msg-bubble {
    background: linear-gradient(135deg, rgba(9, 227, 220, 0.2), rgba(9, 227, 220, 0.1));
    border: 1px solid rgba(9, 227, 220, 0.3);
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.kowalski-typing {
    display: none;
    align-self: flex-start;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}

.kowalski-typing.show {
    display: flex;
}

.kowalski-typing .msg-avatar {
    width: 28px;
    height: 28px;
}

.kowalski-typing .typing-dots {
    display: flex;
    gap: 4px;
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border, #30363d);
    padding: 10px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.kowalski-typing .typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary, #09e3dc);
    animation: typingBounce 1.2s infinite;
    opacity: 0.5;
}

.kowalski-typing .typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.kowalski-typing .typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick Actions */
.kowalski-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 8px;
}

.kowalski-quick-btn {
    background: rgba(9, 227, 220, 0.08);
    border: 1px solid rgba(9, 227, 220, 0.2);
    color: var(--primary, #09e3dc);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.kowalski-quick-btn:hover {
    background: rgba(9, 227, 220, 0.15);
    border-color: var(--primary, #09e3dc);
}

/* Chat Input */
.kowalski-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border, #30363d);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: rgba(0,0,0,0.2);
}

.kowalski-input-area textarea {
    flex: 1;
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border, #30363d);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text, #e6edf3);
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

.kowalski-input-area textarea:focus {
    border-color: var(--primary, #09e3dc);
}

.kowalski-input-area textarea::placeholder {
    color: var(--text-muted, #7d8590);
}

.kowalski-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--primary, #09e3dc);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.kowalski-send-btn:hover {
    background: var(--primary-hover, #08ccc4);
    transform: scale(1.05);
}

.kowalski-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.kowalski-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Ticket hint */
.kowalski-ticket-hint {
    padding: 8px 16px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted, #7d8590);
    border-top: 1px solid var(--border, #30363d);
    background: rgba(0,0,0,0.15);
}

.kowalski-ticket-hint a {
    color: var(--primary, #09e3dc);
    text-decoration: none;
}

.kowalski-ticket-hint a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .kowalski-chat {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 72px;
        max-height: 70vh;
    }

    .kowalski-toggle {
        width: 56px;
        height: 56px;
    }

    .kowalski-toggle .penguin-icon {
        width: 40px;
        height: 40px;
    }
}

/* ===== Configurator Helper Banner ===== */
.kowalski-config-helper {
    margin-bottom: 20px;
    animation: kowalskiSlideIn 0.5s ease-out;
}

@keyframes kowalskiSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.kowalski-config-helper-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(9, 227, 220, 0.08) 0%, rgba(9, 227, 220, 0.03) 100%);
    border: 1px solid rgba(9, 227, 220, 0.25);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kowalski-config-helper-inner:hover {
    background: linear-gradient(135deg, rgba(9, 227, 220, 0.14) 0%, rgba(9, 227, 220, 0.06) 100%);
    border-color: rgba(9, 227, 220, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(9, 227, 220, 0.12);
}

.kowalski-config-helper-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(9, 227, 220, 0.3));
}

.kowalski-config-helper-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.kowalski-config-helper-text strong {
    color: var(--primary, #09e3dc);
    font-size: 0.9rem;
    font-weight: 600;
}

.kowalski-config-helper-text span {
    color: var(--text-secondary, #8b949e);
    font-size: 0.8rem;
}

.kowalski-config-helper-arrow {
    flex-shrink: 0;
    color: var(--primary, #09e3dc);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.kowalski-config-helper-inner:hover .kowalski-config-helper-arrow {
    opacity: 1;
    transform: translateX(3px);
}
