/* ================================================== */
/* DASHBOARD DESIGN SYSTEM */
/* Matches main site aesthetic but tuned for app UI */
/* ================================================== */

:root {
  --bg: #050608;
  --bg-elevated: #0d0f13;
  --bg-card: #11141a;
  --bg-sidebar: #0b0d11;

  --border-subtle: #1b1f27;
  --border-strong: #262b36;

  --text: #f5f5f7;
  --text-muted: #a3a8b5;
  --text-soft: #7b8190;

  --accent: #ff7a00;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --space-xl: 3rem;

  --font-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
}

/* ================================================== */
/* LAYOUT WRAPPER */
/* ================================================== */

.dashboard-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ================================================== */
/* SIDEBAR */
/* ================================================== */

.dashboard-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sidebar-logo a {
  color: var(--text);
  text-decoration: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-nav a {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.18s ease, color 0.18s ease;
}

.sidebar-nav a:hover {
  background: var(--border-subtle);
  color: var(--text);
}

.sidebar-nav a.active {
  background: var(--accent);
  color: #050608;
  font-weight: 600;
}

/* ================================================== */
/* MAIN AREA */
/* ================================================== */

.dashboard-main {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ================================================== */
/* TOP HEADER */
/* ================================================== */

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.dashboard-header input {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
}

/* ================================================== */
/* METRICS GRID */
/* ================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-md);
}

.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric-label {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.metric-change {
  font-size: 0.9rem;
  font-weight: 600;
}

.metric-change.up {
  color: #4cd964;
}

.metric-change.down {
  color: #ff453a;
}

/* ================================================== */
/* CHARTS */
/* ================================================== */

.charts-grid-single {
  display: grid;
  grid-template-columns: 1fr;
}

/* ================================================== */
/* CHARTS — FULLY RESPONSIVE */
/* ================================================== */

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-lg);

  position: relative;
  height: auto; /* Let content define height */
  max-height: 350px; /* Ensures charts have space */
  display: flex;
  flex-direction: column;
}

.chart-title {
  margin-bottom: var(--space-md);
  font-size: 1.2rem;
  font-weight: 600;
}

/* Canvas must NOT have fixed height */
.chart-card canvas {
  width: 100% !important;
  height: auto !important;
  flex: 1; /* Fill remaining space */
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .chart-card {
    min-height: 260px;
    padding: var(--space-md);
  }
}


/* ================================================== */
/* TABLE */
/* ================================================== */

.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: var(--space-lg);
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-sm);
}

.table-card th,
.table-card td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.95rem;
}

.table-card th {
  color: var(--text-muted);
  font-weight: 600;
}

.table-card tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ================================================== */
/* RESPONSIVE */
/* ================================================== */

@media (max-width: 900px) {
  .dashboard-wrapper {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}
