:root {
  --accent: #0066ff;
  --accent-hover: #0052cc;
  --muted: #666;
  --bg: #f4f6f8;
  --panel: #fff;
  --text: #222;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 80px;
  --sidebar-bg: #1a1f2b;
  --sidebar-active: #151a24;
  --sidebar-text: #fff;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-muted: #94a3b8;
  --icon-color: #94a3b8;
  --icon-active: #fff;
  --border-subtle: rgba(255,255,255,0.06);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.16);
  --gradient-sidebar: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 100%);
  --gradient-brand: linear-gradient(90deg, #fff, rgba(255,255,255,0.9));
}

/* Base styles */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: Segoe UI, Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px 12px calc(16px + var(--sidebar-width));
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 60;
  transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  margin-right: auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 12px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 40;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-muted) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--sidebar-muted);
  border-radius: 4px;
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  margin-bottom: 36px;
  height: 40px;
  background: var(--gradient-sidebar);
  border-radius: 12px;
}

.sidebar-brand i {
  font-size: 24px;
  color: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(0,102,255,0.2));
}

.sidebar-brand span {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  flex: 1;
}

/* Sidebar Navigation */
.sidebar-nav {
  margin: 0;
  padding: 0 8px;
  list-style: none;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  margin-bottom: 6px;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-sidebar);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-link:hover::before {
  opacity: 1;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sidebar-link.active {
  background: var(--sidebar-active);
  box-shadow: var(--shadow-md);
}

.sidebar-link.active::before {
  opacity: 1;
  background: linear-gradient(90deg, var(--accent), rgba(0,102,255,0.8));
}

.sidebar-link.active i,
.sidebar-link.active span {
  color: var(--icon-active);
}

.sidebar-link i {
  color: var(--icon-color);
  margin-right: 14px;
  font-size: 20px;
  width: 24px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}

.sidebar-link span {
  font-size: 15px;
  font-weight: 500;
  position: relative;
  transition: all 0.3s ease;
}

/* Logout Button */
.sidebar-logout {
  padding: 0 8px;
  margin: 16px 0;
}

.logout-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.logout-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,75,75,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.logout-button:hover::before {
  opacity: 1;
}

.logout-button:hover {
  background: var(--sidebar-active);
  color: #ff4b4b;
  border-color: rgba(255,75,75,0.3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.logout-button i {
  margin-right: 14px;
  font-size: 20px;
  width: 24px;
  text-align: center;
  color: #ff4b4b;
  position: relative;
  filter: drop-shadow(0 2px 4px rgba(255,75,75,0.2));
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 20px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sidebar-active);
  margin: 24px -12px 0;
}

.footer-copyright {
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 500;
}

/* Collapsed State */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding: 24px 8px;
}

body.sidebar-collapsed .sidebar .sidebar-brand span,
body.sidebar-collapsed .sidebar .sidebar-link span,
body.sidebar-collapsed .sidebar .logout-button span,
body.sidebar-collapsed .sidebar .sidebar-footer {
  opacity: 0;
  visibility: hidden;
  width: 0;
  transform: translateX(10px);
}

body.sidebar-collapsed .sidebar .sidebar-brand {
  justify-content: center;
  margin-bottom: 32px;
}

body.sidebar-collapsed .sidebar .sidebar-link {
  padding: 14px;
  justify-content: center;
}

body.sidebar-collapsed .sidebar .sidebar-link i {
  margin: 0;
  font-size: 22px;
}

body.sidebar-collapsed .sidebar .logout-button {
  padding: 14px;
  justify-content: center;
}

body.sidebar-collapsed .sidebar .logout-button i {
  margin: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* allow content to shrink inside flex containers and prevent overflow */
  min-width: 0;
}

body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .site-header {
  padding-left: calc(16px + var(--sidebar-collapsed-width));
}

/* Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 30;
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

/* Navigation Toggle */
.nav-toggle {
  background: transparent;
  border: 0;
  font-size: 20px;
  color: inherit;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: 0.2s ease;
}

.nav-toggle:hover {
  background: rgba(0,0,0,0.05);
}

/* Mobile Styles */
@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    padding: 16px;
  }

  .site-header {
    padding-left: 16px !important;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-collapsed .sidebar .sidebar-brand span,
  body.sidebar-collapsed .sidebar .sidebar-link span,
  body.sidebar-collapsed .sidebar .logout-button span,
  body.sidebar-collapsed .sidebar .sidebar-footer {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    transform: none !important;
  }

  body.sidebar-collapsed .sidebar .sidebar-link,
  body.sidebar-collapsed .sidebar .logout-button {
    padding: 14px 16px !important;
    justify-content: flex-start !important;
  }

  body.sidebar-collapsed .sidebar .sidebar-link i,
  body.sidebar-collapsed .sidebar .logout-button i {
    margin-right: 14px !important;
    width: 24px !important;
  }
}

