/* ============================================================
   ETUDIOS – Plateforme pédagogique | app.css
   ============================================================ */

/* ---- Variables ---- */
:root {
  --green:        #52a55e;
  --green-dark:   #2d6a4f;
  --green-deeper: #1a472a;
  --green-light:  #95d5a8;
  --green-pale:   #d8f3dc;
  --blue:         #2e86ab;
  --blue-dark:    #1e5f74;
  --blue-deep:    #0d3b5e;
  --blue-light:   #74c0d8;
  --white:        #ffffff;
  --gray-light:   #f0f4f1;
  --gray-mid:     #dde8de;
  --text:         #1c3438;
  --text-light:   #4a6670;
  --error:        #c0392b;
  --success:      #27ae60;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --r-sm:         8px;
  --r-md:         16px;
  --r-lg:         24px;
  --r-xl:         40px;
  --sh-sm:        0 2px 8px rgba(0,0,0,.08);
  --sh-md:        0 4px 24px rgba(0,0,0,.12);
  --sh-lg:        0 8px 48px rgba(0,0,0,.18);
  --t:            0.25s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); line-height: 1.65; background: var(--white); }
img  { max-width: 100%; display: block; }
a    { color: inherit; }

/* ---- Accessibilité ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 3px; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.75rem; border-radius: var(--r-xl);
  font-family: var(--font); font-size: 1rem; font-weight: 600;
  cursor: pointer; border: none; transition: var(--t); text-decoration: none;
  line-height: 1;
}
.btn-primary {
  background: var(--green-dark); color: #fff;
  box-shadow: 0 4px 16px rgba(45,106,79,.35);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--green-deeper); transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(45,106,79,.45);
}
.btn-secondary {
  background: transparent; color: var(--green-dark);
  border: 2px solid var(--green-dark);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--green-pale); transform: translateY(-2px);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-mid);
  padding: .85rem 1rem;
  transition: box-shadow var(--t);
}
.site-nav.scrolled { box-shadow: var(--sh-sm); }
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-logo {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.05rem; color: var(--green-dark);
  text-decoration: none;
}
.nav-logo-icon { width: 28px; height: 28px; }
.nav-links {
  display: flex; align-items: center; gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  color: var(--text-light); font-size: .9rem; font-weight: 500;
  text-decoration: none; transition: color var(--t); padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--green-dark); border-bottom-color: var(--green-dark); }
.nav-cta { display: flex; gap: .75rem; }

/* ============================================================
   AUTH PAGES (Login/Register)
   ============================================================ */
.auth-page {
  min-height: 100dvh;
  background: linear-gradient(150deg,
    var(--green-deeper) 0%,
    var(--green-dark)   25%,
    #2d7d62             50%,
    var(--blue-dark)    75%,
    var(--blue-deep)    100%);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 2rem 1rem;
  overflow: hidden; position: relative;
}

.auth-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--r-lg);
  padding: 2.75rem 2.25rem 2.25rem;
  width: 100%; max-width: 460px;
  box-shadow: 0 8px 64px rgba(0,0,0,.35);
  animation: fade-enter .7s ease both;
}
@keyframes fade-enter {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card h1 {
  font-size: 1.7rem; font-weight: 700; color: #fff;
  text-align: center; line-height: 1.25; margin-bottom: .4rem;
}
.auth-sub {
  text-align: center; color: rgba(255,255,255,.72);
  font-size: .95rem; margin-bottom: 1.75rem;
}

.auth-form { display: flex; flex-direction: column; gap: .75rem; }
.auth-field { display: flex; flex-direction: column; gap: .4rem; }
.auth-field label {
  color: rgba(255,255,255,.8); font-size: .875rem; font-weight: 500;
}
.auth-input {
  width: 100%; padding: .875rem 1.1rem;
  background: rgba(255,255,255,.15);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: var(--r-md); color: #fff;
  font-size: 1rem; font-family: var(--font);
  transition: var(--t); outline: none;
}
.auth-input::placeholder { color: rgba(255,255,255,.45); }
.auth-input:focus { border-color: rgba(255,255,255,.8); background: rgba(255,255,255,.22); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard {
  display: grid; grid-template-columns: 250px 1fr;
  min-height: 100vh; gap: 0;
}
.sidebar {
  background: var(--green-dark); color: #fff;
  padding: 2rem 1.5rem; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.05rem;
  margin-bottom: 2rem; color: #fff;
}
.sidebar-menu { list-style: none; }
.sidebar-menu li {
  margin-bottom: .5rem;
}
.sidebar-menu a {
  display: block; padding: .75rem 1rem;
  color: rgba(255,255,255,.8);
  text-decoration: none; border-radius: var(--r-sm);
  transition: var(--t);
}
.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: rgba(255,255,255,.15); color: #fff;
}

.main-content {
  padding: 2rem; overflow-y: auto;
}

.header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-mid);
}

.header h1 {
  font-size: 2rem; font-weight: 700; color: var(--text);
}

.header-actions {
  display: flex; align-items: center; gap: 1rem;
}

/* ============================================================
   CARDS & GRIDS
   ============================================================ */
.card {
  background: var(--white); border-radius: var(--r-md);
  padding: 1.5rem; box-shadow: var(--sh-sm);
  transition: transform var(--t), box-shadow var(--t);
  border: 1px solid var(--gray-mid);
}
.card:hover {
  transform: translateY(-2px); box-shadow: var(--sh-md);
}

.grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card-title {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text); margin-bottom: .5rem;
}

.card-meta {
  font-size: .85rem; color: var(--text-light);
}

.card-description {
  color: var(--text-light); margin-top: .5rem;
  font-size: .95rem;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex; flex-direction: column; gap: .4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: .9rem; font-weight: 600; color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%; padding: .75rem 1rem;
  border: 1.5px solid var(--gray-mid);
  border-radius: var(--r-sm);
  font-size: .95rem; font-family: var(--font);
  color: var(--text); background: var(--white);
  transition: border-color var(--t);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(82,165,94,.18);
}

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

.form-button {
  background: var(--green-dark); color: #fff;
  padding: .875rem 2.5rem; border-radius: var(--r-xl);
  font-size: 1rem; font-weight: 700;
  border: none; cursor: pointer; transition: var(--t);
}

.form-button:hover {
  background: var(--green-deeper); transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(45,106,79,.35);
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 1rem 1.25rem; border-radius: var(--r-sm);
  margin-bottom: 1.25rem; font-weight: 500;
  display: flex; align-items: center; gap: .75rem;
}

.alert-success {
  background: #e8f5e9; border: 1.5px solid var(--success);
  color: #1b5e20;
}

.alert-error {
  background: #ffeaea; border: 1.5px solid var(--error);
  color: #7f0000;
}

.alert-info {
  background: #e3f2fd; border: 1.5px solid var(--blue);
  color: var(--blue-deep);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

@media (max-width: 700px) {
  .nav-links { display: none; }
  .grid { grid-template-columns: 1fr; }
  .main-content { padding: 1rem; }
  .header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
