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

.mobile-message {
    display: none;
}

:root {
  --bg: #0b1020;
  --card: #131a2b;
  --border: rgba(255, 255, 255, 0.08);

  --text: #f8fafc;
  --secondary: #94a3b8;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 40px 20px;
  overflow-x: hidden;
}

.hidden {
  display: none !important; /* Overrides any block declarations below */
}

.background-glow {
  position: fixed;
  width: 700px;
  height: 700px;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.18),
    transparent 70%
  );
  top: -250px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.app {
  width: 100%;
  max-width: 1000px;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  margin-bottom: 35px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero p {
  color: var(--secondary);
}

/* --- TOP BAR --- */
.top-bar {
  position: sticky;
  top: 0;
  width: 100vw; /* Stretch full-width regardless of body layout */
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background: rgba(11, 16, 32, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 40px; /* Pushes the main .app container down cleanly */
}

.owner-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.top-bar-right {
  display: flex;
  gap: 24px;
}

.top-bar-right a {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.top-bar-right a:hover {
  color: white;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* --- TEMPERATURE SLIDER --- */
.temperature-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.temperature-wrapper span {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--secondary);
}

/* Custom Input Track Styling */
#temperatureSlider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

#temperatureSlider:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Custom Input Thumb (The Knob) - Webkit (Chrome/Safari/Edge) */
#temperatureSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transition:
    transform 0.1s ease,
    background-color 0.2s;
}

#temperatureSlider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-hover);
}

/* Custom Input Thumb - Firefox */
#temperatureSlider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transition:
    transform 0.1s ease,
    background-color 0.2s;
  cursor: pointer;
}

#temperatureSlider::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--accent-hover);
}

.temperature-description {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #a78bfa;
}

.setup-card,
.status-card,
.chat-section {
  background: rgba(19, 26, 43, 0.75);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

/* Restrict input style to only actual text inputs so it doesn't break files layout */
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: white;
  border-radius: 14px;
  padding: 14px;
  outline: none;
  transition: 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
}

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 50px 20px;
  text-align: center;
  cursor: pointer;
  transition: 0.25s;
}

.drop-zone:hover {
  border-color: var(--accent);
}

.drop-zone.dragover {
  transform: scale(1.02);
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  color: var(--accent);
}

.drop-content h3 {
  margin-bottom: 8px;
}

.drop-content p {
  color: var(--secondary);
}

.drop-zone.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(100%);
}

#uploadBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #555;
}

#uploadBtn:disabled:hover {
  background: #555;
}

.file-list {
  margin-top: 20px;
}

.file-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-item i.fa-file-pdf {
  color: #ef4444;
}

.remove-file-btn {
  color: #ef4444;
  opacity: 0.6;
  transition: 0.2s;
}

.remove-file-btn:hover {
  opacity: 1;
}

/* BUTTON ENGINE DESIGNATION */
#uploadBtn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px;
  margin-top: 20px;
  cursor: pointer;
  font-weight: 600;
  /* background: var(--accent); */
  color: white;
  transition: 0.25s;
}

/* #uploadBtn:hover {
  background: var(--accent-hover);
} */

/* SESSION ACTIONS BUTTON GROUP CONTAINER */
.session-actions-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.secondary-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: white;
  background: rgba(139, 92, 246, 0.05);
}

.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #64748b;
}

.secondary-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #64748b;
}

.status-card {
  text-align: center;
}

.status-card i {
  color: #22c55e;
  margin-right: 6px;
}

/* CHAT SECTION */

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 30px;
}

.prompt-chip {
  padding: 16px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}

.prompt-chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.18);
}

.chat-section {
  display: flex;
  flex-direction: column;
  height: 650px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;

  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  min-width: 120px;

  padding: 14px 18px;
  border-radius: 18px;
  margin: 8px 0;
}

