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

/* ============================================
   TestBook — Auth & Admin Styles
   Design cohérent avec le thème Ingenium
   Split layout + Dark mode
   ============================================ */

:root {
  --color-primary: #3b5196;
  --color-primary-hover: #2a3d73;
  --color-dark-blue: #2a3d73;
  --color-bg-main: #f8f9fa;
  --color-bg-card: #ffffff;
  --color-success: #0fd08c;
  --color-error: #f85455;
  --color-warning: #f8971e;
  --color-text: #212529;
  --color-text-muted: #6c757d;
  --color-border: #dee2e6;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, Helvetica, sans-serif;
  --radius-card: 12px;
  --radius-btn: 8px;
  --shadow-card: 0 0 10px rgb(0 0 0 / .06);
}

/* ---- Dark mode ---- */

[data-theme="dark"] {
  --color-bg-main: #0f172a;
  --color-bg-card: #1e293b;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #334155;
  --color-dark-blue: #7dd3fc;
  --shadow-card: 0 0 10px rgb(0 0 0 / .3);
}

[data-theme="dark"] .topbar {
  background: #0f172a;
  box-shadow: 0 2px 8px rgb(0 0 0 / .3);
}

[data-theme="dark"] .auth-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .auth-card h1 {
  color: #e2e8f0;
}

[data-theme="dark"] .form-group label {
  color: #cbd5e1;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 81, 150, .25);
}

[data-theme="dark"] .form-group input::placeholder {
  color: #475569;
}

[data-theme="dark"] .alert-error {
  background: #1c0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

[data-theme="dark"] .alert-success {
  background: #052e16;
  color: #86efac;
  border-color: #166534;
}

[data-theme="dark"] .user-table th {
  background: #1e293b;
  color: #94a3b8;
}

[data-theme="dark"] .card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

[data-theme="dark"] .badge-super_admin {
  background: #1e3a5f;
  color: #93c5fd;
}

[data-theme="dark"] .badge-admin {
  background: #451a03;
  color: #fcd34d;
}

[data-theme="dark"] .badge-user {
  background: #1e293b;
  color: #94a3b8;
}

[data-theme="dark"] .badge-testeur {
  background: #064e3b;
  color: #6ee7b7;
}

[data-theme="dark"] .badge-utilisateur {
  background: #1e293b;
  color: #94a3b8;
}

[data-theme="dark"] .badge-developpeur {
  background: #2e1065;
  color: #c4b5fd;
}

[data-theme="dark"] .inline-form select {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg-main);
  min-height: 100vh;
}

/* ---- Topbar ---- */

.topbar {
  background: var(--color-dark-blue);
  color: #fff;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 2px 8px rgb(0 0 0 / .12);
}

.topbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 2rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
}

.topbar-powered {
  font-weight: 400;
  font-size: .75rem;
  opacity: .6;
}

.topbar-logo {
  height: 22px;
  width: auto;
  filter: brightness(0) invert(1);
}

.topbar-links {
  display: flex;
  gap: 1rem;
}

.topbar-links a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: var(--radius-btn);
  transition: color .2s, background .2s;
}

.topbar-links a:hover,
.topbar-links a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
}

/* ---- Auth Split Layout ---- */

.auth-split {
  display: flex;
  min-height: 100vh;
}

.auth-brand-panel {
  width: 45%;
  background: linear-gradient(135deg, #2a3d73 0%, #3b5196 50%, #0693e3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,.08) 0%, transparent 50%);
  pointer-events: none;
}

.auth-brand-content {
  text-align: center;
  color: #fff;
  position: relative;
  z-index: 1;
}

.auth-brand-logo {
  margin-bottom: 2rem;
}

.auth-logo-img {
  height: 64px;
  width: auto;
  filter: brightness(0) invert(1);
}

.auth-brand-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: .75rem;
  letter-spacing: -.02em;
}

.auth-brand-desc {
  font-size: 1.1rem;
  opacity: .85;
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

.auth-form-panel {
  width: 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--color-bg-main);
}

