/* Alpha Chat Interface Styles */

/* Avatar Styling */
.alpha-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ff9800;
    margin-right: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.alpha-avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

.alpha-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ff9800;
    margin-right: 5px;
    vertical-align: middle;
}

/* Message Container Styling */
.ai-message-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

.ai-message-content-wrapper {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 15px 15px 15px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 3px solid #ff9800;
    max-width: 85%;
}

.user-message-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in-out;
}

.user-message-content-wrapper {
    background: rgba(227, 242, 253, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 15px 0 15px 15px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    max-width: 85%;
    color: #0d47a1;
}

/* Header Styling */
.alpha-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    margin-right: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Floating Button Styling - Glassmorphism */
.floating-chat-button {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    position: fixed !important;
    background: rgba(44, 62, 80, 0.7) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    animation: gentle-wiggle 8s ease-in-out infinite !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 1700 !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

.floating-chat-button:hover {
    transform: scale(1.05) translateY(-5px);
    background: rgba(44, 62, 80, 0.85) !important;
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

@keyframes gentle-wiggle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    2% {
        transform: rotate(-3deg) scale(1.02);
    }
    4% {
        transform: rotate(3deg) scale(1.02);
    }
    6% {
        transform: rotate(-2deg) scale(1.01);
    }
    8% {
        transform: rotate(2deg) scale(1.01);
    }
    10%, 100% {
        transform: rotate(0deg) scale(1);
    }
}

.floating-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    margin-right: 8px;
    vertical-align: middle;
}

/* Typing Indicator */
.typing-indicator-container {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background-color: #f8f9fa;
    border-radius: 16px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    line-height: 1.3;
    max-width: 100%;
}

.typing-indicator-wrapper {
    margin-bottom: 8px !important;
}

/* Typing indicator positioned above input field */
.typing-indicator-above-input {
    margin-bottom: 10px;
    padding: 0 15px;
}

.typing-indicator-above-input .ai-message-content-wrapper {
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Typing text styles */
.typing-message {
    opacity: 0.8;
    font-style: italic;
}

.typing-dots {
    animation: typingDots 1.5s infinite;
    display: inline-block;
}

@keyframes typingDots {
    0%, 20% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
    60%, 100% {
        opacity: 0;
    }
}

.typing-text {
    color: #666;
}

.cat-paw {
    font-size: 1.2rem;
    margin-right: 8px;
    animation: wave 1s infinite alternate;
}

@keyframes wave {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(20deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .alpha-avatar {
        width: 32px;
        height: 32px;
    }

    .ai-message-content-wrapper,
    .user-message-content-wrapper {
        max-width: 90%;
        padding: 10px 12px;
    }

    .alpha-mascot-large {
        width: 120px !important;
        bottom: -10px !important;
        right: -10px !important;
    }
    
    /* Typing indicator ottimizzato per mobile */
    .typing-indicator-container {
        padding: 4px 8px;
        font-size: 0.7rem;
        border-radius: 12px;
        line-height: 1.2;
    }
    
    .typing-indicator-wrapper {
        margin-bottom: 5px !important;
    }
    
    .ai-message-container {
        margin-bottom: 10px;
    }
}

/* Large Mascot Styling */
.alpha-mascot-large {
    animation: slideUp 0.5s ease-out;
    transition: transform 0.3s ease;
}

.alpha-mascot-large:hover {
    transform: scale(1.05) rotate(2deg);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mascot Container Styling */
.mascot-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    z-index: 10;
    pointer-events: none;
}

/* Interactive Mascot Styling */
.alpha-mascot-interactive {
    width: 120px;
    height: auto;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: bottom center;
    transform: scaleX(-1);
    pointer-events: none;
    /* No animation in idle state - completely static */
}

/* Thinking animation - gentle movement */
.alpha-mascot-thinking {
    animation: mascotThinking 2s infinite ease-in-out !important;
}

@keyframes mascotThinking {
    0%, 100% {
        transform: scaleX(-1) translateY(0) translateX(0) rotate(-2deg) scale(1);
    }
    33% {
        transform: scaleX(-1) translateY(-10px) translateX(3px) rotate(3deg) scale(1.03);
    }
    66% {
        transform: scaleX(-1) translateY(-6px) translateX(-3px) rotate(-3deg) scale(1.02);
    }
}

/* Talking animation - gentle bounce */
.alpha-mascot-talking {
    animation: mascotTalking 1.2s infinite ease-in-out !important;
}

@keyframes mascotTalking {
    0%, 100% {
        transform: scaleX(-1) translateY(0) translateX(0) scale(1) rotate(0deg);
    }
    33% {
        transform: scaleX(-1) translateY(-10px) translateX(3px) scale(1.04) rotate(-3deg);
    }
    66% {
        transform: scaleX(-1) translateY(-5px) translateX(-3px) scale(1.02) rotate(3deg);
    }
}

/* Greeting animation - enthusiastic welcome */
.alpha-mascot-greeting {
    animation: mascotGreeting 2.5s ease-in-out !important;
}

@keyframes mascotGreeting {
    0%, 100% {
        transform: scaleX(-1) translateY(0) translateX(0) rotate(0deg) scale(1);
    }
    8% {
        transform: scaleX(-1) translateY(-25px) translateX(-8px) rotate(-12deg) scale(1.12);
    }
    16% {
        transform: scaleX(-1) translateY(-18px) translateX(10px) rotate(12deg) scale(1.12);
    }
    24% {
        transform: scaleX(-1) translateY(-28px) translateX(-6px) rotate(-10deg) scale(1.15);
    }
    32% {
        transform: scaleX(-1) translateY(-20px) translateX(8px) rotate(10deg) scale(1.13);
    }
    40% {
        transform: scaleX(-1) translateY(-30px) translateX(-4px) rotate(-8deg) scale(1.18);
    }
    50% {
        transform: scaleX(-1) translateY(-25px) translateX(6px) rotate(8deg) scale(1.16);
    }
    60% {
        transform: scaleX(-1) translateY(-22px) translateX(-3px) rotate(-5deg) scale(1.14);
    }
    70% {
        transform: scaleX(-1) translateY(-18px) translateX(4px) rotate(5deg) scale(1.12);
    }
    80% {
        transform: scaleX(-1) translateY(-15px) translateX(-2px) rotate(-3deg) scale(1.08);
    }
    90% {
        transform: scaleX(-1) translateY(-10px) translateX(2px) rotate(2deg) scale(1.05);
    }
}

/* Chat Messages Container - Glassmorphism */
.chat-messages-container {
    background: rgba(248, 249, 250, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    position: relative;
    /* Allow automatic shrinking when footer needs more space */
    flex: 1 1 0;
    min-height: 0;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

/* Chat Footer - ensures input area always visible - Glassmorphism */
.chat-footer {
    flex-shrink: 0;
    flex-grow: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-top: 10px;
    position: relative;
    z-index: 1001;
    /* Ensure footer takes only the space it needs */
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.chat-footer-section {
    margin-bottom: 10px;
}

.chat-input-section {
    margin-top: 0;
}

/* Message Container */
.message-container {
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease-in;
}

.user-container {
    text-align: right;
}

.ai-container {
    text-align: left;
}

.user-message {
    background: rgba(0, 123, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 10px 15px;
    border-radius: 18px 18px 4px 18px;
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.ai-message {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #333;
    padding: 10px 15px;
    border-radius: 18px 18px 18px 4px;
    display: inline-block;
    max-width: 80%;
    word-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

.disclaimer-container {
    text-align: center;
    margin: 15px 0;
}

.disclaimer-message {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    padding: 10px 15px;
    border-radius: 8px;
    display: inline-block;
    max-width: 90%;
    font-size: 13px;
    border: 1px solid #ffeaa7;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

/* Chat Input - Glassmorphism */
.chat-input {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 25px;
    padding: 12px 20px;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08);
}

.chat-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    outline: none;
    background: rgba(255, 255, 255, 0.85);
}

/* Loading indicator for chat */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    color: #666;
    font-style: italic;
}

/* Markdown styles for chat messages */
.ai-message-content {
    line-height: 1.5;
}

.ai-message-content strong {
    font-weight: 600;
    color: #2c3e50;
}

.ai-message-content em {
    font-style: italic;
    color: #34495e;
}

.ai-message-content code {
    background-color: #f8f9fa;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.ai-message-content div {
    margin-bottom: 8px;
}

.ai-message-content div:last-child {
    margin-bottom: 0;
}

/* Disabled button style */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Quick questions styling */
.quick-questions-mobile {
    display: none;
}

.quick-questions-desktop {
    display: block;
}

/* Mobile adjustments for interactive mascot */
@media (max-width: 768px) {
    .alpha-mascot-interactive {
        width: 100px !important;
    }
    
    .mascot-container {
        min-height: 120px;
    }
    
    /* Hide floating chat button on mobile since it's in navbar */
    .floating-chat-button {
        display: none !important;
    }
    
    .chat-messages-container {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        max-height: none !important;
    }
    
    .user-message,
    .ai-message {
        max-width: 90%;
        font-size: 14px;
    }
    
    /* Show accordion on mobile, hide desktop version */
    .quick-questions-mobile {
        display: block;
    }
    
    .quick-questions-desktop {
        display: none;
    }
    
    /* Ensure footer doesn't get pushed out on small screens */
    .chat-footer {
        padding-top: 8px;
    }
    
    .chat-footer-section {
        margin-bottom: 8px;
    }
}