/* Dashboard-specific styles */

/* Dashboard page body adjustments */
body.dashboard-page { 
  padding: 0; 
  margin: 0;
}

/* Header adjustments for dashboard page */
body.dashboard-page header {
  position: fixed;
  width: 100%;
  left: 0;
  top: 0;
  z-index: 20;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
}

/* Dashboard container layout */
.dashboard-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
  padding-top: 25px;
}

.full-height-sidebar {
  background: rgba(255,255,255,0.02);
  border-right: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
}

.sidebar-content {
  position: sticky;
  top: 24px;
}

.main-content-area {
  overflow-y: auto;
  padding-top: 10px; /* Account for fixed header height */
}

/* Dashboard cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* KPI cards */
.card.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: space-between;
}

.kpi {
  margin-bottom: 16px;
  padding: 16px;
}

.kpi-label { 
  color: var(--muted); 
  font-size: 10px; 
  letter-spacing: 0.08em; 
  text-transform: uppercase; 
  margin: 0;
}

.kpi-label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-value { 
  font-size: clamp(16px, 2vw, 18px); 
  font-weight: 700; 
  margin: 0;
  line-height: 1.1;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--third);
  margin-bottom: 4px;
}

.kpi-meta { 
  color: var(--muted); 
  font-size: 11px; 
  margin: 0;
  line-height: 1.2;
}

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

/* Project cards */
.project-card {
  margin-bottom: 16px;
  padding: 20px;
  cursor: pointer;
  transition: transform .4s ease, opacity .4s ease, background-color .3s ease, box-shadow .3s ease;
  position: relative;
  z-index: 1;
}

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

.project-card .row { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  gap: 10px; 
  margin-bottom: 8px;
}

.project-card .name { 
  font-weight: 700; 
  font-size: 16px;
}

.project-card .name a {
  color: var(--third);
  text-decoration: none;
}

.project-card .name a:hover {
  text-decoration: underline;
}

/* Chip styling */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: var(--muted);
}

.chip {
  background: rgba(114,203,255,0.12);
  color: var(--third);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.mono-small { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 
  font-size: 12px; 
  color: var(--muted); 
  margin-bottom: 2px;
}

/* Project controls */
.project-controls {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.project-controls {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.control-group select {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.control-group select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: inherit;
}

.control-group select:hover {
  border-color: var(--third);
}

.control-group select:focus {
  outline: none;
  border-color: var(--third);
  box-shadow: 0 0 0 2px rgba(114,203,255,0.2);
}

/* Loading and error states */
.loading, .error {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.error {
  color: #ff6b6b;
}

/* Refresh button */
.refresh-btn {
  background: var(--third);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.refresh-btn:hover {
  opacity: 0.8;
}

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

/* Modal overlay for expanded project cards */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Expanded project card in modal */
.project-card.modal-expanded {
  position: relative;
  z-index: 1001;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.06) inset;
  transform: scale(1.02);
  margin: 0;
}

/* Enhanced stats formatting */
.project-details-expanded {
  margin-top: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-item {
  background: rgba(255,255,255,0.05);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-weight: 600;
  font-size: 16px;
  color: var(--primary);
}

.project-summary,
.project-details {
  transition: opacity .2s ease;
}

.expand-hint,
.collapse-hint {
  opacity: 0.7;
  transition: opacity .2s ease;
}

.project-card:hover .expand-hint {
  opacity: 1;
}

.close-hint {
  text-align: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

/* Ensure cards grid doesn't interfere with modal */
.cards-grid.modal-active .project-card:not(.modal-expanded) {
  opacity: 0.3;
  pointer-events: none;
}

/* Reduce spacing between dashboard hero and projects section */
body.dashboard-page .hero.dashboard-hero {
  padding-top: 12px !important;
  padding-bottom: 4px;
}

body.dashboard-page section:not(.hero) {
  padding-top: 4px;
}

.projects-column { 
  min-width: 0; 
}

/* Responsive styles */
@media (max-width: 800px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  
  .full-height-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .project-controls {
    flex-direction: column;
    gap: 16px;
  }
}

/* Responsive behavior for mobile */
@media (max-width: 1000px) {
  body.dashboard-page header {
    position: sticky;
    width: auto;
  }
  
  .dashboard-container {
    flex-direction: column;
    min-height: auto;
    margin-top: 0;
  }
  
  .full-height-sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    max-height: none;
    top: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .main-content-area {
    min-height: auto;
    padding-top: 64px;
  }
}

/* Medium screen adjustments */
@media (max-width: 1200px) and (min-width: 1001px) {
  .full-height-sidebar {
    width: 220px;
  }
}