/* ==========================================================================
   PubMed Publication Explorer & Chanakya AI Agent
   Unified Color Profile & Design System (Derived from methylR 2.0 Hybrid)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #0d9488;
  --accent-color: #8b5cf6;
  --dark-bg: #0f172a;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --chanakya-gold: #b46b18;
  --chanakya-dark: #925811;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #ffffff;
  margin: 3vh auto;
  padding: 24px 32px;
  border-radius: 1.25rem;
  width: 85%;
  max-width: 1400px;
  min-width: 320px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.close-button {
  color: #94a3b8;
  float: right;
  font-size: 26px;
  font-weight: bold;
  line-height: 1;
  transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
  color: #0f172a;
  cursor: pointer;
}

/* Back to top button */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
  transition: all 0.3s ease-in-out;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
}

#back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Basic markdown styling for reports */
.prose h1, .prose h2, .prose h3 {
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: #0f172a;
}
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.prose p {
  margin-bottom: 0.85rem;
  color: #334155;
  line-height: 1.6;
}
.prose ul, .prose ol {
  list-style-position: inside;
  margin-left: 1rem;
  margin-bottom: 1rem;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }

/* Auth Slider */
#auth-slider {
  transform: translateX(0);
  transition: transform 0.5s ease-in-out;
}

#auth-slider.active {
  transform: translateX(-100%);
}

/* ==========================================================================
   Floating AI Co-Pilot Drawer: Chanakya - the AI Guru (from methylR 2.0)
   ========================================================================== */

.floating-copilot-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 1060;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 60px; /* Deep pill shape */
  
  /* Rich, translucent amber-brown liquid glass tint */
  background: linear-gradient(135deg, rgba(175, 105, 55, 0.9) 0%, rgba(100, 45, 25, 0.96) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  
  /* Sculpted multi-layered border and lighting */
  border: 1px solid rgba(255, 200, 150, 0.45);
  box-shadow: 
    inset 0 1px 1px rgba(255, 235, 210, 0.8),
    inset 0 3px 6px rgba(255, 180, 120, 0.2),
    inset 0 -4px 8px rgba(30, 10, 5, 0.6),
    0 16px 36px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(180, 110, 70, 0.25);

  color: #ffecd6 !important;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  gap: 8px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-copilot-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,220,180,0), rgba(255,245,230,0.95), rgba(255,220,180,0));
  pointer-events: none;
  z-index: 2;
}

.floating-copilot-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,220,180,0.25) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.floating-copilot-btn:hover {
  background: linear-gradient(135deg, rgba(195, 120, 70, 0.95) 0%, rgba(120, 55, 32, 0.99) 100%);
  border-color: rgba(255, 210, 170, 0.7);
  box-shadow: 
    inset 0 1px 2px rgba(255, 240, 220, 0.95),
    inset 0 4px 8px rgba(255, 190, 130, 0.3),
    inset 0 -4px 8px rgba(30, 10, 5, 0.5),
    0 20px 44px rgba(0, 0, 0, 0.45),
    0 0 30px rgba(200, 130, 80, 0.4);
  transform: translateY(-3px);
  color: #ffffff !important;
}

.floating-copilot-btn:hover::after {
  opacity: 1;
}

.floating-copilot-btn:active {
  transform: translateY(1px);
  box-shadow: 
    inset 0 2px 5px rgba(20, 5, 2, 0.7),
    0 10px 20px rgba(0, 0, 0, 0.35);
}

/* Floating Drawer Panel */
.floating-copilot-drawer {
  position: fixed;
  bottom: 85px;
  right: 25px;
  width: 480px;
  max-width: 94vw;
  height: 600px;
  max-height: 82vh;
  z-index: 1060;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-copilot-drawer.maximized {
  width: 900px !important;
  max-width: 96vw !important;
  height: 88vh !important;
  max-height: 92vh !important;
  bottom: 20px !important;
  right: 20px !important;
  border-radius: 14px !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4) !important;
}

.floating-copilot-drawer.maximized .floating-copilot-body {
  padding: 16px !important;
}

.floating-copilot-drawer.minimized {
  height: 48px !important;
  max-height: 48px !important;
  width: 320px !important;
  overflow: hidden !important;
  border-radius: 12px !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer;
}

.floating-copilot-drawer.minimized .floating-copilot-body,
.floating-copilot-drawer.minimized #api_key_box {
  display: none !important;
}

.floating-copilot-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.floating-copilot-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Chat Messages */
.chat-bubble {
  max-width: 92%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--primary-color);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-bubble.agent {
  align-self: flex-start;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--chanakya-dark);
  border-bottom-left-radius: 2px;
}

.chat-bubble table {
  width: 100%;
  margin: 10px 0;
  border-collapse: collapse;
  font-size: 0.8rem;
  display: block;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.chat-bubble th, .chat-bubble td {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.chat-bubble th {
  background-color: #f1f5f9;
  font-weight: 700;
  color: #0f172a;
}

.chat-bubble pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  overflow-x: auto;
  margin: 8px 0;
}
