/* MecaProf AI — thème sombre "atelier" (sans dépendance externe, hors-ligne) */

:root {
  --bg: #0c0f12;
  --panel: #12161b;
  --panel-2: #181d24;
  --border: #232a33;
  --border-strong: #333d49;
  --text: #afc0d1;
  --text-dim: #8598ac;
  --text-mute: #4a5563;
  --white: #ffffff;
  --accent: #ff6b1a;
  --accent-hover: #ff8642;
  --accent-active: #e4550a;
  --accent-ink: #0c0f12;
  --success: #10b981;
  --danger: #ef4444;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--accent); }
h1, h2, h3, h4 { color: var(--white); line-height: 1.25; }
.mono { font-family: var(--mono); }

.hidden { display: none !important; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px;
  background: rgba(12, 15, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 18px;
}
.brand-name { font-family: var(--mono); font-weight: 700; color: var(--white); letter-spacing: -0.02em; }
.brand-name span { color: var(--accent); }
.brand-sub { font-size: 10.5px; font-family: var(--mono); color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel);
}
.user-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.user-chip .role { color: var(--accent); text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }

/* ---------- Boutons ---------- */
.btn-primary, .btn-secondary, .ghost-btn, .btn-danger {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; border-radius: 8px; padding: 10px 16px;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.05s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--white); }
.btn-danger { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.ghost-btn { background: transparent; color: var(--text-dim); border-color: var(--border); }
.ghost-btn:hover { color: var(--white); border-color: var(--border-strong); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 6px; }

/* ---------- Vue login ---------- */
.view { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.login-card {
  max-width: 440px; margin: 8vh auto 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px;
  box-shadow: 0 0 0 1px rgba(255, 107, 26, 0.12), 0 0 40px rgba(255, 107, 26, 0.06);
}
.login-card h1 { font-size: 22px; margin: 4px 0 8px; }
.login-card p { color: var(--text-dim); font-size: 14px; margin: 0 0 20px; }
.login-card .kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }

/* ---------- Formulaires ---------- */
label.field-label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; background: var(--panel-2); color: var(--white);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px;
  font-family: var(--sans); font-size: 14px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input::placeholder, textarea::placeholder { color: var(--text-mute); }

/* ---------- Application ---------- */
.app-view { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }

.sidebar { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 78px; }
.side-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); padding: 0 4px; margin-top: 4px; }

.module-btn {
  text-align: left; width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.module-btn:hover { border-color: rgba(255, 107, 26, 0.5); }
.module-btn.active { border-color: var(--accent); background: var(--panel-2); }
.module-btn .t { color: var(--white); font-weight: 600; font-size: 14px; }
.module-btn .d { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.quota-box {
  margin-top: 16px; padding: 14px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--border); font-family: var(--mono); font-size: 13px;
}
.quota-box .q-title { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 6px; }
.quota-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.quota-bar > div { height: 100%; background: var(--accent); width: 0; transition: width 0.3s; }

.workspace { min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 107, 26, 0.06);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.card-head .kicker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.card-head .desc { color: var(--white); font-weight: 600; margin-top: 2px; }
.card-head select { width: auto; min-width: 150px; }
.card-body { padding: 18px; }

.prompt-wrap { position: relative; }
.prompt-wrap textarea { padding-right: 48px; }
.mic-btn {
  position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border-strong); color: var(--text); cursor: pointer;
}
.mic-btn:hover { border-color: var(--accent); }
.mic-btn.rec { border-color: var(--danger); color: #fff; background: var(--danger); font-weight: 700; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.actions .left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); }
.status { font-family: var(--mono); font-size: 12px; color: var(--text-mute); }
.check { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; color: var(--text-dim); font-size: 13px; }
.check input { accent-color: var(--accent); width: auto; }

.output-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.output-head .tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--success); }
.output-head .meta { font-size: 11.5px; font-family: var(--mono); color: var(--text-mute); }
.output-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.output-body { padding: 18px; font-size: 14.5px; color: #d7e1ea; }

/* Rendu du contenu généré */
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.1em; margin-bottom: 0.35em; }
.prose h2 { font-size: 18px; } .prose h3 { font-size: 16px; } .prose h4 { font-size: 14.5px; }
.prose p { margin: 0.55em 0; }
.prose ul, .prose ol { margin: 0.55em 0; padding-left: 1.5em; }
.prose li { margin: 0.25em 0; }
.prose strong { color: var(--white); }
.prose code { font-family: var(--mono); font-size: 0.9em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.prose pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
.prose pre code { background: none; border: none; padding: 0; }
.prose .dim { color: var(--text-dim); }
.prose .badge { display: inline-block; font-size: 11px; font-family: var(--mono); background: rgba(255,107,26,0.12); color: var(--accent-hover); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

.error {
  margin-top: 16px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.06); color: #fca5a5; font-size: 14px;
}

/* ---------- Administration ---------- */
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-header h1 { margin: 0; font-size: 22px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 8px; background: var(--panel); color: var(--text-dim);
  border: 1px solid var(--border); cursor: pointer; font-size: 14px;
}
.tab.active { color: var(--white); border-color: var(--accent); background: var(--panel-2); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
tr:hover td { background: rgba(255, 255, 255, 0.02); }
.plan { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-strong); }
.badge-ok { color: var(--success); } .badge-off { color: var(--text-mute); }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Modale ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 22px; position: relative; }
.modal-card h3 { margin: 0 0 6px; }
.modal-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--white); }

