/* 6phene Chat Widget Styles */
/* Matches 6phene design system: Dark theme, Cyan accent (#38bdf8) */

/* Floating Chat Button - Hexagon Shape */
.chat-widget-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--color-primary), #0ea5e9);
    color: var(--color-bg-main);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4), 0 0 40px rgba(56, 189, 248, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    font-size: 1.5rem;
    font-weight: 600;
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
}

/* Hexagon glow effect */
.chat-widget-button::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--color-primary), #0ea5e9);
    clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
    z-index: -1;
    opacity: 0.5;
    filter: blur(8px);
    transition: opacity 0.3s;
}

.chat-widget-button:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 30px rgba(56, 189, 248, 0.6), 0 0 60px rgba(56, 189, 248, 0.3);
}

.chat-widget-button:hover::before {
    opacity: 0.8;
}

.chat-widget-button:active {
    transform: scale(0.95);
}

.chat-widget-button .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    border: 2px solid var(--color-bg-main);
}

/* Chat Modal Overlay */
.chat-widget-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-widget-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Chat Modal Container */
.chat-widget-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 420px;
    max-width: calc(100vw - 4rem);
    height: 600px;
    max-height: calc(100vh - 4rem);
    background: var(--color-bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(56, 189, 248, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    overflow: hidden;
}

.chat-widget-overlay.open .chat-widget-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-widget-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-widget-header .status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2s infinite;
}

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

.chat-widget-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.chat-widget-close:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Chat Messages Area */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.chat-message.user .chat-message-avatar {
    background: var(--color-primary);
    color: var(--color-bg-main);
}

.chat-message.assistant .chat-message-avatar {
    background: rgba(56, 189, 248, 0.2);
    color: var(--color-primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.chat-message-content {
    flex: 1;
    max-width: 75%;
}

.chat-message-bubble {
    padding: 0.875rem 1.125rem;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    font-size: 0.9375rem;
    word-wrap: break-word;
}

.chat-message.user .chat-message-bubble {
    background: var(--color-primary);
    color: var(--color-bg-main);
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-message-bubble {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.chat-message-typing {
    display: flex;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    border-bottom-left-radius: 4px;
}

.chat-message-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: typing 1.4s infinite;
}

.chat-message-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-message-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Chat Input Area */
.chat-widget-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
}

.chat-widget-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-widget-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-family-sans);
    font-size: 0.9375rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    transition: all 0.2s;
}

.chat-widget-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.chat-widget-input::placeholder {
    color: var(--color-text-muted);
}

.chat-widget-send {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    background: var(--color-primary);
    color: var(--color-bg-main);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.chat-widget-send:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.chat-widget-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-widget-send svg {
    width: 20px;
    height: 20px;
}

/* Error Message */
.chat-error {
    padding: 1rem;
    margin: 0.5rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius-md);
    color: #ef4444;
    font-size: 0.875rem;
    text-align: center;
}

/* Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-secondary);
}

.chat-welcome h4 {
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.chat-welcome p {
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-widget-button {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .chat-widget-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .chat-widget-overlay {
        background: transparent;
        backdrop-filter: none;
    }
}

/* Loading State */
.chat-widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}
