/* =========================================
   1. VARIABLES & THEME
   ========================================= */
:root {
    /* Colors */
    --bg-dark: #2D3740;       /* Main Body BG */
    --bg-darker: #262f37;     /* Nav BG */
    --bg-panel: #3A4550;      /* Content Panels */
    --bg-input: #1a202c;      /* Input Fields */
    
    --text-main: #ffffff;
    --text-muted: #cccccc;
    
    --accent-primary: #3498db; /* Blue */
    --accent-hover: #2980b9;
    --accent-success: #27ae60; /* Green */
    --accent-danger: #c0392b;  /* Red */
    --accent-brown: #976C4C;   /* Link Hover */
    
    /* Layout */
    --header-height: 100px;
    --col-right-width: 400px; /* Fixed width for Bot column */
}

/* =========================================
   2. GLOBAL RESET
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; /* App-like feel */
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* =========================================
   3. HEADER & NAVIGATION
   ========================================= */
.header {
    flex: 0 0 auto; /* Don't shrink */
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-dark);
    z-index: 10;
    padding-right: 20px;
}

.logo {
    height: 100%;
    display: flex;
    align-items: center;
}
.logo img {
    padding-top: 10px;
    height: 80px;
}

/* Nav Links */
.nav { display: flex; }
.nav-item { position: relative; margin: 0 15px; }
.nav-item > a { padding: 10px; display: inline-block; }
.nav-item > a:hover { color: var(--accent-brown); }

/* Dropdowns */
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-darker);
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
}

.dropdown li {
    padding: 10px 20px 10px 20px;
    width: 10vw;
}

.nav-item:hover .dropdown { display: block; }

