/* ============================================================
   FRANCE UNIVE — Espace Étudiant
   ============================================================ */

:root {
  --bg:       #f4f7ff;
  --bg-card:  #ffffff;
  --bg-sec:   #eaefff;
  --blue:     #3b82f6;
  --blue-d:   #2563eb;
  --gold:     #d97706;
  --green:    #16a34a;
  --red:      #dc2626;
  --purple:   #7c3aed;
  --text:     #0f172a;
  --text-2:   #374151;
  --muted:    #6b7280;
  --border:   rgba(59,130,246,0.18);
  --radius:   12px;
  --font:     'Plus Jakarta Sans', sans-serif;
  --font-d:   'Ubuntu', sans-serif;
  --shadow:   0 4px 24px rgba(0,0,0,0.08);
  --topbar-h: 64px;
  --sidebar-w: 230px;
}

[data-theme="dark"] {
  --bg:      #05080f;
  --bg-card: #0a1220;
  --bg-sec:  #080d1a;
  --blue-d:  #60a5fa;
  --gold:    #f59e0b;
  --green:   #4ade80;
  --red:     #f87171;
  --purple:  #a78bfa;
  --text:    #f0f4ff;
  --text-2:  #c8d4f0;
  --muted:   #64748b;
  --border:  rgba(59,130,246,0.15);
  --shadow:  0 4px 40px rgba(0,0,0,0.35);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a    { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
select, textarea, input { font-family: var(--font); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.btn-sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.btn-sidebar-toggle:hover { background: var(--bg-sec); color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #818cf8);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-name { display: none; }
@media (min-width: 480px) { .user-name { display: block; } }

.btn-theme {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-sec);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-theme:hover { color: var(--blue); border-color: var(--blue); }
.btn-theme svg { width: 16px; height: 16px; }
#st-icon-sun  { display: none; }
[data-theme="dark"] #st-icon-sun  { display: block; }
[data-theme="dark"] #st-icon-moon { display: none; }

.btn-logout {
  font-size: 13px; color: var(--muted); padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  transition: all 0.2s;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); background: rgba(220,38,38,0.06); }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#auth-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(var(--topbar-h) + 40px) 20px 40px;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(59,130,246,0.08), transparent);
}

.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%; max-width: 450px;
  box-shadow: var(--shadow);
}

.auth-box h2 {
  font-family: var(--font-d);
  font-size: 22px; font-weight: 700;
  margin-bottom: 6px;
}

.auth-box > p {
  font-size: 13px; color: var(--muted); margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-sec);
  border-radius: 10px;
  padding: 4px; gap: 0;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1; padding: 9px;
  font-size: 13px; font-weight: 600;
  border-radius: 8px; color: var(--muted);
  transition: all 0.2s; text-align: center;
}
.auth-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

.auth-error {
  margin-bottom: 14px; font-size: 13px; color: var(--red);
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: 8px; padding: 9px 12px; display: none;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px; font-weight: 700;
  color: var(--text-2); letter-spacing: 0.03em;
}

.field-hint {
  font-size: 11px; color: var(--muted); margin-top: 3px;
}

.field input, .field select, .field textarea {
  background: var(--bg-sec);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 14px; color: var(--text);
  outline: none; width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field textarea { min-height: 100px; resize: vertical; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-submit {
  width: 100%; padding: 13px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #fff; font-size: 15px; font-weight: 700;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-submit:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-footer {
  margin-top: 20px; text-align: center;
  font-size: 12px; color: var(--muted);
}
.auth-footer a { color: var(--blue-d); cursor: pointer; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
#student-dashboard {
  display: none;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 12px;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.28s ease;
}

.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

.sidebar-nav {
  display: flex; flex-direction: column; gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--muted);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-sec); color: var(--text); }
.nav-item.active {
  background: rgba(59,130,246,0.1);
  color: var(--blue);
}

.main-content {
  margin-left: var(--sidebar-w);
  padding: 32px 28px 60px;
  transition: margin-left 0.28s ease;
  min-height: calc(100vh - var(--topbar-h));
  max-width: calc(var(--sidebar-w) + 900px);
}

.main-content.expanded { margin-left: 0; }

/* ============================================================
   PANELS
   ============================================================ */
.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head h1 {
  font-family: var(--font-d);
  font-size: 24px; font-weight: 700;
  margin-bottom: 4px;
}

.panel-sub { font-size: 14px; color: var(--muted); }

/* ============================================================
   TABLEAU DE BORD
   ============================================================ */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.dash-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.dash-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.dash-card-icon svg { width: 20px; height: 20px; }
.dash-card-icon.blue   { background: rgba(59,130,246,0.12); color: var(--blue); }
.dash-card-icon.purple { background: rgba(124,58,237,0.12); color: var(--purple); }
.dash-card-icon.gold   { background: rgba(217,119,6,0.12);  color: var(--gold); }

.dash-card-num {
  font-family: var(--font-d);
  font-size: 32px; font-weight: 700; line-height: 1;
  color: var(--text);
}
.dash-card-label { font-size: 13px; color: var(--muted); }

.info-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(59,130,246,0.07);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: var(--text-2); line-height: 1.6;
}
.info-banner svg { flex-shrink: 0; margin-top: 1px; color: var(--blue); }

/* ============================================================
   DOSSIER — TIMELINE
   ============================================================ */
.timeline {
  display: flex; flex-direction: column; gap: 0;
  margin-bottom: 24px;
}

.tl-step {
  display: flex; gap: 0; align-items: stretch;
}

.tl-left {
  display: flex; flex-direction: column; align-items: center;
  width: 40px; flex-shrink: 0;
}

