/* =============================================================================
   PDF ASSISTANT - CENTERED CARDS WITH SMALLER SEARCH BAR
   ============================================================================= */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    color: #202124;
    min-height: 100vh;
    line-height: 1.4;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================================================
   TOP HEADER BAR - LANGUAGE SELECTOR ONLY
   ============================================================================= */
.main-header {
    background: #fff;
    padding: 15px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    z-index: 100;
    border-bottom: 1px solid #f0f0f0;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
}

.language-selector select {
    padding: 8px 16px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #3c4043;
    outline: none;
    cursor: pointer;
    min-width: 100px;
    transition: all 0.2s ease;
}

.language-selector select:focus {
    border-color: #dc143c;
    box-shadow: 0 0 0 1px #dc143c;
}

.language-selector select:hover {
    border-color: #dc143c;
}

/* =============================================================================
   LOADING SECTION
   ============================================================================= */
.loading-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #fff;
}

.loading-indicator {
    text-align: center;
    color: #5f6368;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #dc143c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* =============================================================================
   HOMEPAGE LAYOUT - FIXED CENTERED LAYOUT
   ============================================================================= */
.homepage {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
    padding: 0;
}

.homepage-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 40px 20px;
}

/* =============================================================================
   INITIAL VIEW - PERFECTLY CENTERED
   ============================================================================= */
.initial-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    flex: 1;
}

/* Logo Section - Centered */
.logo-section {
    text-align: center;
    margin-bottom: 60px;
}

.main-logo {
    font-size: 90px;
    font-weight: 400;
    margin-bottom: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.logo-icon {
    font-size: 80px;
    color: #9aa0a6;
}

.main-logo .logo-text {
    background: linear-gradient(90deg, #4285f4 0%, #34a853 25%, #fbbc04 50%, #ea4335 75%, #dc143c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    font-weight: 300;
}

.tagline {
    font-size: 20px;
    color: #5f6368;
    font-weight: 400;
    margin-top: 20px;
}

/* PDF Grid - PERFECTLY CENTERED */
.pdf-grid {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 80px;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
}

/* PDF Cards - Smaller and Centered */
.pdf-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: none;
    position: relative;
    width: 300px;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.pdf-card:hover {
    border-color: #dc143c;
    box-shadow: 0 2px 12px rgba(220, 20, 60, 0.1);
    transform: translateY(-2px);
}

.pdf-card.selected {
    border-color: #dc143c;
    background: #fefefe;
    box-shadow: 0 2px 12px rgba(220, 20, 60, 0.15);
}

/* Image Styling for PDF Cards */
.pdf-image {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    transition: all 0.3s ease;
}

.pdf-card:hover .pdf-image {
    border-color: #dc143c;
}

.pdf-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* PDF Icon Fallback */
.pdf-icon {
    font-size: 56px;
    margin-bottom: 16px;
    color: #b0b7c3;
    transition: color 0.3s ease;
}

.pdf-card:hover .pdf-icon {
    color: #8a91a0;
}

/* PDF Name - Clean Typography */
.pdf-name {
    font-size: 16px;
    font-weight: 400;
    color: #202124;
    line-height: 1.3;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
    transition: color 0.3s ease;
}

.pdf-card:hover .pdf-name {
    color: #dc143c;
}

/* =============================================================================
   SEARCH BAR - SMALLER AND CENTERED (ALWAYS VISIBLE)
   ============================================================================= */
.search-section {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.chat-input-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.chat-input {
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

/* Smaller Search/Chat Input Box */
.google-search-box,
#questionInput {
    width: 100%;
    height: 45px;
    padding: 0 50px 0 16px;
    border: 2px solid #dc143c;
    border-radius: 22px;
    font-size: 14px;
    outline: none;
    background: #fff;
    color: #202124;
    transition: all 0.3s ease;
    box-shadow: 0 1px 6px rgba(220, 20, 60, 0.15);
    font-family: inherit;
}

.google-search-box:hover,
#questionInput:hover {
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.25);
    border-color: #b71c1c;
}

.google-search-box:focus,
#questionInput:focus {
    box-shadow: 0 2px 10px rgba(220, 20, 60, 0.3);
    border-color: #dc143c;
}

