/**
 * FLUX.HAWK Chat Panel Styles
 * Wiener Schmäh meets Cyber-Bot
 * 
 * @package WienIndex
 * @version 1.0.0
 */

/* ===== Chat Panel Container ===== */
.flux-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    max-height: 500px;
    background: var(--chat-bg, rgba(18, 18, 24, 0.98));
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 40px rgba(0, 212, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.flux-chat-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* ===== Header ===== */
.flux-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(255, 0, 110, 0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.flux-chat__header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flux-chat__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    position: relative;
}

.flux-chat__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.flux-chat__avatar img.talking {
    animation: avatarTalk 0.15s ease-in-out infinite;
}

@keyframes avatarTalk {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.95); }
}

.flux-chat__title {
    display: flex;
    flex-direction: column;
}

.flux-chat__name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    letter-spacing: 0.5px;
}

.flux-chat__status {
    font-size: 0.75rem;
    color: #00d4ff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.flux-chat__status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #00ff88;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

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

.flux-chat__header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flux-chat__speak-toggle,
.flux-chat__close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.flux-chat__speak-toggle:hover,
.flux-chat__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.flux-chat__speak-toggle.muted {
    color: rgba(255, 100, 100, 0.7);
}

.flux-chat__speak-toggle.muted:hover {
    color: #ff6464;
}

/* ===== Messages Container ===== */
.flux-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.flux-chat__messages::-webkit-scrollbar {
    width: 6px;
}

.flux-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.flux-chat__messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Welcome Message */
.flux-chat__welcome {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
}

.flux-chat__welcome-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: #00d4ff;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-15deg); }
}

/* ===== Messages ===== */
.flux-chat__message {
    display: flex;
    max-width: 85%;
    animation: messageIn 0.3s ease-out;
}

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

.flux-chat__message--user {
    align-self: flex-end;
}

.flux-chat__message--bot {
    align-self: flex-start;
}

.flux-chat__message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.flux-chat__message--user .flux-chat__message-content {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    border-bottom-right-radius: 4px;
}

.flux-chat__message--bot .flux-chat__message-content {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.flux-chat__message--error .flux-chat__message-content {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.3);
}

/* Typing Indicator */
.flux-chat__typing {
    align-self: flex-start;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.flux-chat__typing-dots {
    display: flex;
    gap: 4px;
}

.flux-chat__typing-dots .dot {
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.flux-chat__typing-dots .dot:nth-child(2) {
    animation-delay: 0.15s;
}

.flux-chat__typing-dots .dot:nth-child(3) {
    animation-delay: 0.3s;
}

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

/* ===== Input Area ===== */
.flux-chat__input-area {
    padding: 16px 20px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.flux-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.flux-chat__suggestion {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.flux-chat__suggestion:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
    color: #fff;
}

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

.flux-chat__input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.flux-chat__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.flux-chat__input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.flux-chat__send {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.flux-chat__send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.flux-chat__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== FLUX Theme Overrides ===== */
[data-theme="flux"] .flux-chat-panel {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 0, 110, 0.2),
        0 0 40px rgba(255, 0, 110, 0.15);
}

[data-theme="flux"] .flux-chat__header {
    background: linear-gradient(135deg, rgba(255, 0, 110, 0.15) 0%, rgba(255, 200, 0, 0.1) 100%);
}

[data-theme="flux"] .flux-chat__avatar {
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.4);
}

[data-theme="flux"] .flux-chat__status {
    color: #ff006e;
}

[data-theme="flux"] .flux-chat__status::before {
    background: #ff006e;
}

[data-theme="flux"] .flux-chat__welcome-icon {
    color: #ff006e;
}

[data-theme="flux"] .flux-chat__message--user .flux-chat__message-content {
    background: linear-gradient(135deg, #ff006e 0%, #ff3388 100%);
}

[data-theme="flux"] .flux-chat__typing-dots .dot {
    background: #ff006e;
}

[data-theme="flux"] .flux-chat__suggestion:hover {
    background: rgba(255, 0, 110, 0.15);
    border-color: rgba(255, 0, 110, 0.3);
}

[data-theme="flux"] .flux-chat__input:focus {
    border-color: rgba(255, 0, 110, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 0, 110, 0.1);
}

[data-theme="flux"] .flux-chat__send {
    background: linear-gradient(135deg, #ff006e 0%, #ff3388 100%);
}

[data-theme="flux"] .flux-chat__send:hover:not(:disabled) {
    box-shadow: 0 5px 20px rgba(255, 0, 110, 0.4);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 480px) {
    .flux-chat-panel {
        bottom: 80px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 60vh;
    }
    
    .flux-chat__header {
        padding: 14px 16px;
    }
    
    .flux-chat__messages {
        padding: 16px;
        max-height: calc(60vh - 200px);
    }
    
    .flux-chat__input-area {
        padding: 12px 16px 16px;
    }
    
    .flux-chat__suggestions {
        gap: 6px;
    }
    
    .flux-chat__suggestion {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    .flux-chat-panel,
    .flux-chat__message,
    .flux-chat__avatar img,
    .flux-chat__typing-dots .dot,
    .flux-chat__welcome-icon {
        animation: none !important;
        transition: none !important;
    }
}
