/* ============================================================
   IPSSI Projets — Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- Variables ---------- */
:root {
  --bg:           #0a0a0f;
  --bg-secondary: #0f0f1a;
  --surface:      rgba(255, 255, 255, 0.04);
  --surface-hover:rgba(255, 255, 255, 0.07);
  --border:       rgba(255, 255, 255, 0.08);
  --border-hover: rgba(124, 58, 237, 0.4);

  --accent:       #7c3aed;
  --accent-light: #9d5cf6;
  --accent-glow:  rgba(124, 58, 237, 0.25);
  --accent-dim:   rgba(124, 58, 237, 0.12);

  --text:         #f1f5f9;
  --text-secondary:#94a3b8;
  --text-dim:     #64748b;

  --success:      #10b981;
  --success-dim:  rgba(16, 185, 129, 0.12);
  --warning:      #f59e0b;
  --warning-dim:  rgba(245, 158, 11, 0.12);
  --danger:       #ef4444;
  --danger-dim:   rgba(239, 68, 68, 0.12);
  --info:         #3b82f6;
  --info-dim:     rgba(59, 130, 246, 0.12);

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;
  --radius-xl:    24px;

  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.6);
  --shadow-accent:0 0 32px rgba(124, 58, 237, 0.2);

  --transition:   0.2s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

/* Background mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124,58,237,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(124,58,237,0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p  { color: var(--text-secondary); }
a  { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.container--narrow { max-width: 680px; }
.container--wide   { max-width: 1400px; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
}

.nav__brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 12px rgba(124,58,237,0.4);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav__links a {
  display: block;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--text);
  background: var(--surface-hover);
}

.nav__links a.active {
  color: var(--accent-light);
  background: var(--accent-dim);
}

/* ---------- Glass Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 28px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.card--flat { cursor: default; }
.card--flat:hover {
  border-color: var(--border);
  background: var(--surface);
}

.card--accent {
  border-color: var(--border-hover);
  background: var(--accent-dim);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn--primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 32px rgba(124,58,237,0.5);
  transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }

.btn--secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  color: var(--text);
  background: var(--surface);
}

.btn--danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn--danger:hover { background: rgba(239,68,68,0.2); }

.btn--success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}
.btn--success:hover { background: rgba(16,185,129,0.2); }

.btn--lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn--sm { padding: 6px 14px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------- Forms ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-textarea,
.form-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-dim); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  background: rgba(124,58,237,0.06);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* Grade input */
.grade-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grade-input-wrapper input[type="number"] {
  width: 80px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.grade-display {
  font-size: 0.875rem;
  color: var(--text-dim);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge--waiting  { background: var(--surface-hover); color: var(--text-secondary); }
.badge--submitted{ background: var(--info-dim);    color: var(--info);    border: 1px solid rgba(59,130,246,0.2); }
.badge--graded   { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.badge--defended { background: var(--success-dim); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }

/* ---------- Toggle Switch ---------- */
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle__track {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all var(--transition);
  flex-shrink: 0;
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle input { display: none; }

.toggle input:checked + .toggle__track {
  background: var(--success);
  border-color: var(--success);
}
.toggle input:checked + .toggle__track::after {
  left: calc(100% - 19px);
  background: white;
}

.toggle__label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }

/* ---------- Stats Row ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Member List ---------- */
.members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 7px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.member-avatar {
  width: 22px;
  height: 22px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  flex-shrink: 0;
}

/* ---------- Alert / Toast ---------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert--info    { background: var(--info-dim);    color: var(--info);    border: 1px solid rgba(59,130,246,0.2); }
.alert--success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert--warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert--danger  { background: var(--danger-dim);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ---------- Section ---------- */
.section { padding: 64px 0; }
.section--sm { padding: 40px 0; }

.section__header { margin-bottom: 32px; }
.section__eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 8px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 64px;
  text-align: center;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 24px;
}

.hero__title { margin-bottom: 16px; }
.hero__title span { color: var(--accent-light); }
.hero__desc { font-size: 1.1rem; max-width: 560px; margin: 0 auto 36px; }

.hero__cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Grid ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }

/* ---------- Info List ---------- */
.info-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.info-list li::before {
  content: '→';
  color: var(--accent-light);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 24px;
  position: relative;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  box-shadow: 0 0 12px var(--accent-glow);
}
.timeline-content { padding-top: 4px; }
.timeline-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 2px; }
.timeline-date { font-size: 0.8125rem; color: var(--text-dim); }

/* ---------- Search ---------- */
.search-bar {
  position: relative;
}
.search-bar__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}
.search-bar input { padding-left: 42px; }

/* ---------- Admin Group Card ---------- */
.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.group-card:hover { border-color: var(--border-hover); }

.group-card__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.group-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.group-card__body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.group-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.group-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.group-card__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.15);
}

/* ---------- Save feedback ---------- */
@keyframes saved-pulse {
  0%   { opacity:1; }
  50%  { opacity:0.6; }
  100% { opacity:1; }
}
.save-feedback {
  font-size: 0.8125rem;
  color: var(--success);
  font-weight: 500;
  display: none;
}
.save-feedback.show { display: block; animation: saved-pulse 1s ease 2; }

/* ---------- Github Link ---------- */
.github-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  background: var(--surface-hover);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.github-link:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 64px 32px;
}
.empty-state__icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state__title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-state__desc { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Login Screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.login-card__logo {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-accent);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 3px;
  transition: width 0.5s var(--transition-slow);
}

/* ---------- Spinner ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-fade    { animation: fadeIn var(--transition-slow) both; }
.anim-slide   { animation: slideUp var(--transition-slow) both; }
.anim-scale   { animation: scaleIn var(--transition-slow) both; }

.anim-delay-1 { animation-delay: 0.05s; }
.anim-delay-2 { animation-delay: 0.1s; }
.anim-delay-3 { animation-delay: 0.15s; }
.anim-delay-4 { animation-delay: 0.2s; }
.anim-delay-5 { animation-delay: 0.25s; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent-light); }
.text-success { color: var(--success); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav__links { gap: 2px; }
  .nav__links a { padding: 6px 10px; font-size: 0.8125rem; }
  .group-card__actions { grid-template-columns: 1fr; }
  .group-card__meta { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 48px 0 40px; }
  .section { padding: 40px 0; }
  .login-card { padding: 36px 28px; }
}

@media (max-width: 480px) {
  .nav__brand span { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
