/**
 * AURA Chat Widget Styles
 * For Feel2ArtGallery.com
 * 
 * Features:
 * - Realistic avatar image support
 * - Voice input (microphone) button
 * - AI Polish button for voice transcriptions
 * - Character counter with visual feedback
 * - Toggleable filter pills with clear/view buttons
 * 
 * Version: 3.0.0
 */

/* ============================================
   CSS Variables
   ============================================ */
.aura-widget {
    --aura-primary: #c9a86c;
    --aura-primary-dark: #b8956d;
    --aura-secondary: #2c3e50;
    --aura-bg: #ffffff;
    --aura-bg-alt: #f8f7f5;
    --aura-text: #2c3e50;
    --aura-text-light: #6b7280;
    --aura-border: #e5e5e5;
    --aura-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --aura-radius: 12px;
    --aura-success: #10b981;
    --aura-warning: #f59e0b;
    --aura-error: #ef4444;
}

/* ============================================
   Widget Container
   ============================================ */
.aura-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   Trigger Button
   ============================================ */
.aura-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aura-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--aura-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 9998;
}

.aura-trigger:hover {
    background: var(--aura-primary-dark);
    transform: scale(1.05);
}

.aura-trigger.open {
    background: var(--aura-secondary);
}

.aura-trigger-icon,
.aura-trigger-close {
    font-size: 24px;
    transition: all 0.3s ease;
}

.aura-trigger-close {
    display: none;
    color: #fff;
    font-size: 20px;
}

.aura-trigger.open .aura-trigger-icon {
    display: none;
}

.aura-trigger.open .aura-trigger-close {
    display: block;
}

.aura-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Chat Panel
   ============================================ */
.aura-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--aura-bg);
    border-radius: var(--aura-radius);
    box-shadow: var(--aura-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    z-index: 9999;
}

.aura-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   Header with Avatar Image
   ============================================ */
.aura-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--aura-primary);
    color: #fff;
}

.aura-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.aura-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.aura-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.aura-header-info {
    flex: 1;
}

