:root {
  --primary: #64748B;
  --primary-hover: #475569;
  --secondary: #94A3B8;
  --accent: #F59E0B;
  --accent-hover: #D97706;
  --bg: #0F1117;
  --surface: #1E222D;
  --surface-hover: #2A2F3D;
  --border: #2A2F3D;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --danger: #EF4444;
  --success: #10B981;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 200ms ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  padding-left: 0.5rem;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 3rem;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

.view-header {
  margin-bottom: 2rem;
}

.view-header h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.view-header p {
  color: var(--text-muted);
}

.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(255, 255, 255, 0.1);
}

/* Forms */
.input-light {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
}

.input-light:focus {
  outline: none;
  border-color: var(--primary);
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.stat-icon {
  font-size: 2rem;
  background: rgba(100, 116, 139, 0.1);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.chart-card h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Workout Builder */
.workout-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.exercise-selector {
  display: flex;
  gap: 1rem;
}

.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.exercise-header h3 {
  font-size: 1.25rem;
  color: var(--accent);
}

.sets-table {
  width: 100%;
  border-collapse: collapse;
}

.sets-table th, .sets-table td {
  padding: 0.5rem;
  text-align: center;
}

.sets-table th {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.set-input {
  width: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem;
  border-radius: 4px;
  text-align: center;
}

.set-input:focus {
  outline: none;
  border-color: var(--accent);
}

.add-set-row {
  margin-top: 1rem;
  text-align: center;
}

.timer-display {
  font-family: monospace;
  font-size: 1.25rem;
  color: var(--accent);
  margin-top: 0.5rem;
  display: block;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.history-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: flex;
  gap: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Settings */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 300px;
}

.mt-4 {
  margin-top: 1rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-hover);
  color: var(--text);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
  font-weight: 500;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    padding: 1rem;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .logo { margin-bottom: 0; margin-right: auto; }
  .nav { flex-direction: row; }
  .nav-item { padding: 0.5rem; }
  .nav-item svg { margin: 0; }
  .nav-item span { display: none; }
  .main-content { padding: 1rem; }
  .flex-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .charts-grid { grid-template-columns: 1fr; }
}
