/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * Contains styles that cannot be easily converted to Tailwind @apply:
 * - Font configuration
 * - Leaflet map styling
 * - Brand logo
 * - Mobile touch targets
 * - Clinical trial specific components
 */

/* ============================================
   Font Configuration
   ============================================ */

body {
  font-family: 'Nunito', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
}

.font-serif {
  font-family: 'STIX Two Text', ui-serif, Georgia, serif;
}

/* ============================================
   Leaflet Map Custom Styling
   ============================================ */

.leaflet-container {
  font-family: 'Nunito', ui-sans-serif, system-ui, sans-serif;
}

.custom-marker {
  background: transparent !important;
  border: none !important;
}

/* Cluster markers - match app indigo theme */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(99, 102, 241, 0.3) !important;
  border: 2px solid #6366f1 !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: #6366f1 !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  width: 30px !important;
  height: 30px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  padding: 4px !important;
}

.leaflet-popup-content {
  margin: 12px !important;
  line-height: 1.5 !important;
}

.leaflet-popup-tip {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom a {
  color: #6b7280 !important;
  border-color: #d1d5db !important;
}

.leaflet-control-zoom a:hover {
  color: #6366f1 !important;
  border-color: #6366f1 !important;
}

.leaflet-control-container {
  z-index: 400 !important;
}

.leaflet-control-zoom,
.leaflet-control-attribution,
.map-legend {
  z-index: 400 !important;
}

/* ============================================
   Brand Logo
   ============================================ */

svg {
  overflow: visible;
}

.logo-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.brand {
  font-family: 'Momo Trust Display', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  line-height: 1;
  font-size: 1.5em;
  letter-spacing: 0.2px;
  user-select: none;
  padding-bottom: 2px;
}

.brand .main { color: #4D3FE5; }
.brand .dot  { color: #CFE53F; }
.brand .tld  { color: #D53FE5; }

.favicon {
  width: 32px;
  height: 32px;
}

/* ============================================
   Mobile Touch Targets & Safe Areas
   ============================================ */

@media (max-width: 767px) {
  .button-base,
  .button-primary,
  .button-primary-small {
    min-height: 44px;
    min-width: 44px;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  select {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-drawer-content {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ============================================
   Clinical Trial Specific Components
   ============================================ */

/* Criteria lists */
.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.criteria-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.criteria-item:last-child {
  border-bottom: none;
}

.criteria-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.criteria-number-include {
  background: #dcfce7;
  color: #16a34a;
}

.criteria-number-exclude {
  background: #fee2e2;
  color: #dc2626;
}

.criteria-text {
  flex: 1;
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
}

/* Outcome cards */
.outcome-card {
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 4px solid #6366f1;
  margin-bottom: 16px;
}

.outcome-card:last-child {
  margin-bottom: 0;
}

.outcome-card-secondary {
  border-left-color: #94a3b8;
}

.outcome-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 8px;
}

.outcome-card-description {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 8px;
}

.outcome-card-timeframe {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Location cards */
.location-card {
  padding: 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.location-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.location-card-facility {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
}

.location-card-address {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 8px;
}

.location-card-contact {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

/* Study arm cards */
.arm-card {
  padding: 20px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.arm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.arm-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.arm-card-description {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}

/* Timeline */
.timeline {
  border-left: 2px solid #e2e8f0;
  padding-left: 20px;
  margin-left: 6px;
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6366f1;
  border: 2px solid white;
}

.timeline-dot-pending {
  background: #e2e8f0;
}

.timeline-dot-completed {
  background: #16a34a;
}

.timeline-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 2px;
}

.timeline-date {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

.timeline-type {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* NCT ID badge */
.nct-badge {
  padding: 6px 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  font-family: 'Space Mono', ui-monospace, monospace;
}

/* Intervention card */
.intervention-card {
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 3px solid #6366f1;
}

.intervention-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.intervention-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.intervention-card-description {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

/* Study design info row */
.design-info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
}

.design-info-row:last-child {
  margin-bottom: 0;
}

.design-info-label {
  font-size: 13px;
  color: #64748b;
}

.design-info-value {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  text-align: right;
  max-width: 200px;
}

/* Locations summary card */
.locations-summary {
  padding: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 12px;
  color: white;
  text-align: center;
  margin-bottom: 16px;
}

.locations-summary-count {
  font-size: 32px;
  font-weight: 700;
  font-family: 'Space Mono', ui-monospace, monospace;
}

.locations-summary-label {
  font-size: 13px;
  opacity: 0.9;
}

/* Content card */
.content-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  margin-bottom: 24px;
}

.content-card:last-child {
  margin-bottom: 0;
}

.content-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-card-body {
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}

/* Summary row */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  margin-bottom: 24px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 15px;
  font-weight: 500;
  color: #0f172a;
}

/* Sidebar card (trial detail) */
.sidebar-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
  margin-bottom: 20px;
}

.sidebar-card:last-child {
  margin-bottom: 0;
}

.sidebar-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grid layouts for clinical trials */
.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

@media (max-width: 767px) {
  .locations-grid {
    grid-template-columns: 1fr;
  }
}

.interventions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.arms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Results section */
.results-section {
  margin-bottom: 32px;
}

.results-section:last-child {
  margin-bottom: 0;
}

.results-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
}

/* Country group header */
.country-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.country-group-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

/* Trial hero section */
.trial-hero {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 40px;
}

@media (max-width: 767px) {
  .trial-hero {
    padding: 20px 16px;
  }
}

.trial-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
}

@media (max-width: 767px) {
  .trial-hero-top {
    flex-direction: column;
    gap: 16px;
  }
}

.trial-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.trial-hero-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  margin-bottom: 16px;
}

@media (max-width: 767px) {
  .trial-hero-title {
    font-size: 20px;
  }
}

.trial-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #64748b;
  font-size: 14px;
}

.trial-hero-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trial-hero-conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}

.breadcrumb-link {
  color: #6366f1;
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #cbd5e1;
}

/* Date grid */
.date-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1023px) {
  .date-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .date-grid {
    grid-template-columns: 1fr;
  }
}

.date-card {
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.date-card-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.date-card-value {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.date-card-type {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 767px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.04);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
}

/* News grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 767px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* Trials grid */
.trials-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ============================================
   Back Button (embedded in headers)
   ============================================ */

/* Back link in company header */
.company-back {
  margin-bottom: 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: #6366f1;
}

.back-link-icon {
  width: 14px;
  height: 14px;
}

/* Back button in trial breadcrumb */
.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.breadcrumb-back:hover {
  color: #6366f1;
}

.breadcrumb-back-icon {
  width: 12px;
  height: 12px;
}