/* ---- Auth pages (legacy .auth-container kept for compat) ---- */

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
  padding: 2rem;
}

.auth-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.5rem;
  color: var(--color-dark-blue);
  margin-bottom: .5rem;
}

.auth-subtitle {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-size: .9rem;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .9rem;
  color: var(--color-dark-blue);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 81, 150, .15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s;
  text-decoration: none;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

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

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

.btn-danger:hover { background: #e03e3f; }

.btn-outline {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
}

.btn-outline:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.6);
}

.btn-sm {
  padding: .3rem .75rem;
  font-size: .8rem;
}

.btn-full { width: 100%; }

/* ---- Alerts ---- */

.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-btn);
  margin-bottom: 1rem;
  font-size: .9rem;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.badge-super_admin {
  background: #dbeafe;
  color: #1e40af;
}

.badge-admin {
  background: #fef3c7;
  color: #92400e;
}

.badge-user {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-testeur {
  background: #d1fae5;
  color: #065f46;
}

.badge-utilisateur {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-developpeur {
  background: #ede9fe;
  color: #5b21b6;
}

/* ---- Admin container ---- */

.admin-container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.admin-container h1 {
  color: var(--color-dark-blue);
  margin-bottom: 1.5rem;
}

.admin-container h2 {
  color: var(--color-dark-blue);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* ---- Cards ---- */

.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

/* ---- User table ---- */

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--color-border);
}

.user-table th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  background: #f9fafb;
}

.user-table td.actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.inline-form {
  display: inline;
}

.inline-form select {
  padding: .25rem .5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-btn);
  font-size: .85rem;
  font-family: inherit;
}

.create-form {
  margin-top: .5rem;
}

/* ---- Page content ---- */

.page-content {
  min-height: calc(100vh - 56px);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .auth-brand-panel {
    display: none;
  }

  .auth-form-panel {
    width: 100%;
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 600px) {
  .topbar-inner { gap: 1rem; }
  .topbar-user span:not(.badge) { display: none; }
  .auth-card { padding: 1.5rem; }
  .form-row { grid-template-columns: 1fr; }
  .user-table { font-size: .85rem; }
  .user-table th:nth-child(4),
  .user-table td:nth-child(4) { display: none; }
}

/* ============================================
   Landing Page (Login)
   ============================================ */

.landing-body {
  background: var(--color-bg-main);
}

.landing-body .topbar,
.landing-body .page-content {
  display: none;
}

/* -- Landing Nav -- */
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 2rem 0;
  position: relative;
  z-index: 2;
}

.landing-nav-brand {
  display: flex;
  align-items: center;
}

.landing-logo-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}

.landing-logo-text span {
  color: rgba(255,255,255,.65);
}

.landing-nav-powered {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}

.landing-ingenium-logo {
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: .7;
}

/* -- Hero -- */
.landing-hero {
  background: linear-gradient(145deg, #1a2340 0%, #2a3d73 40%, #3b5196 70%, #0693e3 100%);
  padding-bottom: 0;
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(6,147,227,.15) 0%, transparent 70%);
  pointer-events: none;
}

.landing-hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59,81,150,.2) 0%, transparent 70%);
  pointer-events: none;
}

.landing-hero-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 2rem 6rem;
  text-align: center;
  position: relative;
  z-index: 2;
}

.landing-hero-content h1 {
  font-size: 2.8rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: 1.25rem;
}

.landing-hero-sub {
  font-size: 1.15rem;
  color: rgba(255,255,255,.75);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.btn-accent {
  background: #0693e3;
  color: #fff;
  font-size: 1rem;
  padding: .75rem 2.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(6,147,227,.35);
  transition: background .2s, transform .1s, box-shadow .2s;
}

.btn-accent:hover {
  background: #057ec5;
  box-shadow: 0 6px 24px rgba(6,147,227,.45);
}

.btn-lg {
  font-size: 1.05rem;
  padding: .8rem 2.5rem;
}

.landing-hero-wave {
  position: relative;
  z-index: 2;
  line-height: 0;
  margin-top: -1px;
}

.landing-hero-wave svg {
  width: 100%;
  height: 80px;
  display: block;
}

/* -- Features -- */
.landing-features {
  padding: 4rem 0 5rem;
}

.landing-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.landing-features h2 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-dark-blue);
  margin-bottom: 2.5rem;
  letter-spacing: -.02em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: box-shadow .2s, transform .15s;
}

