/**
 * Olag Widget Styles
 * 
 * Styling for the Olag AI Assistant sidebar widget
 * 
 * @package OutputLag
 * @since 1.0.0
 */

/* ===================================================================
   Olag Widget Container
   =================================================================== */

.olag-widget {
    position: relative;
    margin-bottom: var(--spacing-xl);
}

.olag-widget-container {
    position: relative;
    padding: var(--spacing-lg);
    background: rgba(var(--rgb-primary-black), 0.95);
    border: 1px solid rgba(var(--rgb-primary-blue), 0.3);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.olag-widget-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(var(--rgb-primary-blue), 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(var(--rgb-primary-green), 0.1) 0%, transparent 50%);
    pointer-events: none;
    opacity: 0.5;
}

.olag-widget-container:hover {
    border-color: rgba(var(--rgb-primary-blue), 0.5);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ===================================================================
   Olag Avatar
   =================================================================== */

.olag-avatar {
    position: relative;
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.olag-character {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(var(--rgb-primary-blue), 0.5);
    box-shadow: 
        0 4px 16px rgba(var(--rgb-primary-blue), 0.3),
        inset 0 0 20px rgba(var(--rgb-primary-blue), 0.2);
    transition: all 0.3s ease;
    animation: olagFloat 3s ease-in-out infinite;
}

@keyframes olagFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.olag-widget-container:hover .olag-character {
    border-color: var(--color-primary-blue);
    box-shadow: 
        0 6px 24px rgba(var(--rgb-primary-blue), 0.5),
        inset 0 0 30px rgba(var(--rgb-primary-blue), 0.3);
}

.olag-status-indicator {
    position: absolute;
    bottom: 5px;
    right: calc(50% - 45px);
    background: rgba(var(--rgb-primary-black), 0.9);
    padding: 2px;
    border-radius: 50%;
}

.status-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary-green);
    box-shadow: 0 0 10px rgba(var(--rgb-primary-green), 0.8);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* ===================================================================
   Message Bubble
   =================================================================== */

.olag-message-bubble {
    position: relative;
    background: rgba(var(--rgb-primary-dark), 0.8);
    border: 1px solid rgba(var(--rgb-primary-blue), 0.2);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    min-height: 60px;
    transition: all 0.3s ease;
}

.bubble-tail {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent rgba(var(--rgb-primary-blue), 0.2) transparent;
}

.bubble-tail::after {
    content: '';
    position: absolute;
    top: 2px;
    left: -9px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 9px 9px 9px;
    border-color: transparent transparent rgba(var(--rgb-primary-dark), 0.8) transparent;
}

/* ===================================================================
   Message Content
   =================================================================== */

.olag-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
    animation: fadeInMessage 0.5s ease-out;
}

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

.olag-message p {
    margin: 0 0 var(--spacing-xs);
}

.olag-message p:last-child {
    margin-bottom: 0;
}

/* ===================================================================
   Loading State
   =================================================================== */

.olag-loading {
    text-align: center;
    padding: var(--spacing-sm) 0;
}

.thinking-dots {
    display: inline-flex;
    gap: 4px;
    margin-bottom: var(--spacing-xs);
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary-blue);
    animation: thinkingDot 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes thinkingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.olag-loading p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 0;
    font-style: italic;
}

/* ===================================================================
   Error State
   =================================================================== */

.olag-error {
    text-align: center;
    padding: var(--spacing-sm);
}

.olag-error p {
    font-size: 14px;
    color: var(--color-error);
    margin: 0;
}


/* ===================================================================
   Widget Title
   =================================================================== */

.widget.olag-widget .widget-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-md);
    color: var(--color-primary-blue);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.widget.olag-widget .widget-title::after {
    content: '🤖';
    font-size: 20px;
    animation: robotWave 2s ease-in-out infinite;
}

@keyframes robotWave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* ===================================================================
   Responsive Design
   =================================================================== */

@media (max-width: 768px) {
    .olag-widget-container {
        padding: var(--spacing-md);
    }
    
    .olag-character {
        width: 60px;
        height: 60px;
    }
    
    .olag-message {
        font-size: 13px;
    }
    
    .olag-actions {
        flex-wrap: wrap;
    }
    
    .olag-personality {
        width: 100%;
        justify-content: center;
        margin-top: var(--spacing-xs);
    }
}

/* ===================================================================
   Light Mode Adjustments
   =================================================================== */

.light-mode .olag-widget-container,
body:not(.dark-mode) .olag-widget-container {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(var(--rgb-primary-blue), 0.3);
    color: #333;
}

.light-mode .olag-message-bubble,
body:not(.dark-mode) .olag-message-bubble {
    background: rgba(240, 240, 240, 0.9);
    border-color: rgba(var(--rgb-primary-blue), 0.3);
    color: #333;
}

.light-mode .olag-message,
body:not(.dark-mode) .olag-message {
    color: #333;
}

.light-mode .bubble-tail::after,
body:not(.dark-mode) .bubble-tail::after {
    border-color: transparent transparent rgba(240, 240, 240, 0.9) transparent;
}

.light-mode .widget.olag-widget .widget-title,
body:not(.dark-mode) .widget.olag-widget .widget-title {
    color: var(--color-primary-blue);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.light-mode .olag-loading p,
body:not(.dark-mode) .olag-loading p {
    color: #666;
}

/* ===================================================================
   Dark Mode Adjustments
   =================================================================== */

.dark-mode .olag-widget-container {
    background: rgba(0, 0, 0, 0.95);
    color: white;
}

.dark-mode .olag-message-bubble {
    background: rgba(20, 20, 20, 0.9);
    border-color: rgba(var(--rgb-primary-blue), 0.3);
}

.dark-mode .olag-message {
    color: var(--color-text-primary);
}

.dark-mode .bubble-tail::after {
    border-color: transparent transparent rgba(20, 20, 20, 0.9) transparent;
}