/* Portal AI - Design V2 (Sleek Apple Style) */

:root {
    --ai-orb-size: 56px;
    --ai-glass-bg: rgba(20, 20, 20, 0.65);
    --ai-glass-border: rgba(255, 255, 255, 0.12);
    --ai-accent-gradient: linear-gradient(135deg, #0A84FF, #BF5AF2);
    --ai-text-primary: #F5F5F7;
    --ai-text-secondary: #86868b;
}

/* --- The Orb Button --- */
.ai-orb-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: var(--ai-orb-size);
    height: var(--ai-orb-size);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-orb-container:hover {
    transform: scale(1.1);
}

.ai-orb-container.active {
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}

.ai-orb-core {
    width: 100%;
    height: 100%;
    background: black;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

.ai-orb-glow {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    background: var(--ai-accent-gradient);
    filter: blur(8px);
    opacity: 0.6;
    animation: orb-pulse 3s infinite ease-in-out;
    z-index: 1;
}

.ai-icon {
    width: 24px;
    height: 24px;
    color: white;
    opacity: 0.9;
}

@keyframes orb-pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

/* --- Glass Panel --- */
.ai-glass-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 360px;
    height: 480px;
    background: var(--ai-glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--ai-glass-border);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    
    transform-origin: bottom right;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-glass-panel.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* --- Header --- */
.ai-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ai-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--ai-text-primary);
    background: var(--ai-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-close-btn {
    background: none;
    border: none;
    color: var(--ai-text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.ai-close-btn:hover {
    color: white;
}

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

.ai-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    animation: msg-in 0.3s ease-out backwards;
}

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

.ai-message.bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    color: var(--ai-text-primary);
    border-bottom-left-radius: 4px;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--ai-accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.loading {
    color: var(--ai-text-secondary);
    background: transparent;
    font-style: italic;
    padding: 0;
}

/* --- Input Area --- */
.ai-input-area {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    gap: 8px;
}

#aiInput {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 8px 14px;
    color: white;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#aiInput:focus {
    border-color: #0A84FF;
}

#aiSend {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

#aiSend:hover {
    background: #0A84FF;
}

#aiSend svg {
    width: 16px;
    height: 16px;
}

/* --- Scrollbar --- */
.ai-messages::-webkit-scrollbar {
    width: 4px;
}
.ai-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