.google-search-box::placeholder,
#questionInput::placeholder {
    color: #9aa0a6;
    font-size: 14px;
}

/* Smaller Send Button */
.search-btn,
#sendBtn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: #dc143c;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(220, 20, 60, 0.4);
}

.search-btn:hover:not(:disabled),
#sendBtn:hover:not(:disabled) {
    background: #b71c1c;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 3px 8px rgba(220, 20, 60, 0.5);
}

.search-btn:disabled,
#sendBtn:disabled {
    background: #dadce0;
    cursor: not-allowed;
    color: #5f6368;
    transform: translateY(-50%);
    box-shadow: none;
}

.send-icon {
    transform: translateX(1px);
}

/* PDF Status - Centered below search */
.pdf-status {
    display: inline-block;
    background: #f8f9fa;
    padding: 6px 16px;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    font-size: 13px;
    color: #5f6368;
    text-align: center;
}

/* =============================================================================
   CHATGPT STYLE LAYOUT (CHAT ABOVE SEARCH)
   ============================================================================= */
/* =============================================================================
   CHATGPT STYLE LAYOUT (CHAT ABOVE SEARCH)
   ============================================================================= */
.chat-view {
    display: none;
    flex-direction: column;
    height: calc(100vh - 80px);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 0 var(--space-lg);
}

.chat-view.active {
    display: flex;
}

/* PDF Status Header - At Top */
.chat-header {
    padding: var(--space-lg) 0;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-lg);
    order: 1; /* First element */
}

/* Chat Messages Area - In Middle (ABOVE SEARCH) */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg) 0;
    scroll-behavior: smooth;
    order: 2; /* Second element */
    margin-bottom: var(--space-lg);
}

/* Search Section - At Bottom (BELOW CHAT) */
.search-section {
    position: sticky;
    bottom: 0;
    background: var(--honeywell-white);
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--gray-200);
    order: 3; /* Third element - at bottom */
    margin-top: auto;
}


.message {
    margin-bottom: 24px;
    max-width: 85%;
    animation: fadeIn 0.4s ease-in;
}

.message.user {
    margin-left: auto;
    text-align: right;
}

.message.user .message-content {
    background: #dc143c;
    color: white;
    padding: 14px 18px;
    border-radius: 20px 20px 6px 20px;
    font-size: 14px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(220, 20, 60, 0.3);
}

.message.bot {
    text-align: left;
}

.message.bot .message-content {
    background: #f8f9fa;
    color: #202124;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 6px;
    font-size: 14px;
    line-height: 1.5;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #dc143c;
}

.message.bot.no-info .message-content {
    background: #fef7e0;
    border-left: 4px solid #fbbc04;
    color: #b06000;
}

.message.bot.error .message-content {
    background: #fce8e6;
    color: #d93025;
    border-left: 4px solid #ea4335;
}

/* Thinking Indicator */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 6px;
    border-left: 4px solid #dc143c;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc143c;
    animation: bounce 1.4s ease-in-out infinite both;
}

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

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

.thinking-text {
    color: #5f6368;
    font-size: 14px;
    font-style: italic;
}

/* =============================================================================
   ERROR SECTION
   ============================================================================= */
.error-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #fff;
}

.error-message {
    text-align: center;
    max-width: 400px;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-left: 4px solid #ea4335;
}

.error-message h3 {
    color: #ea4335;
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 500;
}

.error-message p {
    margin-bottom: 24px;
    color: #5f6368;
    line-height: 1.5;
}

