/**
 * Ski AI Assistant Styles
 */

/* AI Helper Container - Centered above content */
.ai-helper-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 30px auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
}

/* AI Helper Button */
.ai-helper-button {
    padding: 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.ai-helper-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ai-helper-button svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.ai-helper-button span {
    line-height: 1.2;
    font-size: 16px;
}

/* Modal Overlay Background */
#ski-ai-assistant {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#ski-ai-assistant.open {
    opacity: 1;
    visibility: visible;
}

/* AI Assistant Modal Panel */
.ski-ai-modal {
    width: 550px;
    max-width: calc(100vw - 40px);
    height: 700px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#ski-ai-assistant.open .ski-ai-modal {
    transform: scale(1);
    opacity: 1;
}

/* AI Assistant Header */
.ski-ai-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ski-ai-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ski-ai-header h3 svg {
    width: 24px;
    height: 24px;
}

#close-ai-assistant {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

#close-ai-assistant svg {
    width: 20px;
    height: 20px;
    fill: white;
}

#close-ai-assistant:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
#ski-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f7;
}

/* Individual Messages */
.ai-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

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

.ai-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message.assistant .message-avatar {
    background: white;
    color: #667eea;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 75%;
    word-wrap: break-word;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.ai-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.assistant .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Recommendation Message */
.ai-message.recommendation .message-content {
    border: 2px solid #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    max-width: 85%;
}

.recommendation-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    color: #667eea;
    font-size: 14px;
}

.recommendation-text {
    margin-bottom: 16px;
    line-height: 1.6;
    color: #333;
}

.recommendation-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
    margin: 16px 0;
}

/* Apply Filters Button */
.apply-ai-filters {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.apply-ai-filters:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.apply-ai-filters:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator .message-content {
    padding: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

/* Input Container */
.ski-ai-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 16px 16px;
}

.ski-ai-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#ski-ai-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

#ski-ai-input:focus {
    outline: none;
    border-color: #667eea;
}

#ski-ai-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ski-ai-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#ski-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#ski-ai-send svg {
    width: 20px;
    height: 20px;
}

/* Scrollbar Styling */
#ski-ai-messages::-webkit-scrollbar {
    width: 6px;
}

#ski-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ski-ai-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#ski-ai-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .ai-helper-container {
        padding: 0 15px;
        margin-bottom: 15px;
        order: -1; /* Place before filter toggle */
    }
    
    .ai-helper-button {
        font-size: 14px;
        padding: 12px 20px;
        width: 100%;
        max-width: none;
    }
    
    .ai-helper-button svg {
        width: 20px;
        height: 20px;
    }
    
    .ai-helper-button span {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .ski-ai-modal {
        width: 100%;
        height: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .ski-ai-header {
        border-radius: 0;
    }
    
    .ski-ai-input-container {
        border-radius: 0;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .ai-helper-button {
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ski-ai-modal {
        background: #1a202c;
    }
    
    #ski-ai-messages {
        background: #2d3748;
    }
    
    .ai-message.assistant .message-content {
        background: #374151;
        color: #e5e7eb;
    }
    
    .ski-ai-input-container {
        background: #1a202c;
        border-top-color: #374151;
    }
    
    #ski-ai-input {
        background: #2d3748;
        color: #e5e7eb;
        border-color: #4a5568;
    }
    
    #ski-ai-input:focus {
        border-color: #667eea;
    }
    
    .message-avatar {
        background: #374151;
    }
}
