/* ========================================================
   CHDxAI - HIGH DENSITY MEDICAL SYSTEMS STYLING
   Extracts colors, gradients, compact spacing, borders,
   shadows, backgrounds, and layout patterns from the
   High Density theme specification.
   ======================================================== */

:root {
  --primary-gradient: linear-gradient(90deg, #0D1B6B 0%, #255BFF 50%, #914EFF 100%);
  --bg-light: #F8FAFC;
  --card-bg: #FFFFFF;
  --border-color: #E2E8F0;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  
  /* Diagnoses Badge Colors */
  --normal: #10B981;
  --asd: #F59E0B;
  --vsd: #EC4899;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Base Adjustments */
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
}

/* Header Styling */
header {
  background: var(--primary-gradient) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  z-index: 50;
}

/* High Density Compact Layout */
.main-container {
  display: flex;
  flex: 1;
  padding: 16px;
  gap: 16px;
  max-width: 100% !important;
}

/* Standard high density cards */
.card-dense {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 16px; /* High Density: Compact padding */
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.card-dense:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
}

/* Sidebar structure */
.sidebar-dense {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Center Content */
.center-dense {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Upload Grid */
.upload-grid-dense {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Compact Upload Card styling */
.upload-card-dense {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.upload-card-dense:hover {
  transform: translateY(-3px);
  border-color: #255BFF;
  box-shadow: var(--shadow);
}

/* Dragover Highlight */
.dragover {
  border-color: #255BFF !important;
  background-color: rgba(37, 91, 255, 0.05) !important;
  box-shadow: 0 0 0 4px rgba(37, 91, 255, 0.15) !important;
}

/* High Density mini-buttons */
.btn-upload-dense {
  border: 2px dashed var(--border-color);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-upload-dense:hover {
  border-color: #255BFF;
  color: #255BFF;
  background: #F1F5FF;
}

/* Bottom Actions Panel */
.action-bar-dense {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.btn-main-dense {
  flex: 2;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(37, 91, 255, 0.3);
  transition: all 0.2s ease;
}

.btn-main-dense:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 91, 255, 0.4);
}

.btn-reset-dense {
  flex: 1;
  padding: 12px;
  border: 1px solid #255BFF;
  border-radius: 12px;
  background: white;
  color: #255BFF;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-dense:hover {
  background: #F1F5FF;
  transform: translateY(-2px);
}

/* Right Panel Styles */
.right-panel-dense {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* High Density Result card with gradient */
.result-card-dense {
  background: var(--primary-gradient) !important;
  color: white !important;
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(13, 27, 107, 0.25);
}

.heart-bg-dense {
  position: absolute;
  right: -20px;
  top: -20px;
  opacity: 0.12;
  width: 120px;
  pointer-events: none;
}

/* Compact Diagnosis Badges */
.badge-dense {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  text-transform: uppercase;
  margin-top: 8px;
  border: 1px solid transparent;
}

.badge-dense-vsd { background: white !important; color: var(--vsd) !important; }
.badge-dense-asd { background: white !important; color: var(--asd) !important; }
.badge-dense-normal { background: white !important; color: var(--normal) !important; }

/* Circular Progress and Confidence */
.confidence-box-dense {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.circular-progress-dense {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: conic-gradient(white 92%, rgba(255,255,255,0.2) 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.circular-progress-dense::after {
  content: '92%';
  width: 42px;
  height: 42px;
  background: #255BFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

/* Video tabs styling from High Density Spec */
.video-tabs-dense {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.tab-dense {
  flex: 1;
  padding: 6px 4px;
  background: var(--border-color);
  border-radius: 6px;
  font-size: 10px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  border: none;
}

.tab-dense.active {
  background: #255BFF !important;
  color: white !important;
  box-shadow: 0 2px 5px rgba(37, 91, 255, 0.2);
}

.video-container-dense {
  background: black;
  border-radius: 12px;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  position: relative;
  overflow: hidden;
}

/* Custom Scrollbars */
.scrollbar-thin::-webkit-scrollbar {
  height: 4px;
}
.scrollbar-thin::-webkit-scrollbar-track {
  background: #F1F5F9;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

/* Responsive grid layouts */
@media (min-width: 1024px) {
  #chdForm {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    gap: 16px;
    align-items: stretch;
  }
}

@media (max-width: 1023px) and (min-width: 768px) {
  #chdForm {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .sidebar-dense, .right-panel-dense {
    grid-column: span 1;
  }
  .center-dense {
    grid-column: span 2;
  }
}

@media (max-width: 767px) {
  #chdForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Pipeline Step status classes */
.step-active {
  color: #255BFF !important;
}

.step-active .step-icon {
  background: #255BFF !important;
  color: white !important;
  border-color: #255BFF !important;
  box-shadow: 0 0 10px rgba(37, 91, 255, 0.4) !important;
}

.step-success {
  color: #059669 !important;
}

.step-success .step-icon {
  background: #10B981 !important;
  color: white !important;
  border-color: #10B981 !important;
}