/* Dashboard Styles */
.dashboard-welcome {
  padding: 40px 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 16px;
  margin-bottom: 48px;
  color: white;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.welcome-header {
  text-align: center;
}

.welcome-header h2 {
  font-size: 32px;
  margin: 0 0 8px;
}

.welcome-subtitle {
  font-size: 18px;
  opacity: 0.9;
  margin: 0;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

/* Ensure separation between welcome banner and stats grid */
.dashboard-welcome + .grid-4 {
  margin-top: 8px;
}

.stat-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.stat-content h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.stat-big {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1;
}

.stat-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 2fr 1fr;
    grid-auto-rows: auto;
    grid-template-areas:
      "upcoming progress"
      "activity trainer";
    align-items: start;
  }
  .dashboard-card { height: 100%; }
  .upcoming-classes { grid-area: upcoming; }
  .progress-section { grid-area: progress; }
  .activity-feed { grid-area: activity; }
  .personal-trainer { grid-area: trainer; }
}

.dashboard-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h3 i {
  color: var(--accent);
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.list-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
}

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

.class-info strong {
  font-size: 15px;
  margin-bottom: 4px;
}

.trainer-name {
  font-size: 13px;
  color: var(--muted);
}

.class-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-grid {
  display: grid;
  gap: 16px;
}

.progress-card {
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
}

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

.progress-header label {
  font-size: 14px;
  font-weight: 500;
}

.progress-header span {
  font-size: 13px;
  color: var(--muted);
}

.progress {
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.trainer-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.trainer-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
}

.trainer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trainer-info {
  flex: 1;
}

.trainer-info h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.trainer-info p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.trainer-stats {
  display: flex;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.next-session {
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
}

.next-session h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.next-session p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.activity-icon.completed {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.activity-icon.booked {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.activity-icon.achievement {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.activity-content {
  flex: 1;
}

.activity-content p {
  margin: 0 0 4px;
  font-size: 14px;
}

.activity-time {
  font-size: 13px;
  color: var(--muted);
}

/* Mobile Responsive Dashboard */
@media (max-width: 768px) {
   .dashboard-welcome {
    padding: 24px 16px;
    margin-bottom: 40px;
  }

  .welcome-header h2 {
    font-size: 24px;
  }

  .welcome-subtitle {
    font-size: 16px;
  }

  .grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .stat-big {
    font-size: 24px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
  }

  .dashboard-card {
    padding: 16px;
  }

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

  .card-header h3 {
    font-size: 16px;
  }

  .list-item {
    padding: 12px;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .class-meta {
    width: 100%;
    justify-content: space-between;
  }

  .trainer-profile {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .trainer-stats {
    justify-content: center;
  }

  .activity-item {
    gap: 12px;
  }

  .activity-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* Very small screens adjustments */
@media (max-width: 480px) {
  .container, .container-sm { padding: 0 12px; }
  .site-header { padding: 10px 12px; }
  .logo { font-size: 16px; }
  .dashboard-welcome { padding: 18px 12px; margin-bottom: 32px; }
  .welcome-header h2 { font-size: 20px; }
  .grid-4 { gap: 16px; margin-bottom: 24px; }
  .stat-card { padding: 12px; }
  .stat-big { font-size: 20px; }
  .trainer-avatar { width: 64px; height: 64px; }
  .avatar { width: 64px; height: 64px; font-size: 20px; }
  .price { font-size: 36px; }
  .card { padding: 16px; }
  .section { padding: 32px 0; }
  .grid-3 { margin-bottom: 32px; }
  .classes-grid { margin-bottom: 32px; }
  .trainers-grid { margin-bottom: 32px; }
  .pricing-grid { margin-bottom: 32px; }
}



/* Container and Grid Components */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.container-sm {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

/* Card Styles */
.card {
  background: var(--panel);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.card p {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.link:hover {
  color: var(--accent-hover);
}

/* Classes Grid */
.section {
  padding: 48px 0;
}

.section-title {
  text-align: center;
  margin: 0 0 32px;
  font-size: 24px;
}

.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.class-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.class-card h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.class-card p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

/* Trainers Grid */
.trainers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
  text-align: center;
}

.trainer {
  background: var(--panel);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.trainer:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 500;
  margin: 0 auto 16px;
}

.trainer h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.trainer p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.price-card {
  background: var(--panel);
  padding: 32px 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.price-card.featured {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
}

.price-card.featured .price,
.price-card.featured .price span,
.price-card.featured ul {
  color: white;
}

.price-card.featured .btn {
  background: white;
  color: var(--accent);
}

.price-card.featured .btn:hover {
  background: rgba(255,255,255,0.9);
}

.price-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.price-card h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.price {
  font-size: 48px;
  font-weight: 700;
  margin: 0 0 24px;
  line-height: 1;
  color: var(--accent);
}

.price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

.price-card ul {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  color: var(--muted);
  font-size: 15px;
}

.price-card li {
  margin-bottom: 8px;
}