/* ═══════════════════════════════════════════════════════════
   GYM SYSTEM — LAYOUT / SIDEBAR / NAVIGATION
   ═══════════════════════════════════════════════════════════ */

/* ── APP SHELL ── */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-logo {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand small {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 2px;
}

/* ── NAV ── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-family: var(--font-display);
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none; background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item.active svg { color: var(--accent); }

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: var(--font-display);
}

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-user:hover { background: var(--bg-card); }

.sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-family: var(--font-display);
  letter-spacing: 0.6px;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

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

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title .icon {
  color: var(--accent);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── MOBILE TOGGLE ── */
.sidebar-toggle {
  display: none;
  position: fixed; top: 16px; left: 16px;
  z-index: 200;
  background: var(--accent);
  border: none; border-radius: var(--radius-sm);
  padding: 10px;
  color: #fff; cursor: pointer;
  box-shadow: var(--shadow-card);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }

  .sidebar-toggle { display: block; }

  .main-content {
    margin-left: 0;
    padding: 16px 14px;
    padding-top: 60px;
    /* Safe area for notched phones */
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }

  .sidebar-header {
    padding: 18px 16px;
  }

  .sidebar-header .logo-img {
    height: 34px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }

  .page-title { font-size: 1.4rem; }

  /* Modal adjustments for mobile */
  .modal {
    width: 96%;
    padding: 20px;
    max-height: 90vh;
    margin: 16px;
  }

  .modal-header h2 { font-size: 1.1rem; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}
