/* Luna AI Chat Widget - Supabase Studio Dark Theme */

/* Toggle button */
#lc-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, hsl(270 50% 55%), hsl(220 60% 50%));
    color: white;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
}
#lc-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
#lc-toggle.lc-active {
    background: hsl(200 10% 30%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Chat panel */
#lc-panel {
    position: fixed;
    bottom: 76px;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: hsl(var(--background-default, 200 10% 10%));
    border: 1px solid hsl(var(--border-default, 200 10% 22%));
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--font-custom, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}
#lc-panel.lc-open {
    display: flex;
    animation: lc-slide-in 0.2s ease-out;
}
@keyframes lc-slide-in {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.lc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border-default, 200 10% 20%));
    flex-shrink: 0;
    background: hsl(var(--background-surface, 200 10% 12%));
}
.lc-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lc-header-text {
    display: flex;
    flex-direction: column;
}
.lc-avatar, .lc-welcome-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(270 50% 55%), hsl(220 60% 50%));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.lc-title {
    font-weight: 600;
    font-size: 14px;
    color: hsl(var(--foreground-default, 0 0% 95%));
    line-height: 1.2;
}
.lc-subtitle {
    font-size: 11px;
    color: hsl(var(--foreground-muted, 0 0% 50%));
    line-height: 1.2;
}
.lc-minimize {
    background: none;
    border: none;
    color: hsl(var(--foreground-muted, 0 0% 50%));
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}
.lc-minimize:hover {
    color: hsl(var(--foreground-default, 0 0% 90%));
    background: hsl(var(--background-default, 200 10% 16%));
}

/* Messages area */
.lc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome */
.lc-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 8px;
    text-align: center;
}
.lc-welcome-avatar {
    width: 48px;
    height: 48px;
    font-size: 22px;
    margin-bottom: 12px;
}
.lc-welcome-title {
    font-size: 15px;
    font-weight: 600;
    color: hsl(var(--foreground-default, 0 0% 90%));
    margin: 0 0 4px;
}
.lc-welcome-sub {
    font-size: 12px;
    color: hsl(var(--foreground-muted, 0 0% 50%));
    margin: 0 0 16px;
}
.lc-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.lc-suggestion {
    background: hsl(var(--background-surface, 200 10% 14%));
    border: 1px solid hsl(var(--border-default, 200 10% 22%));
    border-radius: 8px;
    padding: 8px 12px;
    color: hsl(var(--foreground-default, 0 0% 80%));
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.lc-suggestion:hover {
    border-color: hsl(270 50% 55% / 0.5);
    background: hsl(var(--background-surface, 200 10% 16%));
    color: hsl(var(--foreground-default, 0 0% 95%));
}

/* Message bubbles */
.lc-msg {
    display: flex;
    gap: 8px;
    max-width: 100%;
}
.lc-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.lc-msg-assistant {
    align-self: flex-start;
}
.lc-msg-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(270 50% 55%), hsl(220 60% 50%));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 2px;
}
.lc-msg-body {
    max-width: 85%;
    min-width: 0;
}
.lc-msg-content {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.lc-msg-user .lc-msg-content {
    background: hsl(270 50% 55% / 0.2);
    color: hsl(var(--foreground-default, 0 0% 90%));
    border-bottom-right-radius: 4px;
}
.lc-msg-assistant .lc-msg-content {
    background: hsl(var(--background-surface, 200 10% 14%));
    color: hsl(var(--foreground-default, 0 0% 85%));
    border-bottom-left-radius: 4px;
}

/* Code in messages */
.lc-code-block {
    background: hsl(var(--background-default, 200 10% 7%));
    border: 1px solid hsl(var(--border-default, 200 10% 18%));
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.4;
    font-family: var(--font-source-code-pro, 'Source Code Pro', monospace);
    white-space: pre;
}
.lc-code-block code { font-family: inherit; }
.lc-inline-code {
    background: hsl(var(--background-default, 200 10% 7%));
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: var(--font-source-code-pro, 'Source Code Pro', monospace);
}

/* Loading animation */
.lc-dots {
    display: inline-flex;
    gap: 3px;
}
.lc-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(var(--foreground-muted, 0 0% 50%));
    animation: lc-bounce 1.4s ease-in-out infinite;
}
.lc-dots span:nth-child(2) { animation-delay: 0.16s; }
.lc-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes lc-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.lc-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid hsl(var(--border-default, 200 10% 20%));
    flex-shrink: 0;
    background: hsl(var(--background-surface, 200 10% 12%));
}
.lc-input {
    flex: 1;
    background: hsl(var(--background-default, 200 10% 10%));
    border: 1px solid hsl(var(--border-default, 200 10% 22%));
    border-radius: 8px;
    padding: 8px 12px;
    color: hsl(var(--foreground-default, 0 0% 90%));
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
}
.lc-input:focus {
    border-color: hsl(270 50% 55% / 0.6);
}
.lc-input::placeholder {
    color: hsl(var(--foreground-muted, 0 0% 38%));
}
.lc-send {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, hsl(270 50% 55%), hsl(220 60% 50%));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.lc-send:hover {
    filter: brightness(1.15);
}

/* Scrollbar */
.lc-messages::-webkit-scrollbar {
    width: 6px;
}
.lc-messages::-webkit-scrollbar-track {
    background: transparent;
}
.lc-messages::-webkit-scrollbar-thumb {
    background: hsl(var(--border-default, 200 10% 25%));
    border-radius: 3px;
}
.lc-messages::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--border-default, 200 10% 35%));
}

/* Responsive */
@media (max-width: 480px) {
    #lc-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
