/* ===== 2050 Modern Dashboard CSS ===== */
:root {
  /* Color System */
  --primary-bg: #f6f8fa;
  --primary-border: #e1e4e8;
  --text-dark: #24292e;
  --text-medium: #586069;
  --text-light: #6a737d;
  --button-bg: #f3f4f6;
  --button-border: #d1d5db;
  --button-hover: #e5e7eb;
  --accent-color: #4e79a7;
  --border-radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-base: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Roboto Mono', monospace;
}

/* ===== Base Structure ===== */
.dashboard-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  font-family: var(--font-base);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 2rem;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.dashboard-header {
  margin-bottom: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--primary-border);
  text-align: center;
}

.dashboard-header h1 {
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.dashboard-header h2 {
  color: var(--text-medium);
  font-weight: 400;
  font-size: 1.5rem;
  margin-top: 0;
  line-height: 1.4;
}

.dashboard-header h3 {
  color: var(--text-light);
  font-weight: 300;
  font-size: 1.1rem;
  max-width: 800px;
  margin: 1rem auto 0;
}

/* ===== Controls Section ===== */
.dashboard-controls {
  background-color: var(--primary-bg);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.control-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-panel button {
  background-color: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  justify-content: center;
}

.control-panel button:hover {
  background-color: var(--button-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.control-panel button:active {
  transform: translateY(0);
}

#fullscreenBtn {
  background-color: var(--accent-color);
  color: white;
  border: none;
}

.speed-indicator {
  margin-left: auto;
  font-size: 1rem;
  color: var(--text-light);
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.03);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}

/* ===== Chart Grid System ===== */
.dashboard-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 1.5rem;
  position: relative;
}

.chart-container {
  position: relative;
  cursor: pointer;
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--primary-border);
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.chart-container:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.chart-container:active {
  transform: scale(0.98);
}

/* Fullscreen indicator (hidden by default) */
.chart-container::after {
  content: "⛶ Click to view fullscreen";
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: var(--border-radius);
  font-size: 0.8rem;
  opacity: 0;
  transition: var(--transition);
}

/* Show indicator on hover */
.chart-container:hover::after {
  opacity: 1;
}

/* Fullscreen state styles */
.chart-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  background: white;
  padding: 2rem;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  cursor: default;
}

/* Exit fullscreen button (only visible in fullscreen mode) */
.chart-container.fullscreen::before {
  content: "✕ Exit fullscreen";
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 10;
}

.chart-container.fullscreen::before:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Hide the hover indicator in fullscreen */
.chart-container.fullscreen::after {
  display: none;
}

.chart-title {
  margin: 0 0 1.5rem 0;
  color: var(--text-dark);
  font-size: 1.25rem;
  font-weight: 600;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--primary-border);
}

.chart-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

/* Loop Charts */
.loop-chart-container {
  grid-column: span 1;
  min-height: 450px;
}

.loop-chart-container .chart-wrapper {
  background: #f9f9f9;
  border-radius: calc(var(--border-radius) - 2px);
}

/* Fullscreen System */
.chart-container[data-fullscreen="true"] {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999;
  background: white;
  padding: 2rem;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.fullscreen-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: var(--transition);
}

.fullscreen-toggle:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

/* ===== Data Table ===== */
.data-table-container {
  grid-column: 1 / -1;
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid var(--primary-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table-container h3 {
  margin: 0;
  padding: 1.5rem;
  color: var(--text-dark);
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--primary-bg);
  border-bottom: 1px solid var(--primary-border);
}

.table-scroll-container {
  max-height: 500px;
  overflow-y: auto;
}

#dataTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
}

#dataTable thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#dataTable th {
  background: var(--primary-bg);
  color: var(--text-dark);
  font-weight: 600;
  padding: 1rem;
  text-align: left;
  border-bottom: 2px solid var(--primary-border);
  position: sticky;
  top: 0;
}

#dataTable td {
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

#dataTable tr:hover td {
  background: #f8f9fa;
}

#dataTable tr.current-row td {
  background: rgba(78, 121, 167, 0.1);
  position: relative;
}

#dataTable tr.current-row td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-color);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .dashboard-content {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 1.5rem;
  }
  
  .dashboard-content {
    grid-template-columns: 1fr;
  }
  
  .control-panel {
    gap: 0.75rem;
  }
  
  .control-panel button {
    min-width: auto;
    padding: 0.75rem 1rem;
    flex: 1;
  }
  
  .speed-indicator {
    margin: 0.5rem 0 0;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .dashboard-header h1 {
    font-size: 1.75rem;
  }
  
  .dashboard-header h2 {
    font-size: 1.25rem;
  }
  
  #dataTable th,
  #dataTable td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }
}

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

.chart-container {
  animation: fadeIn 0.4s ease-out;
}

@keyframes highlightRow {
  0% { background-color: rgba(78, 121, 167, 0.05); }
  50% { background-color: rgba(78, 121, 167, 0.2); }
  100% { background-color: rgba(78, 121, 167, 0.05); }
}

.current-row {
  animation: highlightRow 1.5s ease 2;
}

/* ===== Print Styles ===== */
@media print {
  .dashboard-container {
    box-shadow: none;
    padding: 0;
  }
  
  .dashboard-controls,
  .fullscreen-toggle {
    display: none;
  }
  
  .dashboard-content {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .chart-container {
    page-break-inside: avoid;
    height: 500px !important;
    box-shadow: none;
    border: 1px solid #ddd !important;
  }
  
  .data-table-container {
    max-height: none;
    overflow: visible;
    page-break-before: always;
  }
}
