/* ==========================================================================
   CLINAETHER DISCOVERY & TRIAL EXPLORER - THEME DESIGN SYSTEM (SCI-FI DARK MODE)
   ========================================================================== */

:root {
  /* Colors */
  --bg-primary: #05070f;
  --bg-sidebar: #090c15;
  --bg-glass: rgba(10, 15, 30, 0.65);
  --bg-card: rgba(14, 21, 40, 0.8);
  --border-glass: rgba(0, 240, 255, 0.1);
  --border-glass-hover: rgba(0, 240, 255, 0.25);
  
  --color-teal: #00ebd4;
  --color-cyan: #00f0ff;
  --color-purple: #a855f7;
  --color-coral: #ff6b6b;
  --color-completed: #10b981;
  --color-warning: #f59e0b;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Fonts */
  --font-body: 'Outfit', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Glows */
  --glow-cyan: 0 0 15px rgba(0, 240, 255, 0.35);
  --glow-purple: 0 0 15px rgba(168, 85, 247, 0.25);
  --glow-teal: 0 0 15px rgba(0, 235, 212, 0.3);
  --glow-coral: 0 0 15px rgba(255, 107, 107, 0.3);
  
  /* Shadows */
  --shadow-panel: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 8px 30px rgba(0, 240, 255, 0.12);
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  width: 100vw;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(14, 21, 40, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-cyan);
  box-shadow: var(--glow-cyan);
}

/* Canvas Background */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: all;
  background: radial-gradient(circle at 50% 50%, #0c1022 0%, #05070f 100%);
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */

.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 10;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-teal), var(--color-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-cyan);
}

.brand-svg {
  color: var(--bg-primary);
  width: 22px;
  height: 22px;
  stroke-width: 2.5px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(to right, #ffffff, var(--color-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 16px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item i {
  width: 20px;
  height: 20px;
  transition: var(--transition-fast);
}

.nav-item:hover {
  color: var(--color-cyan);
  background: rgba(0, 240, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.08);
}

.nav-item:hover i {
  transform: translateX(2px);
}

.nav-item.active {
  color: var(--color-teal);
  background: rgba(0, 235, 212, 0.08);
  border-color: rgba(0, 235, 212, 0.2);
  box-shadow: inset 0 0 10px rgba(0, 235, 212, 0.05);
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-dot.online {
  background-color: var(--color-teal);
  box-shadow: 0 0 8px var(--color-teal);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 235, 212, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(0, 235, 212, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 235, 212, 0); }
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 30px;
  overflow-y: auto;
  z-index: 1;
}

/* ==========================================================================
   GLASSMORPHISM BOILERPLATE
   ========================================================================== */

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: var(--shadow-panel);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
}

/* ==========================================================================
   SEARCH HEADER & CONTROLS
   ========================================================================== */

.search-header {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-container-wrapper {
  position: relative;
  width: 100%;
}

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(9, 13, 26, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 6px 6px 6px 18px;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-panel);
}

.search-bar:focus-within {
  border-color: var(--color-cyan);
  box-shadow: var(--glow-cyan), var(--shadow-panel);
}

.search-icon {
  color: var(--text-secondary);
  margin-right: 14px;
  width: 22px;
  height: 22px;
}

.search-bar input {
  flex-grow: 1;
  min-width: 0;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 10px 0;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  background: linear-gradient(135deg, var(--color-teal), var(--color-cyan));
  color: var(--bg-primary);
  border: none;
  outline: none;
  border-radius: 14px;
  padding: 12px 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--glow-teal);
  transition: var(--transition-fast);
}

.search-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.search-btn i {
  width: 16px;
  height: 16px;
  stroke-width: 2.5px;
}

/* Search Autocomplete */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(9, 13, 26, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass-hover);
  border-radius: 16px;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  padding: 8px;
}

.autocomplete-item {
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-fast);
  color: var(--text-secondary);
}

.autocomplete-item:hover {
  background: rgba(0, 240, 255, 0.08);
  color: var(--color-cyan);
}

.autocomplete-item .item-type {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(168, 85, 247, 0.15);
  color: var(--color-purple);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Spinner inside Search input */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 240, 255, 0.2);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  margin-right: 12px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Quick search tags */
