/* =========================================================
   PhillyBestOS — Dashboard Stylesheet
   Extends theme.css variables. Does NOT override landing styles.
   ========================================================= */

/* ----- Layout ------------------------------------------ */
.dash-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
}

/* ----- Sidebar ----------------------------------------- */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-subtle);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--card-border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-icon {
  font-size: 1.3rem;
  color: var(--accent-light);
}

.brand-name { color: var(--fg); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 0;
  flex: 1;
}

.sidebar-footer {
  padding: 0 12px 16px;
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.nav-item:hover { background: var(--card-bg); color: var(--fg); }
.nav-item.active { background: var(--card-bg); color: var(--fg); border: 1px solid var(--card-border); }
.nav-icon { font-size: 1rem; }

/* ----- Main -------------------------------------------- */
.dash-main {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
  max-width: 1100px;
}

/* ----- Tab sections ------------------------------------ */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ----- Header ------------------------------------------ */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.dash-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.dash-subtitle {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* ----- Stat cards -------------------------------------- */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
  flex: 1;
  transition: border-color 0.2s ease;
}

.stat-card:hover { border-color: var(--accent); }
.stat-accent { border-color: var(--accent) !important; }

.stat-card-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-display);
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* ----- Chart ------------------------------------------- */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.chart-header {
  margin-bottom: 16px;
}

.chart-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ----- Search ------------------------------------------ */
.search-bar { margin-bottom: 16px; }

.search-input {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--fg-muted); }

/* ----- Table ------------------------------------------- */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  padding: 13px 18px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(34, 34, 48, 0.6);
  vertical-align: top;
  color: var(--fg);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

.td-muted { color: var(--fg-muted); font-size: 0.85rem; }
.td-note { color: var(--fg-muted); font-size: 0.82rem; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.empty-row td {
  text-align: center;
  padding: 40px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ----- Buttons ----------------------------------------- */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.btn-icon:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.btn-icon.danger:hover { color: #e07a5f; }

.btn-row { display: flex; gap: 4px; justify-content: flex-end; }

/* ----- Modal ------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}
.modal-close:hover { color: var(--fg); }

/* ----- Forms ------------------------------------------- */
.form-group { margin-bottom: 18px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.req { color: var(--accent-light); }

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--fg-muted); opacity: 0.6; }

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ----- Amount styling ---------------------------------- */
.amount-positive {
  font-family: var(--font-display);
  font-weight: 600;
  color: #6ee7b7;
}

/* ----- Responsive -------------------------------------- */
@media (max-width: 768px) {
  .dash-body { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 8px; }
  .sidebar-brand { padding: 8px 12px; border-bottom: none; }
  .sidebar-nav { flex-direction: row; padding: 0; flex: none; }
  .sidebar-footer { border-top: none; padding: 0; }
  .dash-main { padding: 20px 16px; }
  .stats-row { gap: 10px; }
  .stat-card { min-width: 0; padding: 16px 18px; }
  .stat-card-value { font-size: 1.4rem; }
  .form-row { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; align-items: flex-start; }
}