.tl-dot {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
  z-index: 1;
  transition: all 0.2s;
}
.tl-dot.done    { background: var(--green);  border-color: var(--green);  color: #fff; }
.tl-dot.active  { background: var(--blue);   border-color: var(--blue);   color: #fff; }
.tl-dot.pending { background: var(--bg-sec); border-color: var(--border); color: var(--muted); }

.tl-line {
  width: 2px; flex: 1; min-height: 20px;
  background: var(--border);
  margin: 0 auto;
}
.tl-line.done { background: var(--green); }

.tl-step:last-child .tl-line { display: none; }

.tl-body {
  flex: 1; padding: 0 0 28px 16px;
}

.tl-title {
  font-weight: 700; font-size: 15px; line-height: 1;
  margin-bottom: 5px;
}
.tl-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }

.tl-select {
  background: var(--bg-sec);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2); outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.tl-select:focus { border-color: var(--blue); }

.dossier-note {
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 12px; padding: 14px 16px;
  font-size: 13px; color: var(--text-2); line-height: 1.6;
}
.dossier-note a { color: var(--blue-d); font-weight: 600; }

/* ============================================================
   DOCUMENTS
   ============================================================ */
.doc-list { display: flex; flex-direction: column; gap: 12px; }

.doc-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
}

.doc-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-icon.logement { background: rgba(59,130,246,0.1);  color: var(--blue); }
.doc-icon.pec      { background: rgba(124,58,237,0.1);  color: var(--purple); }
.doc-icon svg { width: 22px; height: 22px; }

.doc-info { flex: 1; }
.doc-info h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.doc-info p  { font-size: 12px; color: var(--muted); }

.doc-ref {
  font-size: 11px; font-family: monospace;
  color: var(--muted); background: var(--bg-sec);
  border-radius: 5px; padding: 2px 6px;
  margin-top: 4px; display: inline-block;
}

.btn-verify {
  font-size: 12px; font-weight: 700;
  color: var(--blue-d); padding: 7px 14px;
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 8px; flex-shrink: 0;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 5px;
}
.btn-verify:hover { background: rgba(59,130,246,0.08); }
.btn-verify svg { width: 13px; height: 13px; }

.doc-name-info {
  margin-top: 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  background: var(--bg-sec);
  border-radius: 8px; padding: 8px 12px;
}
.doc-name-info svg { flex-shrink: 0; }

/* ============================================================
   LOGEMENTS FAVORIS
   ============================================================ */
.listings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 600px)  { .listings-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .listings-grid { grid-template-columns: repeat(3, 1fr); } }

.listing-fav-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.2s;
}
.listing-fav-card:hover { box-shadow: var(--shadow); }

.lfc-head { display: flex; align-items: center; justify-content: space-between; }
.lfc-emoji { font-size: 28px; }

.btn-unfav {
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-unfav:hover { color: var(--red); background: rgba(220,38,38,0.08); }
.btn-unfav svg { width: 15px; height: 15px; }

.lfc-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.lfc-city  { font-size: 12px; color: var(--muted); }
.lfc-price { font-family: var(--font-d); font-size: 18px; font-weight: 700; color: var(--blue-d); }
.lfc-price span { font-size: 12px; color: var(--muted); font-weight: 400; }

.btn-outline-link {
  font-size: 13px; font-weight: 700; color: var(--blue-d);
  border: 1.5px solid rgba(59,130,246,0.3);
  border-radius: 9px; padding: 9px 18px;
  transition: all 0.2s; white-space: nowrap;
}
.btn-outline-link:hover { background: rgba(59,130,246,0.08); }

/* ============================================================
   MESSAGES / CONTACT
   ============================================================ */
.contact-grid {
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 32px;
}

@media (min-width: 600px) {
  .contact-grid { flex-direction: row; }
}

.contact-card {
  flex: 1;
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 16px; padding: 20px;
  cursor: pointer; color: var(--text);
  transition: all 0.22s;
}
.contact-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.contact-card.whatsapp:hover { border-color: #25d366; }
.contact-card.email:hover { border-color: var(--blue); }

.contact-icon {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--bg-sec);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.whatsapp .contact-icon { background: rgba(37,211,102,0.12); color: #25d366; }
.email    .contact-icon { background: rgba(59,130,246,0.12); color: var(--blue); }
.contact-icon svg { width: 22px; height: 22px; }

.contact-card h3 { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.contact-card p  { font-size: 12px; color: var(--muted); }
.contact-arrow { margin-left: auto; color: var(--muted); flex-shrink: 0; width: 18px; height: 18px; }

.msg-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.msg-form-wrap h3 {
  font-family: var(--font-d);
  font-size: 16px; font-weight: 700;
  margin-bottom: 20px;
}

#msg-history { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }

.msg-bubble {
  background: var(--bg-sec);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  font-size: 13px; line-height: 1.5;
}
.msg-bubble-meta {
  font-size: 11px; color: var(--muted); margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.msg-bubble-meta span { font-weight: 700; color: var(--blue-d); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 60px 20px;
  background: var(--bg-card);
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  grid-column: 1 / -1;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.btn-blue {
  display: inline-block;
  padding: 11px 22px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: #fff; font-size: 14px; font-weight: 700;
  transition: opacity 0.2s;
}
.btn-blue:hover { opacity: 0.88; }

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 20px;
  font-size: 13px; font-weight: 600; color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 2000; transition: transform 0.3s ease;
  white-space: nowrap; max-width: 90vw; text-align: center;
}
#toast.show    { transform: translateX(-50%) translateY(0); }
#toast.success { color: var(--green); border-color: rgba(22,163,74,0.25); }
#toast.error   { color: var(--red);   border-color: rgba(220,38,38,0.25); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px 16px 40px; }
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .dash-cards { grid-template-columns: 1fr 1fr; }
  .doc-item { flex-wrap: wrap; }
  .btn-verify { width: 100%; justify-content: center; }
}