.quick-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 6px;
}

.tag-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.quick-tag {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quick-tag:hover {
  color: var(--color-cyan);
  background: rgba(0, 240, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
  transform: translateY(-1px);
}

/* ==========================================================================
   WELCOME SCREEN STATS
   ========================================================================== */

.welcome-section {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.welcome-card {
  max-width: 760px;
  padding: 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.05);
}

.pulse-icon {
  width: 32px;
  height: 32px;
  color: var(--color-cyan);
  animation: pulse-glow 2.5s infinite ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(0, 240, 255, 0.4)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.8)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(0, 240, 255, 0.4)); }
}

.welcome-card h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 580px;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 30px;
  width: 100%;
}

.feat-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.feat-item i {
  color: var(--color-teal);
  width: 24px;
  height: 24px;
}

.feat-item h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

.feat-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   DASHBOARD GRID PANELS
   ========================================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-with-icon i {
  width: 20px;
  height: 20px;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Accent color items */
.accent-teal { color: var(--color-teal); filter: drop-shadow(0 0 5px rgba(0, 235, 212, 0.4)); }
.accent-cyan { color: var(--color-cyan); filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.4)); }
.accent-purple { color: var(--color-purple); filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4)); }
.accent-coral { color: var(--color-coral); filter: drop-shadow(0 0 5px rgba(255, 107, 107, 0.4)); }

/* Badges */
.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.badge-teal { background: rgba(0, 235, 212, 0.12); color: var(--color-teal); border: 1px solid rgba(0, 235, 212, 0.2); }
.badge-cyan { background: rgba(0, 240, 255, 0.12); color: var(--color-cyan); border: 1px solid rgba(0, 240, 255, 0.2); }
.badge-purple { background: rgba(168, 85, 247, 0.12); color: var(--color-purple); border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-coral { background: rgba(255, 107, 107, 0.12); color: var(--color-coral); border: 1px solid rgba(255, 107, 107, 0.2); }
.badge-green { background: rgba(16, 185, 129, 0.12); color: var(--color-completed); border: 1px solid rgba(16, 185, 129, 0.2); }

/* ==========================================================================
   MOLECULAR PROFILE COMPONENT
   ========================================================================== */

.molecular-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.molecule-structure-container {
  width: 100%;
  height: 220px;
  background: rgba(5, 7, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Grid lines pattern overlay on structure */
.molecule-structure-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

#molecule-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#molecule-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: invert(1) hue-rotate(180deg) brightness(1.2) contrast(1.1); /* Standard PubChem dark-mode invert */
}

.placeholder-structure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.icon-placeholder {
  width: 36px;
  height: 36px;
  stroke-width: 1.5px;
}

.placeholder-structure span {
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.molecule-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.info-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.molecule-text-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.molecule-text-details h4 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.scrollable-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 110px;
  overflow-y: auto;
  padding-right: 8px;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-synonym {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   CHARTS & STATISTICS PANEL
   ========================================================================== */

.canvas-chart-container {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   VISUAL TRIAL TIMELINE COMPONENT
   ========================================================================== */

.timeline-summary-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-cyan);
}

.custom-timeline {
  position: relative;
  padding: 20px 10px 40px 10px;
  width: 100%;
  margin-top: 10px;
}

.timeline-track {
  position: absolute;
  top: 32px;
  left: 30px;
  right: 30px;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 1;
  border-radius: 2px;
}

.timeline-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  width: 100%;
}

.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90px;
  text-align: center;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  border: 3px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 12px;
  transition: var(--transition-normal);
  box-shadow: 0 0 0 rgba(0, 240, 255, 0);
}

.timeline-step.active .step-dot {
  background: var(--color-cyan);
  border-color: var(--bg-primary);
  box-shadow: var(--glow-cyan), 0 0 0 6px rgba(0, 240, 255, 0.2);
}

.timeline-step.completed .step-dot {
  background: var(--color-teal);
  border-color: var(--bg-primary);
  box-shadow: var(--glow-teal);
}

.step-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.step-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.step-count {
  margin-top: 4px;
  font-size: 0.65rem !important;
  padding: 1px 6px !important;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.timeline-step.active .step-count {
  background: rgba(0, 240, 255, 0.15);
  color: var(--color-cyan);
}

/* ==========================================================================
   CLINICAL TRIALS LIST CONTAINER
   ========================================================================== */

.filter-header {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.filter-header .title-with-icon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.total-count-badge {
  font-size: 0.8rem;
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: rgba(5, 7, 15, 0.4);
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-select, .custom-input-filter {
  background: rgba(9, 13, 26, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: var(--transition-fast);
}

.custom-select:focus, .custom-input-filter:focus {
  border-color: var(--color-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.15);
}

.trials-body-container {
  display: flex;
  flex-direction: column;
  min-height: 380px;
  justify-content: space-between;
}

.trials-grid-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

/* Loader Styles */
.trials-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-grow: 1;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.double-bounce {
  width: 40px;
  height: 40px;
  position: relative;
}

.double-bounce::before, .double-bounce::after {
  content: '';
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--color-cyan);
  opacity: 0.6;
  position: absolute;
  top: 0; left: 0;
  animation: bounce 2.0s infinite ease-in-out;
}

.double-bounce::after {
  animation-delay: -1.0s;
}

@keyframes bounce {
  0%, 100% { transform: scale(0.0); }
  50% { transform: scale(1.0); }
}

/* Empty State */
.trials-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-grow: 1;
  text-align: center;
  padding: 40px 0;
}

.trials-empty-state i {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  stroke-width: 1.5px;
}

.trials-empty-state h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.trials-empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Trial Card Styling (Inspired by Agilie App) */
.trial-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition-normal);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.trial-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 240, 255, 0.25);
  box-shadow: var(--shadow-card-hover);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-badges {
  display: flex;
  gap: 6px;
}

.card-nct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.trial-card h4 {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.trial-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sponsor-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  max-width: 70%;
}

.sponsor-info i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sponsor-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-cyan);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-fast);
}

