/* =====================================================
   SPORT CONNECT MOROCCO · app.css
   Layout authentifié : sidebar, drawer, dashboard
   ===================================================== */

/* ===== APP SHELL ===== */
.app-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}
.app-content {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px;
  min-width: 0;
}

/* ===== SIDEBAR DESKTOP ===== */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  align-self: flex-start;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }

.sidebar-brand {
  padding: 8px 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--lime), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #06080C;
}
.sidebar-logo svg { width: 18px; height: 18px; }
.sidebar-brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-hi);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 2px;
  font-weight: 600;
}

.sidebar-section {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-lo);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  padding: 14px 12px 6px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: none;
  background: transparent;
  color: var(--text-md);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.01em;
  cursor: pointer;
  border-radius: 8px;
  text-align: left;
  width: 100%;
  transition: background-color 0.15s, color 0.15s;
  position: relative;
  text-decoration: none;
}
.side-link:hover {
  background: var(--bg-elevated);
  color: var(--text-hi);
}
.side-link.on {
  background: var(--bg-elevated);
  color: var(--text-hi);
  font-weight: 600;
}
.side-link.on::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--lime);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(199, 251, 58, 0.5);
}
.side-link-i {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}
.side-link.on .side-link-i { opacity: 1; }
.side-link-i svg { width: 18px; height: 18px; display: block; }
.side-link-l {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-link-badge {
  background: var(--lime);
  color: #06080C;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.side-link-badge.lm { background: var(--cyan); }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border-radius: 10px;
  margin-bottom: 8px;
}
.sidebar-user-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lime), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: #06080C;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-hi);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-handle {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-lo);
  margin-top: 1px;
}

/* Sidebar user devient cliquable vers le profil */
.sidebar-user-link {
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
}
.sidebar-user-link:hover {
  background: var(--bg-elevated-hover, rgba(199,251,58,0.06));
}
.sidebar-user-link:active {
  transform: scale(0.99);
}

/* Avatar image dans la sidebar */
.sidebar-user-av-img {
  background: var(--bg-elevated);
  padding: 0;
  overflow: hidden;
}
.sidebar-user-av-img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ===== HAMBURGER + DRAWER (mobile) ===== */
.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-hi);
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 199;
}
.hamburger:hover { background: var(--bg-card-hi); }

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.drawer-backdrop.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  left: -320px;
  bottom: 0;
  width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  z-index: 201;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: left 0.25s cubic-bezier(.4, 0, .2, 1);
  overflow-y: auto;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
}
.drawer.open { left: 0; }
.drawer-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
}
.drawer-close:hover {
  color: var(--text-hi);
  border-color: var(--text-hi);
}
.drawer-close svg { width: 14px; height: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .hamburger { display: inline-flex; }
  .app-content { padding: 72px 16px 24px; }
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.page-eb {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  font-weight: 700;
}
.page-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 32px;
  color: var(--text-hi);
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.page-sub {
  font-size: 14px;
  color: var(--text-md);
  margin-top: 8px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text-hi);
  letter-spacing: -0.015em;
}

/* ===== STAT CARDS (dashboard) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--lime), var(--cyan));
}
.stat-l {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-md);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--text-hi);
  letter-spacing: -0.025em;
  line-height: 1;
}
.stat-v.lm { color: var(--lime); }
.stat-v.cy { color: var(--cyan); }
.stat-v .u {
  font-size: 14px;
  color: var(--text-md);
  font-weight: 500;
  margin-left: 3px;
}
.stat-trend {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
  color: var(--lime);
}
.stat-trend.down { color: var(--danger); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-hi);
  border-radius: 12px;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  filter: grayscale(0.3);
}
.empty-state-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--text-hi);
  margin-bottom: 8px;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-md);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto 20px;
}
.empty-state-cta {
  display: inline-block;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--lime), var(--cyan));
  color: #06080C;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