.feature-card:hover {
  box-shadow: 0 10px 30px rgb(0 0 0 / .08);
  transform: translateY(-3px);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #3b5196, #0693e3);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark-blue);
  margin-bottom: .5rem;
}

.feature-card p {
  font-size: .88rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* -- Landing Badge -- */
.landing-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .4rem 1.1rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
}

/* -- Landing Hero Actions -- */
.landing-hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* -- Landing Nav Right -- */
.landing-nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.btn-outline {
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  background: transparent;
  border-radius: var(--radius-btn);
  padding: .5rem 1.2rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, border-color .2s;
}

.btn-outline:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.7);
}

.btn-sm {
  font-size: .85rem;
  padding: .4rem 1rem;
}

/* -- Landing Section Header -- */
.landing-section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.landing-section-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-dark-blue);
  margin-bottom: .75rem;
  letter-spacing: -.02em;
}

.landing-section-header p {
  font-size: 1rem;
  color: var(--color-text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* -- How it works -- */
.landing-how {
  padding: 4rem 0 5rem;
  background: var(--color-bg-card);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.how-step {
  text-align: center;
  padding: 1.5rem;
}

.how-number {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b5196, #0693e3);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.how-step h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark-blue);
  margin-bottom: .5rem;
}

.how-step p {
  font-size: .88rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* -- CTA Section -- */
.landing-cta {
  padding: 4rem 0 5rem;
}

.cta-box {
  background: linear-gradient(145deg, #1a2340, #3b5196);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  color: #fff;
}

.cta-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .75rem;
  color: #fff;
}

.cta-box p {
  color: rgba(255,255,255,.7);
  font-size: .95rem;
  max-width: 500px;
  margin: 0 auto 1.5rem;
  line-height: 1.5;
}

/* -- Footer -- */
.landing-footer {
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: .85rem;
}

.landing-footer-inner {
  max-width: 600px;
  margin: 0 auto;
}

.landing-footer-inner p {
  margin-bottom: .5rem;
  line-height: 1.5;
}

.landing-footer-logo {
  height: 28px;
  margin-bottom: .75rem;
  opacity: .5;
}

[data-theme="dark"] .landing-footer-logo {
  filter: brightness(0) invert(1);
  opacity: .3;
}

.landing-footer-link a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.landing-footer-link a:hover {
  text-decoration: underline;
}

/* ============================================
   Standalone Login Page
   ============================================ */

.login-body {
  background: var(--color-bg-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-page {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand {
  text-decoration: none;
}

.login-brand .landing-logo-text {
  color: var(--color-primary);
  font-size: 2rem;
}

.login-brand .landing-logo-text span {
  color: var(--color-dark-blue);
  opacity: .6;
}

.login-card {
  margin-bottom: 2rem;
}

.login-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.login-footer-logo {
  height: 20px;
  opacity: .5;
}

[data-theme="dark"] .login-footer-logo {
  filter: brightness(0) invert(1);
  opacity: .3;
}

/* -- Landing Responsive -- */
@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .how-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .landing-hero-content h1 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
  .how-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin: 0 auto;
  }
  .landing-hero-content {
    padding: 3rem 1.5rem 4rem;
  }
  .landing-hero-content h1 {
    font-size: 1.6rem;
  }
  .landing-hero-sub {
    font-size: 1rem;
  }
  .landing-nav {
    padding: 1rem 1.5rem 0;
  }
  .landing-nav-right {
    gap: .75rem;
  }
  .cta-box {
    padding: 2rem 1.5rem;
  }
}
