/* File: src/styles/nexaknowledgelab.css */

/* --- NEXA VARIABLES --- */
:root {
  --nexa-gold: #b08a48;
  --nexa-bg: #f9f9f9;
  --nexa-border: #e0e0e0;
  --nexa-hover: #faf8f5;
  --nexa-text: #333;
}

/* --- MAIN LAYOUT ENGINE (FLEXBOX REWRITE) --- */
body[data-page="nexa-lab"] {
  background-color: #fff;
  height: 100vh;
  width: 100vw; /* Force full viewport width */
  overflow: hidden; 
  display: flex;
  flex-direction: column;
  transform: none !important;
}

/* WRAPPER: The Container for the 3 Columns */
.nexa-wrapper {
  flex: 1; /* Take all vertical space below nav */
  display: flex !important; /* 🔥 FLEXBOX: The fix for the gap */
  flex-direction: row !important; /* Force side-by-side */
  width: 100% !important;
  overflow: hidden;
  position: relative;
}

/* --- COLUMNS --- */

/* 1. Intake (Left) */
#col-intake {
  flex: 0 0 25%; /* Fixed 25% width */
  max-width: 25%;
  border-right: 1px solid var(--nexa-border);
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* 2. The Lab (Center) - THE GAP KILLER */
#col-lab {
  flex: 1 !important; /* 🔥 GROW: This eats the white space */
  min-width: 0; /* Prevents flex items from overflowing */
  border-right: 1px solid var(--nexa-border);
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* 3. Findings (Right) */
#col-findings {
  flex: 0 0 25%; /* Fixed 25% width */
  max-width: 25%;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* --- SHARED INTERNALS --- */
.nexa-header {
  padding: 12px 15px;
  border-bottom: 1px solid var(--nexa-border);
  background: #fff;
  font-weight: bold;
  color: var(--nexa-gold);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  flex-shrink: 0;
  white-space: nowrap; /* Prevent header text wrap */
}

.nexa-body {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: var(--nexa-bg);
}

/* --- INTAKE & LAB STYLES --- */
.upload-zone {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  transition: all 0.2s;
  background: #fff;
  cursor: pointer;
  color: #999;
}
.upload-zone:hover, .upload-zone.drag-active {
  border-color: var(--nexa-gold);
  background: var(--nexa-hover);
  color: var(--nexa-gold);
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 40px;
}
.chat-input-area {
  background: #fff;
  padding: 15px;
  border-top: 1px solid var(--nexa-border);
  flex-shrink: 0;
}

/* Messages */
.nexa-msg {
  margin-bottom: 15px;
  padding: 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 90%;
}
.nexa-msg.ai { border-left: 3px solid var(--nexa-gold); align-self: flex-start; }
.nexa-msg.user { background: #f0f4f8; border-color: transparent; align-self: flex-end; margin-left: auto; text-align: right; }

/* Findings & Library */
.finding-card {
  background: #fff;
  border: 1px solid var(--nexa-border);
  border-left: 4px solid var(--nexa-gold);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.editable-content { outline: none; min-height: 60px; color: var(--nexa-text); font-size: 0.9rem; white-space: pre-wrap; }
.card-tools { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #eee; display: flex; justify-content: flex-end; gap: 12px; font-size: 0.85rem; }
.card-tool-btn { color: #aaa; cursor: pointer; transition: color 0.2s; }

.source-pill {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 30px;
  padding: 8px 15px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
}
.source-pill.active { border-color: var(--nexa-gold); background: #fffdf9; }

/* Utils */
.text-gold { color: var(--nexa-gold) !important; }
.bg-gold { background-color: var(--nexa-gold) !important; color: #fff !important; }

/* --- DESKTOP INPUT FIXES --- */
.chat-input-area .input-group {
  align-items: flex-end;
  gap: 10px; 
}
.chat-input-area textarea {
  resize: none; 
  border-radius: 6px !important; 
}
.chat-input-area #micBtn,
.chat-input-area button[type="submit"] {
    border-radius: 6px !important;
    margin-left: 0 !important; 
}

/* Mic Button Animation */
#micBtn.recording {
  color: #fff;
  background-color: var(--nexa-gold);
  border-color: var(--nexa-gold);
  animation: pulse-gold 1.5s infinite;
}
@keyframes pulse-gold {
  0% { box-shadow: 0 0 0 0 rgba(176, 138, 72, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(176, 138, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(176, 138, 72, 0); }
}

/* --- MOBILE ADAPTATION --- */
.mobile-tab-bar { display: none; }

@media (max-width: 991px) {
  html, body {
     height: auto !important; 
     overflow-y: auto !important;
     display: block !important; /* Release Flexbox on mobile */
  }

  .nexa-wrapper { 
    display: block !important; 
    height: auto !important; 
    padding-bottom: 90px; 
  }
  
  /* Reset Columns for Mobile Stack */
  #col-intake, #col-lab, #col-findings {
    display: none;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    height: auto !important; 
    min-height: 60vh;
    border-right: none !important;
  }
  
  .active-col { display: flex !important; } /* Only show active tab */

  .site-footer {
     position: relative !important;
     z-index: 10 !important;
     padding-bottom: 120px !important; 
  }

  /* Mobile Input Adjustments */
  .chat-input-area .input-group {
    display: flex !important;
    flex-wrap: wrap !important; 
    gap: 12px !important; 
  }
  .chat-input-area textarea#labInput {
    flex: 0 0 100% !important; 
    width: 100% !important;
  }
  .mobile-tab-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important; 
    left: 0 !important; 
    right: 0 !important;
    width: 100% !important;
    height: 70px !important; 
    background: #fff !important;
    border-top: 1px solid var(--nexa-border) !important;
    justify-content: space-around !important;
    align-items: center !important;
    z-index: 2147483647 !important; 
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1) !important;
  }
  .mobile-tab {
    text-align: center; font-size: 0.7rem; color: #999;
    cursor: pointer; flex: 1; padding: 10px 0;
  }
  .mobile-tab i { display: block; font-size: 1.4rem; margin-bottom: 4px; }
  .mobile-tab.active {
    color: var(--nexa-gold); font-weight: bold; background: #faf8f5;
  }
}