/* ========================================
   MORryde PDF Documentation Assistant
   Ultra-Modern Embedded Interface
   Brand Colors: Blue #0154a4, Orange #f36e21
   ======================================== */

.morryde-pdf-assistant {
    width: 100%;
    max-width: 1100px;  /* Increased from 900px for more width */
    margin: 10px auto 20px;  /* Minimal top margin */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.morryde-assistant-container {
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    border-radius: 16px;
    padding: 2px;
    box-shadow: 0 10px 40px rgba(1, 84, 164, 0.2);
    overflow: hidden;  /* Ensures clean corners */
}

/* Removed the white background wrapper - not needed */

/* ========================================
   Header
   ======================================== */

.morryde-assistant-header {
    display: flex;
    align-items: center;
    gap: 16px;  /* Tighter spacing */
    padding: 20px 28px 16px;  /* Reduced all padding */
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    border-radius: 14px 14px 0 0;  /* Match container */
    color: white;
}

.morryde-assistant-icon {
    width: 48px;  /* Smaller icon */
    height: 48px;
    background: rgba(255, 255, 255, 0.15);  /* More subtle */
    backdrop-filter: blur(10px);
    border-radius: 12px;  /* Less rounded */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.morryde-assistant-title h3 {
    margin: 0;
    font-size: 22px;  /* Slightly smaller */
    font-weight: 700;
    letter-spacing: -0.5px;
}

.morryde-assistant-title p {
    margin: 2px 0 0;  /* Tighter */
    font-size: 13px;
    opacity: 0.85;
}

/* ========================================
   Search Input Area
   ======================================== */

.morryde-assistant-search {
    padding: 24px 28px;
    background: #ffffff;  /* White background for search area */
    border-radius: 0 0 14px 14px;
}

.morryde-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;  /* Thinner border */
    border-radius: 12px;  /* Less rounded */
    padding: 4px 4px 4px 16px;  /* Adjusted padding */
    transition: all 0.3s ease;
}

.morryde-search-input-wrapper:focus-within {
    border-color: #0154a4;
    box-shadow: 0 0 0 3px rgba(1, 84, 164, 0.08);  /* Subtler focus */
    background: #ffffff;
}

.morryde-search-icon {
    color: #6c757d;
    flex-shrink: 0;
}

.morryde-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    padding: 16px 8px;
    outline: none;
    color: #212529;
}

.morryde-search-input::placeholder {
    color: #adb5bd;
}

.morryde-search-btn {
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    color: white;
    border: none;
    border-radius: 10px;  /* Less rounded */
    padding: 12px 24px;  /* Slightly smaller */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;  /* Faster transition */
    white-space: nowrap;
}

.morryde-search-btn:hover {
    transform: translateY(-1px);  /* Subtler lift */
    box-shadow: 0 6px 16px rgba(1, 84, 164, 0.3);
}

.morryde-search-btn:active {
    transform: translateY(0);
}

.morryde-search-btn .btn-icon {
    width: 20px;
    height: 20px;
}

/* Quick Suggestions */
.morryde-quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;  /* Tighter gap */
    margin-top: 16px;  /* Less space */
    align-items: center;
}

.suggestion-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

.suggestion-chip {
    background: #ffffff;
    border: 1px solid #0154a4;  /* Thinner border */
    border-radius: 16px;  /* Less rounded */
    padding: 6px 14px;  /* Smaller */
    font-size: 12px;
    color: #0154a4;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: #0154a4;
    color: white;
    border-color: #0154a4;
    transform: translateY(-1px);  /* Subtle */
    box-shadow: 0 3px 10px rgba(1, 84, 164, 0.25);
}

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

.morryde-loading {
    padding: 60px 32px;
    text-align: center;
    background: #ffffff;
    border-radius: 0 0 21px 21px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #e9ecef;  /* Light gray */
    border-top: 4px solid #0154a4;  /* MORryde blue */
    border-right: 4px solid #f36e21;  /* MORryde orange */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.morryde-loading p {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
}

/* ========================================
   Results Area
   ======================================== */

.morryde-results {
    padding: 24px 28px;  /* Reduced padding */
    background: #ffffff;
    border-radius: 0 0 14px 14px;  /* Match container */
}

/* Conversation Thread */
.morryde-conversation-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.morryde-conversation-thread {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Message Bubbles */
.morryde-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInUp 0.3s ease;
}

.morryde-message.user {
    justify-content: flex-end;
}

