/* Premium Chat Widget Styles */
:root {
    --chat-primary: #1a1a2e;
    --chat-bg: rgba(255, 255, 255, 0.8);
    --chat-text: #1a1a2e;
    --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    --chat-bubble-self: #f0f0f0;
    --chat-bubble-admin: #1a1a2e;
    --chat-text-admin: #ffffff;
}

[data-theme="dark"] {
    --chat-bg: rgba(26, 26, 46, 0.85);
    --chat-text: #ffffff;
    --chat-bubble-self: #2a2a4a;
    --chat-bubble-admin: #ffffff;
    --chat-text-admin: #1a1a2e;
}

.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.chat-button:hover {
    transform: scale(1.1);
}

.chat-button svg {
    width: 30px;
    height: 30px;
}

.chat-window {
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--chat-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: var(--chat-shadow);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

.chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    visibility: visible;
}

.chat-header {
    padding: 24px;
    background: var(--chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.chat-header-title {
    font-weight: 600;
    font-size: 16px;
}

.chat-header-status {
    font-size: 12px;
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: messageIn 0.3s ease-out forwards;
}

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

.chat-message.customer {
    align-self: flex-end;
    background: var(--chat-bubble-self);
    color: var(--chat-text);
    border-bottom-right-radius: 4px;
}

.chat-message.admin {
    align-self: flex-start;
    background: var(--chat-bubble-admin);
    color: var(--chat-text-admin);
    border-bottom-left-radius: 4px;
}

.chat-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.5;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    padding: 12px 16px;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    color: var(--chat-text);
    transition: background 0.3s;
}

[data-theme="dark"] .chat-input {
    background: rgba(255, 255, 255, 0.1);
}

.chat-send {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-send:hover {
    transform: scale(1.1);
}

.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4d4d;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-button {
        width: 52px;
        height: 52px;
    }

    .chat-window {
        /* On mobile, chat window sits above the button, not full screen */
        width: calc(100vw - 32px);
        max-width: 380px;
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        right: 0;
        margin-bottom: 0;
        border-radius: 16px;
        position: fixed;
    }
}
