/* Espace élève — mêmes couleurs et polices que le site Institut Misbah */
:root {
  --cream: #FBF6EA; --cream-2: #F4EBD3; --ink: #0F2D3F; --ink-soft: #3b5666; --muted: #6c8090;
  --gold: #B8862B; --gold-light: #E3C583; --line: rgba(15,45,63,.14);
  --ok: #1F7A4D; --ok-t: #E3F3EA; --warn: #A86A00; --warn-t: #FCEFD6; --err: #B42318; --err-t: #FDECEA; --navy-t: #E6EEF3;
  --serif: "Cormorant Garamond", Georgia, serif; --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 18px; --sh: 0 14px 34px -22px rgba(15,45,63,.45);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 15.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .center { text-align: center; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 20; background: rgba(251,246,234,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 38px; width: auto; }
.brand b { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.brand small { display: block; font-size: 11.5px; color: var(--gold); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
#who { display: flex; align-items: center; gap: 8px; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who b { display: block; font-size: 14px; line-height: 1.1; } .who small { display: block; font-size: 11.5px; color: var(--muted); }
.icon-btn { border: 0; background: none; padding: 8px; border-radius: 10px; cursor: pointer; color: var(--ink-soft); }
.icon-btn:hover { background: rgba(15,45,63,.06); }
main { padding: 22px 0 60px; }

/* Éléments */
.card { background: #fff; border-radius: var(--r); padding: 20px; box-shadow: var(--sh), inset 0 0 0 1px var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--ink); color: #fff; transition: transform .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn.gold { background: var(--gold); color: #fff; } .btn.gold:hover { background: #a3761f; }
.btn.light { background: var(--cream-2); color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.btn.wa { background: #1F9D55; color: #fff; } .btn.wa svg { width: 20px; height: 20px; }
.btn.sm { padding: 7px 13px; font-size: 13.5px; } .btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 14px; align-content: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.f .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; }
input, select, textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #FFFDF8; font-weight: 500; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-light); border-color: var(--gold); }
textarea { resize: vertical; }
.msg { font-size: 14px; font-weight: 600; } .msg.err { color: var(--err); } .msg.ok { color: var(--ok); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--ok-t); color: var(--ok); } .pill.warn { background: var(--warn-t); color: var(--warn); } .pill.err { background: var(--err-t); color: var(--err); } .pill.navy { background: var(--navy-t); color: var(--ink); }
.eyebrow { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.av { width: 44px; height: 44px; border-radius: 14px; background: var(--ink); color: var(--gold-light); display: grid; place-items: center; font-family: var(--serif); font-size: 22px; font-weight: 600; flex: none; }
.av.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
.badge { font-style: normal; background: var(--gold); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 800; padding: 1px 8px; }
.note { background: var(--cream); border-radius: 10px; padding: 8px 10px; white-space: pre-line; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px; }
.sec { font-size: 16px; margin: 18px 0 10px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--cream-2); color: var(--gold); display: grid; place-items: center; margin: 0 auto 10px; }
.empty b { display: block; color: var(--ink); font-size: 16px; } .empty p { margin: 4px 0 0; }
.empty.small { padding: 16px; font-size: 14px; }
.skeleton { height: 220px; border-radius: var(--r); background: linear-gradient(90deg, #f3ecdc, #faf5ea, #f3ecdc); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 99; max-width: calc(100% - 32px); box-shadow: var(--sh); }
.warn-t { color: var(--warn); }

/* Connexion / inscription */
.auth { max-width: 440px; margin: 20px auto; padding: 28px; } .auth.wide { max-width: 620px; }
.auth h1 { font-size: 38px; margin: 0; } .auth > p { margin: 6px 0 20px; }

/* Accueil des espaces */
.hello { margin-bottom: 14px; } .hello h1 { font-size: 40px; margin: 0; line-height: 1.1; } .hello p { margin: 4px 0 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 16px; padding-bottom: 2px; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--ink-soft); white-space: nowrap; }
.tabs a[aria-selected="true"] { background: var(--ink); color: #fff; }
.tabs a i { font-style: normal; background: var(--gold); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 0 7px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; padding: 14px; }
.st { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.st b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--cream-2); color: var(--ink-soft); flex: none; }
.st.on { color: var(--ink); } .st.on b { background: var(--gold); color: #fff; }
.cards { display: grid; gap: 10px; }
.card.student { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; }
.card.student .t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.card.student .t.link { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.card.student .t.link .t { display: grid; }
.card.student small { color: var(--muted); font-size: 13px; }
.card.student .side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
a.card.student:hover { box-shadow: var(--sh), inset 0 0 0 1px var(--gold-light); }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.split > * { min-width: 0; }
.narrow { max-width: 520px; }

/* Cours */
.card.hi { border-left: 4px solid var(--ink); margin-bottom: 14px; } .card.hi h2 { font-size: 30px; margin: 2px 0 2px; }
.card.pay { border-left: 4px solid var(--gold); margin-bottom: 14px; background: linear-gradient(180deg, #fff, #FFFBF1); }
.card.pay h2 { font-size: 40px; margin: 0; line-height: 1.1; } .card.pay p { margin: 6px 0 14px; color: var(--ink-soft); }
.card.mini { display: grid; gap: 4px; padding: 14px; }
.lessons { display: grid; gap: 6px; margin: 10px 0; }
.lesson { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--line); }
.card .lesson { background: var(--cream); box-shadow: none; }
.lesson .d { width: 44px; text-align: center; background: var(--cream-2); border-radius: 10px; padding: 3px 0; line-height: 1.1; }
.lesson .d small { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; } .lesson .d b { font-size: 18px; }
.lesson .t { flex: 1; min-width: 0; display: grid; } .lesson .t span { font-size: 13px; color: var(--muted); }
.room { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; color: #fff; background: var(--gold); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; }
.room svg { width: 24px; height: 24px; } .room small { display: block; font-weight: 500; opacity: .9; font-size: 12.5px; } .room b { display: block; }
.card.room.big { margin-bottom: 14px; padding: 16px 18px; }

/* Discussion */
.chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: min(64vh, 620px); }
.chat > .room { margin: 10px 10px 0; border-radius: 12px; }
.msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #FFFCF5; }
.msgs > * { flex-shrink: 0; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.mine { align-self: flex-end; background: var(--ink); color: #fff; box-shadow: none; border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.bubble time { display: block; font-size: 11px; opacity: .6; margin-top: 3px; }
.bubble.held, .bubble.rejected { opacity: .75; border: 1px dashed var(--warn); }
.mod { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-top: 6px; font-weight: 600; }
.day-sep { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--cream-2); padding: 2px 10px; border-radius: 999px; text-transform: capitalize; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.composer textarea { min-height: 44px; max-height: 130px; resize: none; border-radius: 14px; }
.composer .btn { padding: 10px 14px; }
.composer.ro { justify-content: center; color: var(--muted); font-size: 13px; font-weight: 600; }

/* Fenêtre « Programmer des cours » */
.modal-bg { position: fixed; inset: 0; background: rgba(15,45,63,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 22px; padding: 24px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 14px; }
.modal h3 { font-size: 26px; margin: 0; } .modal p { margin: 0; }
.pl { display: grid; grid-template-columns: 1.3fr 1fr 1fr 26px; gap: 8px; align-items: center; }
.pl input, .pl select { min-width: 0; padding: 9px 10px; }
.pl .x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }
  .tsplit > .stack { order: -1; }   /* prof sur téléphone : « Programmer des cours » avant la discussion */
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .hello h1 { font-size: 32px; }
  .brand small { display: none; }
  .who small { display: none; }
  .chat { height: calc(100dvh - 64px - 150px); min-height: 380px; }
  .bubble { max-width: 88%; }
  .pl { grid-template-columns: 1fr 1fr; }
  .card.student { flex-wrap: wrap; }
  .card.student .side { width: 100%; justify-content: flex-start; }
}

/* Groupes */
.members { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; font-size: 13.5px; color: var(--ink-soft); flex-shrink: 0; }
.members svg { color: var(--gold); }
.picks { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; padding: 2px; }
.pick { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: var(--cream); cursor: pointer; font-weight: 500; }
.pick input { width: auto; accent-color: var(--gold); }
.pick b { display: block; font-size: 14px; } .pick small { display: block; color: var(--muted); font-size: 12.5px; }
.pick:has(input:checked) { background: var(--cream-2); box-shadow: inset 0 0 0 1px var(--gold-light); }
.av svg { width: 22px; height: 22px; color: var(--gold-light); }
label.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; } label.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--gold, #B8862B); flex: none; }
.card.contact h3 { margin: 0 0 6px; } .card.contact p { margin: 0 0 14px; } .card.contact .btn { width: 100%; justify-content: center; }
.invites { display: grid; margin-top: 8px; } .invite { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid rgba(15,45,63,.08); } .invite:first-child { border-top: 0; } .invite .t { display: grid; } .invite small { color: #6b7a85; } .invite .row { display: flex; gap: 6px; }
.newlink { display: grid; gap: 10px; margin-top: 4px; } .newlink input { width: 100%; font-size: 13px; padding: 10px; border-radius: 10px; border: 1px solid rgba(15,45,63,.15); background: #fff; } .newlink .row { display: flex; gap: 8px; flex-wrap: wrap; }
details.card summary { cursor: pointer; list-style: none; } details.card summary::-webkit-details-marker { display: none; } details.card summary::after { content: ' ▾'; color: #B8862B; }

/* Mot de passe oublié */
.forgot { margin: -4px 0 0; text-align: right; }
.rstbox:empty { display: none; }
.rstbox { margin-bottom: 14px; }
#rstbox .newlink { margin-top: 12px; }
.rstbox.card .newlink { margin-top: 0; }
.rstbox .newlink p { margin-top: 0; }
#rst { margin-top: 6px; }

/* Espace professeur en arabe (de droite à gauche) */
[dir=rtl] body { font-family: "Cairo", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 16px; }
[dir=rtl] .serif { font-family: "Amiri", var(--serif); font-weight: 700; letter-spacing: 0; }
[dir=rtl] .back svg, [dir=rtl] .composer .btn svg { transform: scaleX(-1); }
[dir=rtl] .card.hi { border-left: 0; border-right: 4px solid var(--ink); }
[dir=rtl] .card.pay { border-left: 0; border-right: 4px solid var(--gold); }
[dir=rtl] .bubble { border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
[dir=rtl] .bubble.mine { border-bottom-right-radius: 16px; border-bottom-left-radius: 5px; }
[dir=rtl] .forgot { text-align: left; }
[dir=rtl] .hint { letter-spacing: 0; }
input[dir=ltr] { text-align: left; }

/* Traduction des messages */
.bubble .tr { margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); color: var(--ink-soft); }
.bubble.mine .tr { color: #dce6ec; border-color: rgba(255,255,255,.25); }
.tr-btn { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.tr-btn:disabled { opacity: .6; cursor: wait; }