/* ---------- Studio de contenus (quiz, fiches, carte mentale, diapos, infographie) ---------- */

.quiz-q { border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 14px 0; background: var(--panel-2); }
.quiz-question { color: var(--white); font-weight: 600; margin: 0 0 10px; }
.quiz-options { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt { text-align: left; padding: 9px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border-strong); color: var(--text); cursor: pointer; font-size: 14px; }
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt.correct { background: rgba(16,185,129,0.15); border-color: var(--success); color: #6ee7b7; }
.quiz-opt.wrong { background: rgba(239,68,68,0.15); border-color: var(--danger); color: #fca5a5; }
.quiz-opt:disabled { cursor: default; opacity: 0.85; }
.quiz-explain { margin-top: 10px; font-size: 13px; color: var(--text-dim); border-left: 3px solid var(--accent); padding-left: 10px; }

.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.flashcard { perspective: 1000px; cursor: pointer; min-height: 160px; }
.flash-inner { position: relative; width: 100%; height: 100%; min-height: 160px; transform-style: preserve-3d; transition: transform 0.45s; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; padding: 16px; border-radius: 12px; border: 1px solid var(--border-strong); text-align: center; font-size: 14px; }
.flash-front { background: var(--panel-2); color: var(--white); font-weight: 600; }
.flash-back { background: var(--accent); color: var(--accent-ink); transform: rotateY(180deg); font-weight: 500; }

.mindmap { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 12px; }
.mm-center { background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 14px 22px; border-radius: 999px; font-size: 15px; }
.mm-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; width: 100%; }
.mm-branch { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.mm-branch-title { color: var(--white); font-weight: 700; margin-bottom: 6px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.mm-branch ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

.slides-viewport { position: relative; min-height: 220px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); overflow: hidden; }
.slide { position: absolute; inset: 0; padding: 24px; opacity: 0; transform: translateX(20px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.slide.active { opacity: 1; transform: translateX(0); pointer-events: auto; position: relative; }
.slide h3 { margin: 0 0 12px; font-size: 20px; }
.slides-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.slide-count { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

.infogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.infoblock { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--panel-2); }
.infoblock.stat { text-align: center; }
.infoval { font-size: 30px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.infolbl { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.infotitle { color: var(--white); font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.infoblock.texte p { margin: 0; font-size: 13px; color: var(--text-dim); }
.infoblock.liste ul { margin: 0; padding-left: 18px; font-size: 13px; }

.live-draft { white-space: pre-wrap; word-break: break-word; font-size: 12px; color: var(--text-mute); max-height: 280px; overflow: hidden; margin-top: 10px; font-family: var(--mono); }

/* ---------- Divers ---------- */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,107,26,0.3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.blink { animation: blink 1.6s ease-in-out infinite; }

.footer-note { text-align: center; font-size: 12px; font-family: var(--mono); color: var(--text-mute); padding: 30px 20px 40px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--panel); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

@media (max-width: 820px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .topbar { padding: 12px 14px; }
}

/* ---------- Page vitrine / tarifs ---------- */
.landing { max-width: 1100px; margin: 0 auto; padding: 0 20px 40px; }
.landing-hero { padding: 56px 0 36px; }
.landing-inner { max-width: 1000px; margin: 0 auto; }
.landing-hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; margin: 10px 0 16px; line-height: 1.12; }
.landing-hero h1 .accent { color: var(--accent); }
.landing-sub { font-size: 17px; color: var(--text-dim); max-width: 640px; line-height: 1.6; }
.landing-cta { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.landing-cta a, .landing-cta button { font-size: 15px; padding: 12px 20px; }

.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding: 32px 0; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.f-icon { font-size: 24px; margin-bottom: 8px; }
.feature h3 { font-size: 15px; margin: 0 0 6px; }
.feature p { font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.5; }

.pricing-tabs { margin-bottom: 20px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: stretch; }
.price-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; position: relative; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,107,26,0.25), 0 0 40px rgba(255,107,26,0.08); }
.price-badge { position: absolute; top: -11px; left: 18px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.price-name { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.price-amount { font-size: 30px; font-weight: 800; color: var(--white); margin: 6px 0 14px; }
.price-amount .per { font-size: 14px; font-weight: 500; color: var(--text-dim); }
.price-card ul { list-style: none; margin: 0 0 18px; padding: 0; flex: 1; }
.price-card li { padding: 6px 0; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.price-card li:last-child { border-bottom: none; }
.btn-block { display: block; width: 100%; text-align: center; box-sizing: border-box; text-decoration: none; }
.landing-note { text-align: center; color: var(--text-dim); font-size: 13px; margin-top: 24px; }

@media (max-width: 820px) {
  .landing-hero h1 { font-size: 29px; }
}