.dropdown-item { width: 160px; }
.dropdown-item a {
    display: block;
    padding: 10px 15px;
    color: #fff;
}
.dropdown-item:hover { background-color: #212931; }

/* Header Buttons */
.buttons { display: flex; }
.button {
    padding: 10px 20px;
    margin-left: 10px;
    background-color: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.button:hover { background-color: #777; }

/* =========================================
   4. MAIN LAYOUT (Grid)
   ========================================= */
.main-column-layout {
    /* STRICT HEIGHT: 100% of viewport minus the 100px header */
    height: calc(100vh - 100px); 
    display: grid;
    grid-template-columns: 1fr var(--col-right-width);
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Left Column: Content Area */
.content-area {
    background-color: var(--bg-panel);
    margin: 20px;
    padding: 20px;
    border-radius: 8px;
    overflow-y: hidden; /* Internal scrolling handled by children */
    display: flex;
    flex-direction: column;
    position: relative;
}

.content-area h2 {
	border-bottom: 1px solid #666;
    padding: 5px;
    margin-bottom: 10px;
	color: #b69882;
}

.content-area p {
	padding-bottom: 15px;
}

.content-area a {
	color: #ccb7a8;
	transition: all 0.3s ease;
}
.content-area a:hover {
	color: #b69882;
}

#content-iframe, .content-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 4px;
    display: block;
}

/* Right Column: Bot */
.right-column {
    background-image: url('assets/images/bg.png');
    background-size: cover;
    background-position: center;
    width: 100%;
    height: 100%;       /* Fill the grid cell exactly */
    position: relative; /* Anchor point for the bot */
    overflow: hidden;   /* Cut off anything that tries to stick out */
    border-left: 1px solid #444;
	padding: 20px;
}

#bot-container {
    width: 100%;
    height: 100%;
    position: relative;
}


/* =========================================
   5. UI COMPONENTS (Tabs, Modals)
   ========================================= */

/* Tabs */
.tab-nav {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #555;
}
.tab-button {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: 0.3s;
}
.tab-button:hover { color: #fff; }
.tab-button.active {
    color: #fff;
    border-bottom: 3px solid var(--accent-primary);
    font-weight: bold;
}
.tab-button.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* Views */
.view-section { display: none; width: 100%; height: 100%; overflow-y: auto; }
.view-section.active { display: block; }

/* Modals */
.modal-overlay, .modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    align-items: center;
    justify-content: center;
}

.modal-box, .modal-content {
    background-color: var(--bg-dark);
    padding: 25px;
    border: 1px solid #555;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    text-align: left;
}

.modal-box h3, .modal-header h2 { margin-top: 0; color: #fff; margin-bottom: 15px; }
.modal-box p { color: #ccc; line-height: 1.5; margin-bottom: 20px; }

/* Modal Inputs */
.upload-form-group label, .modal-body label { display: block; margin-bottom: 8px; color: #ccc; font-size: 0.9rem; }
.upload-form-group input, .modal-body input {
    width: 100%; padding: 10px; margin-bottom: 15px;
    background: var(--bg-input); border: 1px solid #555;
    border-radius: 4px; color: #fff;
}

/* Modal Buttons */
.modal-btn, .modal-footer button {
    padding: 10px 20px; border-radius: 4px; border: none; cursor: pointer;
    font-weight: 600; margin-right: 10px;
}
.btn-primary, .login-btn { background-color: var(--accent-primary); color: white; }
.btn-success { background-color: var(--accent-success); color: white; }
.btn-secondary, .cancel-btn { background-color: #555; color: white; }
.btn-primary:hover { background-color: var(--accent-hover); }

/* Loading Spinner */
.loading-hidden { display: none !important; }
#loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px);
}
.spinner {
    width: 60px; height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================
   6. RESEARCH TOOL SPECIFIC STYLES
   ========================================= */

/* Search Menu Bar */
.searchMenu {
    display: flex;
    width: 100%;
    padding: 0 10px;
    margin-bottom: 20px;
    gap: 15px;
    align-items: center;
}

#searchContainer { display: flex; flex-grow: 1; height: 40px; }
#searchInput {
    width: 100%; padding: 0 20px;
    background: var(--bg-input); color: #fff;
    border: 1px solid #555; border-right: none;
    border-radius: 20px 0 0 20px; outline: none;
}

#controlsContainer { display: flex; align-items: center; gap: 10px; }

/* Toolbar Buttons */
.toolbar-btn {
    height: 40px; padding: 0 20px;
    font-size: 14px; font-weight: 600;
    border: none; cursor: pointer; color: white;
    white-space: nowrap; transition: 0.2s;
}

#searchButton { background-color: var(--accent-primary); border-radius: 0; }
#clearSearchButton { background-color: #4B5563; border-radius: 0 20px 20px 0; }
#scrapeButton { background-color: var(--accent-success); border-radius: 4px; }
#scrapeButton:disabled { background-color: #444; color: #888; cursor: not-allowed; }

.calc-btn { background-color: #9b59b6; border-radius: 4px; } /* Purple */
.calc-btn:hover { background-color: #8e44ad; }

#addDocsButton { background-color: #e67e22; border-radius: 4px; }
#clearReportButton, #clearReaderButton, #clearExposureBtn { 
    background-color: var(--accent-danger); border-radius: 4px; 
}

/* Results List */
#resultsContainer { margin-top: 20px; }
.result-item {
    display: flex; align-items: flex-start;
    margin-bottom: 15px; padding: 15px;
    border: 1px solid #444; border-radius: 8px;
    background-color: rgba(0,0,0,0.2);
}
.result-item input[type="checkbox"] { margin-right: 15px; transform: scale(1.3); margin-top: 5px; cursor: pointer; }
.result-content h3 { margin: 0 0 5px 0; font-size: 18px; }
.result-content h3 a { color: var(--accent-primary); }
.result-link { font-size: 12px; color: #888; margin-bottom: 5px; }
.result-snippet { font-size: 14px; color: var(--text-muted); line-height: 1.4; }

/* Report Output Areas */
#reportContainer, #readerContainer, #exposureContainer {
    background-color: rgba(255,255,255,0.05);
    padding: 25px;
    border-radius: 8px;
    line-height: 1.6;
    min-height: 300px;
	margin-top: 25px;
}

/* Helper Text */
.searchInstructions { color: #888; font-size: 14px; text-align: center; margin-bottom: 20px; }
#scrapeMessage { color: var(--text-muted); font-size: 14px; white-space: nowrap; }

/* Botpress Chat Bubble Override */
.bpMessageBlocksRow > button { background-color: bisque !important; }

/* =========================================
   7. BOTPRESS DOCKING OVERRIDES
   ========================================= */

/* Target the main wrapper Botpress creates */
#bp-web-widget {
    position: relative !important; /* Stop floating fixed on screen */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    max-width: none !important;
    background: transparent !important;
    z-index: 1 !important;
}

/* Ensure the internal iframe fills the space */
#bp-web-widget iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important; /* Optional: Remove rounded corners to fit panel */
}

/* Hide the default launcher bubble if it appears (we want the chat open always) */
.bp-widget-launcher {
    display: none !important;
}