.morryde-message.user .message-content {
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.morryde-message.assistant {
    justify-content: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.message-content {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    max-width: 75%;
    font-size: 15px;
    line-height: 1.6;
}

.message-content p {
    margin: 0 0 12px;
}

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

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

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

.message-content strong {
    color: #0154a4;
    font-weight: 600;
}

/* Inline PDF Links */
.inline-pdf-link {
    color: #f36e21;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inline-pdf-link:hover {
    border-bottom-color: #f36e21;
}

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

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

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

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

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Scrollbar Styling */
.morryde-conversation-thread::-webkit-scrollbar {
    width: 8px;
}

.morryde-conversation-thread::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.morryde-conversation-thread::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.morryde-conversation-thread::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Answer Card (Legacy - keeping for compatibility) */
.morryde-answer-card {
    background: #f8f9fa;  /* Flat background */
    border: 1px solid #e9ecef;  /* Thinner border */
    border-radius: 12px;  /* Less rounded */
    padding: 20px;  /* Tighter padding */
    margin-bottom: 24px;
}

.answer-header {
    display: flex;
    align-items: center;
    gap: 10px;  /* Tighter */
    margin-bottom: 14px;
    color: #0154a4;
}

.answer-header h4 {
    margin: 0;
    font-size: 17px;  /* Slightly smaller */
    font-weight: 700;
}

.answer-content {
    color: #212529;
    font-size: 16px;
    line-height: 1.7;
}

.answer-content h3 {
    color: #495057;
    font-size: 18px;
    margin: 24px 0 12px;
    font-weight: 600;
}

.answer-content ul, .answer-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.answer-content li {
    margin: 8px 0;
}

.answer-content strong {
    color: #0154a4;
    font-weight: 600;
}

/* Sources Section */
.morryde-sources-section {
    margin-bottom: 24px;
}

.sources-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.sources-title svg {
    color: #0154a4;
}

.sources-title-small {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
}


.morryde-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.source-card {
    background: #ffffff;
    border: 1px solid #e9ecef;  /* Thinner border */
    border-radius: 10px;  /* Less rounded */
    padding: 16px;  /* Tighter */
    transition: all 0.2s ease;  /* Faster */
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.source-card:hover {
    border-color: #0154a4;
    transform: translateY(-2px);  /* Less dramatic */
    box-shadow: 0 6px 20px rgba(1, 84, 164, 0.12);
}

.source-sku {
    display: inline-block;
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;  /* Smaller */
    border-radius: 5px;  /* Less rounded */
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.source-product {
    font-size: 15px;  /* Slightly smaller */
    font-weight: 600;
    color: #212529;
    margin: 0 0 5px;
    line-height: 1.3;
}

.source-pdf {
    font-size: 12px;
    color: #6c757d;
    margin: 0 0 10px;
}

.source-similarity {
    font-size: 12px;
    color: #0154a4;
    font-weight: 500;
}

.source-link-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #f36e21;
    font-weight: 600;
    margin-top: 8px;
}

.source-link-icon svg {
    width: 16px;
    height: 16px;
}

/* Ask Another Button */
.morryde-ask-another {
    text-align: center;
}

.ask-another-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ask-another-btn:hover {
    background: linear-gradient(135deg, #0154a4 0%, #f36e21 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

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

@media (max-width: 768px) {
    .morryde-pdf-assistant {
        margin: 10px auto;  /* Reduced from 20px */
    }
    
    .morryde-assistant-header {
        padding: 24px 20px 20px;
    }
    
    .morryde-assistant-icon {
        width: 48px;
        height: 48px;
    }
    
    .morryde-assistant-title h3 {
        font-size: 20px;
    }
    
    .morryde-assistant-title p {
        font-size: 13px;
    }
    
    .morryde-assistant-search {
        padding: 20px;
    }
    
    .morryde-search-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    
    .morryde-search-input {
        padding: 12px 8px;
    }
    
    .morryde-search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .morryde-quick-suggestions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .suggestion-chip {
        text-align: center;
    }
    
    .morryde-results {
        padding: 20px;
    }
    
    .morryde-sources-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Animations
   ======================================== */

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

.morryde-results {
    animation: fadeInUp 0.5s ease;
}

.source-card {
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.source-card:nth-child(1) { animation-delay: 0.1s; }
.source-card:nth-child(2) { animation-delay: 0.2s; }
.source-card:nth-child(3) { animation-delay: 0.3s; }
.source-card:nth-child(4) { animation-delay: 0.4s; }
.source-card:nth-child(5) { animation-delay: 0.5s; }
.source-card:nth-child(6) { animation-delay: 0.6s; }
