/* ========================================
   UPGRADED AI CHAT STYLES
   Beautiful, polished, context-aware
   ======================================== */

/* Quick Action Buttons in Chat */
#chat-quick-actions {
    animation: slideInUp 0.3s ease-out;
}

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

.quick-action-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: rgb(147, 197, 253);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.quick-action-btn:active {
    transform: translateY(0);
}

.quick-action-btn i {
    font-size: 10px;
}

/* Chat Location Indicator */
#chat-location-indicator {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Context Used Indicators */
.context-indicator {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Enhanced Message Animations */
.animate-slide-in-right {
    animation: slideInFromRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Enhanced Chat Panel */
.chat-panel {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px);
}

.chat-panel.active {
    transform: translateY(0);
}

/* Typing Indicator */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    30% {
        transform: scale(1.4);
        opacity: 0.7;
    }
}

/* Enhanced Scrollbar for Chat */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.3);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #d97706, #dc2626);
}

/* Visual Indicators for Message Content */
.safety-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.safety-indicator.night {
    background: rgba(99, 102, 241, 0.2);
    color: rgb(165, 180, 252);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.safety-indicator.wind {
    background: rgba(245, 158, 11, 0.2);
    color: rgb(251, 191, 36);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.safety-indicator.storm {
    background: rgba(239, 68, 68, 0.2);
    color: rgb(252, 165, 165);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.safety-indicator.temp {
    background: rgba(59, 130, 246, 0.2);
    color: rgb(147, 197, 253);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.safety-indicator.temp-hot {
    background: rgba(239, 68, 68, 0.2);
    color: rgb(252, 165, 165);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.safety-indicator.temp-warm {
    background: rgba(245, 158, 11, 0.2);
    color: rgb(251, 191, 36);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Message Callouts */
.message-callout {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 8px;
    border-left-width: 4px;
    border-left-style: solid;
}

.message-callout.recommendation {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: rgb(16, 185, 129);
}

.message-callout.recommendation .icon {
    color: rgb(52, 211, 153);
}

.message-callout.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: rgb(245, 158, 11);
}

.message-callout.warning .icon {
    color: rgb(251, 191, 36);
}

.message-callout.info {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: rgb(59, 130, 246);
}

.message-callout.info .icon {
    color: rgb(147, 197, 253);
}

/* Copy and Rate Buttons */
.message-action-btn {
    padding: 4px 8px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgb(156, 163, 175);
}

.message-action-btn:hover {
    color: rgb(249, 115, 22);
    background: rgba(249, 115, 22, 0.1);
}

.message-action-btn.success {
    color: rgb(34, 197, 94);
}

.message-action-btn.error {
    color: rgb(239, 68, 68);
}

/* Welcome Message */
.welcome-message {
    animation: fadeInScale 0.6s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Location Context Badge */
.location-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.2);
    color: rgb(147, 197, 253);
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 12px;
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

/* Enhanced Popup Styles */
.ai-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.popup-actions .btn {
    flex: 1 1 auto;
    min-width: fit-content;
}

/* Loading States */
.loading-ai, .loading-weather {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: rgb(156, 163, 175);
    font-size: 13px;
}

.loading-ai i, .loading-weather i {
    animation: spin 1s linear infinite;
}

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

/* Context Used Tags */
.context-used-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-left: 48px;
}

.context-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    animation: fadeIn 0.4s ease-out;
}

.context-tag.location {
    background: rgba(59, 130, 246, 0.2);
    color: rgb(147, 197, 253);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.context-tag.weather {
    background: rgba(16, 185, 129, 0.2);
    color: rgb(52, 211, 153);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.context-tag.user-location {
    background: rgba(168, 85, 247, 0.2);
    color: rgb(192, 132, 252);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .quick-action-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .popup-actions {
        flex-direction: column;
    }
    
    .popup-actions .btn {
        width: 100%;
    }
    
    #chat-quick-actions {
        padding: 12px;
    }
    
    .context-used-tags {
        padding-left: 0;
    }
}

/* Accessibility */
.quick-action-btn:focus,
.message-action-btn:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .message-callout {
        background: rgba(0, 0, 0, 0.3);
    }
    
    .safety-indicator {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Print Styles */
@media print {
    #chat-quick-actions,
    .message-action-btn,
    .quick-action-btn {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .quick-action-btn,
    .context-tag,
    .safety-indicator {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .animate-slide-in-right,
    .animate-slide-in-left,
    #chat-location-indicator,
    .welcome-message,
    .context-indicator {
        animation: none;
    }
    
    .location-context-badge {
        animation: none;
    }
}