.error-message button {
    padding: 12px 28px;
    background: #dc143c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.error-message button:hover {
    background: #b71c1c;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
@media (max-width: 1200px) {
    .pdf-grid {
        gap: 20px;
        justify-content: center;
    }
    
    .pdf-card {
        width: 260px;
        height: 160px;
        padding: 20px 16px;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 12px 16px;
    }
    
    .homepage-content {
        padding: 30px 15px;
    }
    
    .main-logo {
        font-size: 64px;
        flex-direction: column;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .logo-icon {
        font-size: 56px;
    }
    
    .tagline {
        font-size: 18px;
    }
    
    .logo-section {
        margin-bottom: 40px;
    }
    
    /* 2 cards per row on tablet */
    .pdf-grid {
        gap: 16px;
        margin-bottom: 50px;
    }
    
    .pdf-card {
        width: 240px;
        height: 150px;
        padding: 18px 14px;
    }
    
    .pdf-image {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }
    
    .pdf-icon {
        font-size: 44px;
        margin-bottom: 12px;
    }
    
    .pdf-name {
        font-size: 14px;
    }
    
    .search-section {
        max-width: 100%;
    }
    
    .chat-input-container {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .homepage-content {
        padding: 20px 10px;
    }
    
    .main-logo {
        font-size: 48px;
    }
    
    .logo-icon {
        font-size: 40px;
    }
    
    .tagline {
        font-size: 16px;
    }
    
    /* 1 card per row on mobile */
    .pdf-grid {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        margin-bottom: 40px;
    }
    
    .pdf-card {
        width: 100%;
        max-width: 280px;
        height: 140px;
        padding: 16px 12px;
    }
    
    .pdf-image {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }
    
    .pdf-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .pdf-name {
        font-size: 14px;
    }
    
    .google-search-box,
    #questionInput {
        height: 40px;
        padding: 0 45px 0 14px;
        font-size: 14px;
    }
    
    .search-btn,
    #sendBtn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.hidden { 
    display: none !important; 
}

.visible { 
    display: block !important; 
}

/* Force enable inputs */
#questionInput,
.google-search-box,
#sendBtn,
.search-btn {
    pointer-events: auto !important;
}

/* =============================================================================
   SCROLLBAR STYLING
   ============================================================================= */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9aa0a6;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9aa0a6;
}

/* External Knowledge Indicator */
.external-knowledge-indicator {
    background: rgba(52, 168, 83, 0.1);
    color: #34a853;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid rgba(52, 168, 83, 0.2);
    text-align: center;
}

/* External Knowledge Message Style */
.message.bot.external .message-content {
    background: rgba(52, 168, 83, 0.05);
    border-left: 4px solid #34a853;
    color: #1a7431;
}

/* Domain Restricted Message Style */
.message.bot.error .message-content {
    background: rgba(251, 188, 4, 0.1);
    border-left: 4px solid #fbbc04;
    color: #b06000;
}


/* Web Search Card Styling */
.web-search-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
    border: 2px solid #2196f3;
}

.web-search-card:hover {
    border-color: #1976d2;
    box-shadow: 0 8px 24px rgba(33, 150, 243, 0.3);
}

.web-search-card .pdf-icon {
    color: #2196f3;
    font-size: 48px;
}

.card-subtitle {
    font-size: 10px;
    color: #2196f3;
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Web Source Citation Styling */
.web-sources {
    background: rgba(33, 150, 243, 0.1);
    border-left: 4px solid #2196f3;
    padding: 12px;
    margin: 12px 0;
    border-radius: 8px;
}

.web-source-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

.web-source-link:hover {
    text-decoration: underline;
}
/* Enhanced Source Indicators */
.enhanced-sources-indicator {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.standard-sources-indicator {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Enhanced Message Styling */
.message.bot.enhanced .message-content {
    background: rgba(76, 175, 80, 0.05);
    border-left: 4px solid #4CAF50;
    color: #1B5E20;
}
