/**
 * File: omni-ed/assets/css/omed-overlay.css
 * Description: Stylesheet managing the Omni-Ed chat overlay, split-pane layout, 
 * business-card search results with thumbnails, and mobile responsiveness.
 */

/* ==========================================================================
   1. FLOATING LAUNCHER BUTTON
   ========================================================================== */
#omed-launcher-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  padding: 12px 18px;
  border-radius: 50px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

#omed-launcher-btn:hover {
  background: #1e293b;
  transform: translateY(-2px);
}

.omed-launcher-icon {
  font-size: 18px;
}

/* ==========================================================================
   2. OVERLAY CONTAINER & BACKDROP
   ========================================================================== */
.omed-overlay-hidden {
  display: none !important;
}

#omed-full-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.omed-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
}

.omed-overlay-container {
  position: relative;
  z-index: 2;
  width: 95vw;
  height: 90vh;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   3. HEADER
   ========================================================================== */
.omed-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #0f172a;
  color: #ffffff;
  border-bottom: 1px solid #1e293b;
}

.omed-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.omed-header-brand h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}

.omed-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.omed-close-btn:hover {
  color: #ffffff;
}

/* ==========================================================================
   4. SPLIT PANE BODY & BUSINESS CARDS (LHS)
   ========================================================================== */
.omed-overlay-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #f8fafc;
}

/* Sidebar (LHS) */
.omed-sidebar {
  width: 340px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
}

.omed-search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.omed-search-box input:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.omed-search-results {
  margin-top: 16px;
  flex: 1;
  overflow-y: auto;
}

/* Business Card LHS Item Styling */
.omed-search-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: #1e293b;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.omed-search-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Thumbnail Image or Fallbox */
.omed-card-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}

.omed-card-thumb-fallback {
  width: 44px;
  height: 44px;
  background: #e2e8f0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* Card Content Area */
.omed-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.omed-search-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
  line-height: 1.35;
  display: block;
  white-space: normal;
  word-break: break-word;
}

.omed-search-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.omed-search-item-type {
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

.omed-search-item-excerpt {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   5. MAIN CHAT AREA (RHS)
   ========================================================================== */
.omed-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  min-width: 0;
}

.omed-chat-stream {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.omed-chat-msg {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.omed-msg-bot {
  align-self: flex-start;
}

.omed-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.omed-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.omed-msg-content {
  background: #ffffff;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.omed-msg-user .omed-msg-content {
  background: #0284c7;
  color: #ffffff;
  border: none;
}

.omed-msg-content p {
  margin: 0 0 10px 0;
}

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

.omed-msg-content a {
  color: #0284c7;
  text-decoration: underline;
}

.omed-msg-user .omed-msg-content a {
  color: #ffffff;
}

/* Chat Input Bar */
.omed-chat-form {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-sizing: border-box;
  width: 100%;
}

.omed-chat-form textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  max-height: 120px;
  box-sizing: border-box;
}

.omed-chat-form textarea:focus {
  outline: none;
  border-color: #0284c7;
}

.omed-chat-form button {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 0 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.omed-chat-form button:hover {
  background: #0369a1;
}

/* ==========================================================================
   6. MOBILE RESPONSIVE FIXES
   ========================================================================== */
@media screen and (max-width: 768px) {
    #omed-full-overlay .omed-overlay-container {
        display: flex;
        flex-direction: column;
        height: 100vh;
        width: 100vw;
        top: 0;
        left: 0;
        border-radius: 0;
    }

    /* Hide LHS Sidebar cleanly on mobile portrait screens */
    .omed-sidebar {
        display: none !important;
    }

    .omed-chat-main {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        background: #f8fafc;
        min-width: 0;
    }

    #omed-chat-stream {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .omed-chat-stream .omed-chat-msg {
        max-width: 90%;
    }

    .omed-chat-form {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 12px;
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        width: 100%;
        box-sizing: border-box;
    }

    .omed-chat-form textarea {
        flex: 1;
        width: auto;
        min-width: 0;
        padding: 10px 12px;
        box-sizing: border-box;
    }

    .omed-chat-form button {
        padding: 0 16px;
        flex-shrink: 0;
        white-space: nowrap;
    }
}