/* Main styles for Sleep Research Funding Dashboard */

:root {
  --primary-color: #2c5282;
  --secondary-color: #4299e1;
  --accent-color: #ed8936;
  --success-color: #48bb78;
  --light-bg: #f7fafc;
  --sidebar-width: 280px;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
  background-color: var(--light-bg);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: white;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  overflow-y: auto;
  z-index: 1000;
  padding: 1.5rem;
}

.sidebar-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
}

.sidebar-header h4 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.sidebar-header small {
  color: #718096;
}

.sidebar h5 {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.sidebar .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
}

.sidebar .form-select,
.sidebar .form-control {
  font-size: 0.9rem;
}

/* Main Content Styles */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 1.5rem 2rem;
  min-height: 100vh;
}

.kpi-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease;
  height: 100%;
}

.kpi-card:hover {
  transform: translateY(-2px);
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
}

.kpi-label {
  font-size: 0.8rem;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card.subset {
  border-left: 4px solid var(--accent-color);
}

.kpi-card.subset .kpi-value {
  color: var(--accent-color);
}

.kpi-card.total {
  border-left: 4px solid var(--secondary-color);
}

.kpi-card.percentage {
  border-left: 4px solid var(--success-color);
}

.kpi-card.percentage .kpi-value {
  color: var(--success-color);
}

.kpi-reference {
  display: block;
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

.chart-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 1.5rem;
}

.chart-card h5 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-weight: 600;
}

.table-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.table-card h5 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-weight: 600;
}

.badge-subset {
  background-color: var(--accent-color);
  color: white;
}

.badge-not-subset {
  background-color: #a0aec0;
  color: white;
}

.btn-chart-type {
  margin-right: 0.5rem;
}

.btn-chart-type.active {
  background-color: var(--primary-color);
  color: white;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary-color);
}

.stats-table th {
  background-color: var(--light-bg);
  font-weight: 600;
}

.summary-preview {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-body pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}

footer {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
  margin-top: 2rem;
}

footer a {
  color: #bee3f8;
}

.chart-container {
  position: relative;
  height: 300px;
}

/* Keyword Chip Styles */
.keyword-chip {
  background-color: var(--secondary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.keyword-chip:hover {
  background-color: var(--primary-color);
  transform: translateY(-1px);
}

.keyword-chip-remove {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.8;
}

.keyword-chip-remove:hover {
  opacity: 1;
}

.keyword-management-card {
  margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }
  .main-content {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .kpi-value {
    font-size: 1.25rem;
  }
}