.message-content {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.message-content pre {
  background: #0f172a;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 10px 0;
}

.message-content code {
  font-family: monospace;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin-bottom: 10px;
}

.message-content p {
  line-height: 1.7;
  margin-bottom: 10px;
}

.message-content ul,
.message-content ol {
  padding-left: 24px;
  margin: 10px 0;
}

.message-content li {
  margin-bottom: 6px;
}

.message.assistant-error {
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.message.assistant-error .message-content {
  color: #ff8a8a;
}

.user {
  background: var(--accent);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.assistant {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  margin-right: auto; /* Keeps assistant left-aligned smoothly */
  border-bottom-left-radius: 4px;
}

.chat-input {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.chat-input input {
  flex: 1;
}

.chat-input button {
  width: 140px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: white;
  transition: 0.25s;
}

.chat-input button:hover {
  background: var(--accent-hover);
}

/* CITATIONS PLACEMENT CHIPS */
.sources {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

.source-chip {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
}

.source-chip:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent);
  color: white;
}

.source-chip i {
  font-size: 0.7rem;
}

.empty-state {
  text-align: center;
  margin-top: 80px;
  color: var(--secondary);
}

.empty-state ul {
  list-style: none;
  margin-top: 10px;
}

.empty-state li {
  margin-bottom: 8px;
}

/* COPY ACTIONS MODAL CONFIGURATION */
.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  opacity: 0;
  transition: 0.2s;
}

.message:hover .message-actions {
  opacity: 1;
}

.copy-btn {
  background: transparent !important;
  border: none !important;
  width: auto !important;
  padding: 4px 8px !important;
  margin: 0 !important;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.copy-btn:hover {
  color: white;
}

/* INSPECTION SYSTEM DIALOGUE WINDOWS */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* Ensure modal stays on top of everything */
}

.modal-content {
  background: #131a2b;
  padding: 24px;
  border-radius: 20px;
  width: 80%;
  max-width: 650px;
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.close {
  float: right;
  cursor: pointer;
  font-size: 24px;
  color: var(--secondary);
  transition: 0.2s;
}

.close:hover {
  color: white;
}

pre {
  white-space: pre-wrap;
  margin-top: 16px;
  color: #cbd5e1;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.3rem;
  }
  .chat-section {
    height: 75vh;
  }
  .chat-input {
    flex-direction: column;
  }
  .chat-input button {
    width: 100%;
  }
  .message {
    max-width: 95%;
  }
  .session-actions-bar {
    flex-direction: column;
    gap: 8px;
  }
}

/* --- WORKSPACE SPLIT-SCREEN LAYOUT --- */
.workspace-container {
  display: flex;
  width: 100%;
  height: 700px;
  background: rgba(19, 26, 43, 0.75);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 24px;
}

/* Chat view properties (cannot be decreased below default minimum baseline width) */
.chat-section {
  flex: 1;
  min-width: 450px;
  display: flex;
  flex-direction: column;
  height: 100% !important;
  margin-bottom: 0 !important;
  border: none !important;
  background: transparent !important;
}

/* Resizer Bar UI Properties */
.panel-resizer {
  width: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  user-select: none;
}

.panel-resizer:hover,
.panel-resizer:active {
  background: rgba(139, 92, 246, 0.3);
}

.resizer-handle {
  width: 2px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* PDF Side View Window Panel */
.pdf-panel {
  width: 450px; /* Initial starting split */
  min-width: 0px;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.4);
  transition: width 0.1s ease-out;
}

/* Collapsed class state trigger */
.pdf-panel.collapsed {
  width: 0px !important;
  border-left: none !important;
  overflow: hidden;
}

.pdf-panel.collapsed .pdf-panel-header,
.pdf-panel.collapsed .pdf-viewer-body {
  display: none;
}

.pdf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(19, 26, 43, 0.9);
}

.selector-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  margin-right: 12px;
}

.selector-wrapper i {
  color: var(--accent);
}

#pdfSelector {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}

#pdfSelector option {
  background: #131a2b;
  color: white;
}

#togglePdfBtn {
  background: transparent;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  transition: color 0.2s;
}

#togglePdfBtn:hover {
  color: white;
}

.pdf-viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.pdf-placeholder {
  text-align: center;
  color: var(--secondary);
  margin-top: 150px;
  font-size: 0.95rem;
}

/* PDFJS Text layer highlighting components configurations styles wrapper */
.pdf-page-container {
  position: relative;
  margin-bottom: 24px;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

/* Render text layers */
.pdf-text-layer {
  position: absolute;
  inset: 0;
  opacity: 1; /* not 0 */
}

.pdf-text-layer span {
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;

  color: rgba(0, 0, 0, 0); /* transparent text */
}

.pdf-text-layer ::selection {
  background: rgba(59, 130, 246, 0.4);
}

/* FLOATING CITATIONS HIGHLIGHTS ACTION CONTROLLER */
.floating-quote-btn {
  position: fixed;
  z-index: 10000;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -100%);
  margin-top: -10px;
}

.floating-quote-btn:hover {
  background: var(--accent-hover);
}

.hero-subline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 4px;
}

.toggle-setup-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--secondary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.toggle-setup-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: white;
}

.setup-card {
  max-height: 800px;
  opacity: 1;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease,
    padding 0.4s ease,
    margin-btm 0.4s ease;
}

.setup-card.minimized {
  max-height: 0px !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  border: none !important;
}

.context-bar {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.context-chip {
  display: flex;
  align-items: center;
  gap: 10px;

  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);

  padding: 10px 12px;
  border-radius: 12px;

  font-size: 0.9rem;
}

.context-chip button {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
}

.input-wrapper {
  margin-top: 20px;

  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);

  border-radius: 18px;
  overflow: hidden;
}

.chat-input {
  margin-top: 0;
  padding: 12px;
}

.context-bar {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-context-chip {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.12);
}

.user-context-chip button {
  margin-left: 8px;

  background: transparent;
  border: none;

  color: inherit;
  cursor: pointer;
}

.quoted-context {
  margin-bottom: 10px;

  font-size: 0.85rem;

  padding: 8px 12px;

  border-radius: 12px;

  background: rgba(255, 255, 255, 0.15);

  display: flex;
  gap: 8px;
  align-items: center;
}

/* Firefox */
#chatMessages {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.7) transparent;
}

/* Chrome / Edge / Safari */
#chatMessages::-webkit-scrollbar {
  width: 10px;
}

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

#chatMessages::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.65);
  border-radius: 999px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.85);
}

@media (max-width: 900px) {

    .app,
    .top-bar,
    .background-glow {
        display: none !important;
    }

    .mobile-message {
        display: flex !important;

        min-height: 100vh;
        width: 100vw;

        align-items: center;
        justify-content: center;

        text-align: center;

        padding: 32px;
    }

    .mobile-message i {
        font-size: 4rem;
        color: var(--accent);
        margin-bottom: 20px;
    }

    .mobile-message h2 {
        margin-bottom: 16px;
    }

    .mobile-message p {
        color: var(--secondary);
        line-height: 1.7;
        max-width: 420px;
    }
}