.trial-card:hover .view-link {
  gap: 6px;
  filter: brightness(1.1);
}

/* Pagination Footer */
.trials-pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pagination-indicator {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  outline: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.2);
  color: var(--color-cyan);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn i {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   MODAL PANEL STYLING
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 7, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.modal-content {
  width: 100%;
  max-width: 850px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 35px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.close-modal-btn:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.2);
  color: var(--color-coral);
}

.close-modal-btn i {
  width: 16px;
  height: 16px;
}

.modal-body {
  overflow-y: auto;
  flex-grow: 1;
}

.modal-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.meta-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.meta-item .badge {
  align-self: flex-start;
  margin-top: 2px;
}

.modal-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}

.modal-details-section {
  margin-bottom: 24px;
}

.modal-details-section h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-teal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.modal-details-section p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.criteria-text {
  background: rgba(5, 7, 15, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 16px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Animations */
.animated-scale {
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE DESIGN ADAPTATIONS
   ========================================================================== */

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-col.left-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .app-container {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 20px;
  }
  .brand-section {
    margin-bottom: 0;
  }
  .sidebar-nav {
    flex-direction: row;
    margin-top: 16px;
    gap: 8px;
  }
  .nav-item {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  .sidebar-footer {
    display: none;
  }
  .dashboard-col.left-col {
    grid-template-columns: 1fr;
  }
  .trials-grid-layout {
    grid-template-columns: 1fr;
  }
  .filters-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
    padding-bottom: 70px; /* Space for bottom navigation */
  }
  
  .app-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    width: 100%;
    background: rgba(9, 12, 21, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    border-bottom: none;
    padding: 0;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
  }
  
  .brand-section {
    display: none; /* Hide branding on bottom tabs */
  }
  
  .sidebar-nav {
    flex-direction: row;
    width: 100%;
    height: 100%;
    margin-top: 0;
    justify-content: space-around;
    align-items: center;
    gap: 0;
  }
  
  .nav-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 0;
    flex-grow: 1;
    height: 100%;
    border: none;
    background: transparent !important;
    border-radius: 0;
    color: var(--text-muted);
  }
  
  .nav-item i {
    width: 22px;
    height: 22px;
  }
  
  .nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
  }
  
  .nav-item.active {
    color: var(--color-cyan);
    box-shadow: none;
  }
  
  .main-content {
    padding: 12px;
    padding-bottom: 90px; /* Leave enough room for the bottom bar */
    width: 100%;
    overflow-x: hidden;
  }
  
  .search-bar {
    padding: 4px 4px 4px 12px;
    width: 100%;
  }
  
  .search-bar input {
    font-size: 0.9rem;
  }
  
  .search-btn {
    padding: 10px 14px;
    font-size: 0.8rem;
  }
  
  .search-btn span {
    display: none; /* Hide word "Analyze" to fit icons */
  }
  
  .search-btn i {
    margin: 0;
    width: 16px;
    height: 16px;
  }

  /* Welcome Screen Mobile Polish */
  .welcome-card {
    padding: 24px 16px;
    gap: 16px;
    border-radius: 20px;
    margin: 10px 0;
  }
  
  .welcome-card h2 {
    font-size: 1.5rem;
    line-height: 1.3;
    letter-spacing: 0.5px;
  }
  
  .welcome-card p {
    font-size: 0.85rem;
    line-height: 1.5;
  }
  
  .welcome-features {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 16px;
  }
  
  .feat-item {
    padding: 16px 12px;
    gap: 8px;
    border-radius: 12px;
    text-align: center;
  }
  
  .feat-item h4 {
    font-size: 0.9rem;
  }
  
  .feat-item p {
    font-size: 0.75rem;
  }
  
  .quick-tags {
    padding-left: 0;
    overflow-x: auto;
    white-space: nowrap;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  
  .quick-tag {
    padding: 5px 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }
  
  .custom-timeline {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px;
  }
  
  .timeline-steps {
    justify-content: flex-start;
    gap: 20px;
    width: max-content;
  }
  
  .timeline-step {
    width: 85px;
    flex-shrink: 0;
  }
  
  .timeline-track {
    display: none; /* Hide progress line in side-scroll mode */
  }
  
  /* Enforce single column grid layouts everywhere on phone screen sizes */
  .dashboard-grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 16px !important;
  }
  
  .dashboard-col {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 16px !important;
  }
  
  .dashboard-col.left-col {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .card-panel {
    padding: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 18px !important;
  }
  
  .panel-header {
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: center !important;
  }
  
  /* Stack chemical properties list vertically so they never clip or scroll horizontally */
  .molecule-info-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }
  
  .tag-synonym {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  
  /* Trials List Panel Responsiveness */
  .trials-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
  }
  
  .trial-card {
    width: 100% !important;
    min-width: 0 !important;
    padding: 16px !important;
  }
  
  .card-top, .card-bottom {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  
  .trials-pagination-footer {
    flex-wrap: wrap !important;
    gap: 12px !important;
    justify-content: center !important;
  }
  
  /* Mobile-first Details Modal Scaling */
  .modal-content {
    width: 95% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin: 10px auto !important;
    max-height: 90vh;
    border-radius: 20px;
  }
  
  .modal-meta-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  
  .criteria-text {
    font-size: 0.8rem !important;
  }
}

/* ==========================================================================
   REGISTRIES COMPONENT
   ========================================================================== */

.registries-section {
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

.registries-card {
  padding: 30px;
}

.registries-body {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.registries-intro {
  font-size: 1rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.registries-table-container {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(5, 7, 15, 0.4);
}

.registries-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.registries-table th,
.registries-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.registries-table th {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-normal);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.registries-table tbody tr:last-child td {
  border-bottom: none;
}

.registries-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.registries-table td strong {
  color: var(--color-teal);
}

.registries-footer-note {
  margin-top: 5px;
}

.alert-box-compliance {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0, 235, 212, 0.05);
  border: 1px solid rgba(0, 235, 212, 0.15);
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-box-compliance i {
  flex-shrink: 0;
  margin-top: 2px;
}

@media (max-width: 768px) {
  .registries-card {
    padding: 20px;
  }
  .registries-table th,
  .registries-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}