.aura-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.aura-header-status {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

.aura-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.aura-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

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

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

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

/* ============================================
   Message Bubbles
   ============================================ */
.aura-message {
    max-width: 85%;
    animation: auraFadeIn 0.3s ease;
}

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

.aura-message-user {
    align-self: flex-end;
}

.aura-message-bot {
    align-self: flex-start;
}

.aura-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.aura-message-user .aura-message-content {
    background: var(--aura-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aura-message-bot .aura-message-content {
    background: var(--aura-bg-alt);
    color: var(--aura-text);
    border-bottom-left-radius: 4px;
}

.aura-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.aura-message-content li {
    margin: 4px 0;
}

/* ============================================
   Filter Pills - TOGGLEABLE
   ============================================ */
.aura-filters {
    background: #fdf9f3;
    border: 1px solid #f0e6d8;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    animation: auraFadeIn 0.3s ease;
}

.aura-filter-instruction {
    font-size: 11px;
    color: var(--aura-text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aura-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.aura-filter-pill {
    display: inline-block;
    background: #fff;
    border: 2px solid var(--aura-border);
    color: var(--aura-text-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.aura-filter-pill:hover {
    border-color: var(--aura-primary);
    color: var(--aura-text);
}

.aura-filter-pill.selected {
    background: var(--aura-primary);
    border-color: var(--aura-primary);
    color: #fff;
}

.aura-filter-pill.selected:hover {
    background: var(--aura-primary-dark);
    border-color: var(--aura-primary-dark);
}

.aura-filter-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    border-top: 1px solid #f0e6d8;
    padding-top: 12px;
    margin-top: 4px;
}

.aura-clear-btn {
    background: #fff;
    border: 1px solid var(--aura-border);
    color: var(--aura-text-light);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aura-clear-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fef5f5;
}

.aura-view-art-btn {
    background: var(--aura-secondary);
    border: none;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aura-view-art-btn:hover {
    background: #1a252f;
    transform: translateX(2px);
}

/* ============================================
   Quick Actions
   ============================================ */
.aura-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--aura-border);
}

.aura-quick-btn {
    background: var(--aura-bg-alt);
    border: 1px solid var(--aura-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--aura-text);
    cursor: pointer;
    transition: all 0.2s;
}

.aura-quick-btn:hover {
    border-color: var(--aura-primary);
    background: #fdf8f0;
}

/* ============================================
   Input Area - Enhanced with Auto-Expand
   ============================================ */
.aura-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--aura-border);
    background: var(--aura-bg);
    align-items: flex-end;
}

.aura-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.aura-input {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    padding-right: 80px; /* Space for counter and polish btn */
    border: 1px solid var(--aura-border);
    border-radius: 22px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    resize: none; /* Disable manual resize */
    overflow-y: hidden; /* Hide scrollbar until needed */
    line-height: 1.4;
}

.aura-input:focus {
    border-color: var(--aura-primary);
}

.aura-input:disabled {
    background: var(--aura-bg-alt);
    cursor: not-allowed;
}

.aura-input::placeholder {
    color: var(--aura-text-light);
}

/* Character Counter - positioned at bottom right */
.aura-char-counter {
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 11px;
    color: var(--aura-text-light);
    pointer-events: none;
    transition: color 0.2s;
    background: var(--aura-bg);
    padding: 2px 4px;
    border-radius: 4px;
}

.aura-char-counter.aura-char-warning {
    color: var(--aura-warning);
}

.aura-char-counter.aura-char-limit {
    color: var(--aura-error);
    font-weight: 600;
}

/* Polish Button - positioned above counter */
.aura-polish-btn {
    position: absolute;
    right: 12px;
    bottom: 28px;
    width: 28px;
    height: 28px;
    background: var(--aura-bg-alt);
    border: 1px solid var(--aura-border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--aura-text-light);
    z-index: 2;
}

.aura-polish-btn:hover {
    background: #fdf8f0;
    border-color: var(--aura-primary);
    color: var(--aura-primary);
}

.aura-polish-btn.polishing {
    animation: auraSpin 1s linear infinite;
    pointer-events: none;
}

@keyframes auraSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Input Buttons Container */
.aura-input-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Microphone Button */
.aura-mic-btn {
    width: 44px;
    height: 44px;
    background: var(--aura-bg-alt);
    border: 1px solid var(--aura-border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aura-mic-btn:hover {
    background: #fdf8f0;
    border-color: var(--aura-primary);
}

.aura-mic-btn.active {
    background: var(--aura-error);
    border-color: var(--aura-error);
}

.aura-mic-btn svg {
    width: 22px;
    height: 22px;
    fill: var(--aura-text-light);
    transition: fill 0.2s;
}

.aura-mic-btn:hover svg {
    fill: var(--aura-primary);
}

.aura-mic-btn.active svg {
    fill: #fff;
}

/* Pulse animation for active mic */
.aura-pulse-ring {
    animation: auraPulse 1.5s ease-out infinite;
}

@keyframes auraPulse {
    0% {
        stroke-opacity: 0.8;
        r: 6;
    }
    100% {
        stroke-opacity: 0;
        r: 12;
    }
}

/* Send Button */
.aura-send-btn {
    width: 44px;
    height: 44px;
    background: var(--aura-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.aura-send-btn:hover {
    background: var(--aura-primary-dark);
}

.aura-send-btn:disabled {
    background: var(--aura-border);
    cursor: not-allowed;
}

.aura-send-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Voice Status Indicator */
.aura-voice-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    font-size: 13px;
    color: var(--aura-error);
}

.aura-voice-indicator {
    width: 10px;
    height: 10px;
    background: var(--aura-error);
    border-radius: 50%;
    animation: auraBlink 1s ease-in-out infinite;
}

@keyframes auraBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================
   Typing Indicator
   ============================================ */
.aura-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--aura-bg-alt);
    border-radius: 16px;
    width: fit-content;
    align-self: flex-start;
}

.aura-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--aura-text-light);
    border-radius: 50%;
    animation: auraBounce 1.4s infinite ease-in-out;
}

.aura-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.aura-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.aura-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* ============================================
   Limit Message
   ============================================ */
.aura-limit-message {
    padding: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--aura-text-light);
    border-top: 1px solid var(--aura-border);
}

.aura-limit-message a {
    color: var(--aura-primary);
    font-weight: 500;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 480px) {
    .aura-widget {
        bottom: 10px;
        right: 10px;
    }

    .aura-trigger {
        width: 54px;
        height: 54px;
    }

    .aura-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
    }

    .aura-panel.open {
        transform: translateY(0);
    }

    .aura-quick-actions {
        justify-content: center;
    }
    
    .aura-filter-buttons {
        flex-direction: column;
    }
    
    .aura-view-art-btn,
    .aura-clear-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    
    .aura-input-buttons {
        flex-shrink: 0;
    }
    
    .aura-mic-btn,
    .aura-send-btn {
        width: 40px;
        height: 40px;
    }
}
