/* ============================================================
   APPARTEMENTS MEUBLÉS — Administration (styles)
   ============================================================ */

:root {
  --navy: #0f2c3f;
  --navy-2: #123b53;
  --gold: #c9a54e;
  --gold-2: #b8923c;
  --ink: #1c2530;
  --muted: #64707c;
  --line: #e4e8ec;
  --bg: #eef2f4;
  --white: #ffffff;

  --ok: #1f9d55;   --ok-bg: #e5f6ec;
  --busy: #d9534f; --busy-bg: #fbeaea;
  --work: #e08a1e; --work-bg: #fbf1e0;
  --danger: #d9534f;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 44, 63, .10);
  --shadow-lg: 0 24px 60px rgba(15, 44, 63, .24);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
h1, h2 { font-family: "Playfair Display", serif; }
input, select, textarea, button { font-family: inherit; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  font-weight: 600; font-size: .92rem; cursor: pointer;
  border: 1.5px solid transparent; transition: all .18s ease; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-2); }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-outline:hover:not(:disabled) { border-color: var(--navy); }
.btn-danger { background: transparent; color: var(--danger); border-color: #f0c9c8; }
.btn-danger:hover:not(:disabled) { background: var(--busy-bg); }
.btn-sm { padding: 7px 13px; font-size: .82rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Champs ---------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: .84rem; font-weight: 600; color: var(--ink); }
.form-group label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: .94rem; color: var(--ink); background: #fff; width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; }
.file-input { padding: 9px; background: var(--bg); border-style: dashed; cursor: pointer; }

.form-status { font-size: .86rem; min-height: 20px; }
.form-status.error { color: var(--busy); }

/* ============================================================
   Page de connexion
   ============================================================ */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 500px at 70% -10%, #1b4a68, var(--navy));
}
.login-shell { width: 100%; max-width: 400px; }
.login-card {
  background: #fff; border-radius: 18px; padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.login-full-logo { width: 100%; max-width: 240px; height: auto; }
.login-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--gold); color: var(--navy);
  font-family: "Playfair Display", serif; font-weight: 800; font-size: 1.6rem;
  border-radius: 12px; flex: 0 0 auto;
}
.login-brand { display: flex; flex-direction: column; font-weight: 700; color: var(--navy); line-height: 1.15; }
.login-brand span { font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: .05em; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 6px; color: var(--navy); }
.login-sub { color: var(--muted); font-size: .9rem; margin: 0 0 24px; }
.login-card .form-group { margin-bottom: 16px; }
.login-forgot { text-align: center; margin: 16px 0 0; }
.login-forgot a { color: var(--muted); font-size: .86rem; text-decoration: none; }
.login-forgot a:hover { color: var(--navy); text-decoration: underline; }
.reset-request .reset-request-hint { font-size: .86rem; color: var(--muted); margin: 0 0 14px; }
.reset-request .form-group { margin-bottom: 14px; }
.reset-request .btn-outline { margin-top: 8px; }
.login-foot { text-align: center; margin-top: 18px; }
.login-foot a { color: rgba(255, 255, 255, .85); font-size: .86rem; text-decoration: none; }
.login-foot a:hover { color: #fff; }

/* ============================================================
   Barre supérieure admin
   ============================================================ */
.admin-top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.admin-top-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 22px; height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.admin-logo { display: flex; align-items: center; gap: 11px; }
.admin-logo .brand-logo {
  width: 44px; height: 40px; object-fit: contain;
  background: #fff; border-radius: 9px; padding: 4px 5px; flex: 0 0 auto;
}
.admin-logo-text { font-weight: 700; }
.admin-logo-text small { display: block; font-size: .68rem; font-weight: 500; color: rgba(255, 255, 255, .6); }
.admin-nav { display: flex; gap: 6px; margin-left: 8px; }
.admin-nav-link { padding: 7px 15px; border-radius: 999px; font-size: .9rem; font-weight: 500; color: rgba(255, 255, 255, .8); transition: background .2s, color .2s; }
.admin-nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-nav-link.active { background: var(--gold); color: var(--navy); font-weight: 600; }
.admin-top-right { display: flex; align-items: center; gap: 10px; }
.admin-user { font-size: .84rem; color: rgba(255, 255, 255, .8); }
.admin-top .btn-outline { color: #fff; border-color: rgba(255, 255, 255, .3); }
.admin-top .btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .55); }

/* ---------- Contenu ---------- */
.admin-main { padding: 30px 0 60px; }
.admin-container { max-width: 1200px; margin: 0 auto; padding: 0 22px; }

/* Statistiques */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border-left: 4px solid var(--navy);
  display: flex; flex-direction: column;
}
.stat-card.ok { border-left-color: var(--ok); }
.stat-card.busy { border-left-color: var(--busy); }
.stat-card.work { border-left-color: var(--work); }
.stat-num { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-lbl { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.admin-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.admin-head h1 { font-size: 1.6rem; color: var(--navy); margin: 0 0 4px; }
.admin-head-sub { color: var(--muted); font-size: .9rem; margin: 0; max-width: 620px; }

/* Barre d'outils */
.admin-toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.type-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.type-tab {
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: .86rem; font-weight: 500; cursor: pointer;
  transition: all .16s;
}
.type-tab:hover { border-color: var(--gold); }
.type-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.admin-search { max-width: 300px; }

/* Table */
.admin-table-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; padding: 14px 16px;
  border-bottom: 1px solid var(--line); background: #fafbfc;
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfc; }

.thumb-cell { position: relative; width: 76px; }
.table-thumb { width: 60px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.table-thumb-ph {
  width: 60px; height: 44px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1b4a68, var(--navy)); font-size: 1.2rem;
}
.thumb-media { display: block; font-size: .68rem; color: var(--muted); margin-top: 3px; }
.ref-cell { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.title-cell { font-weight: 600; color: var(--navy); }
.title-cell small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.apt-code { color: var(--gold-2); font-weight: 600; }
.type-pill { background: var(--bg); border-radius: 999px; padding: 4px 11px; font-size: .8rem; white-space: nowrap; }

.statut-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.statut-badge small { font-weight: 400; }
.statut-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.s-disponible { background: var(--ok-bg); color: var(--ok); }
.s-occupe { background: var(--busy-bg); color: var(--busy); }
.s-travaux { background: var(--work-bg); color: var(--work); }
.r-en_attente { background: var(--work-bg); color: var(--work); }
.r-confirmee { background: var(--ok-bg); color: var(--ok); }
.r-refusee { background: var(--busy-bg); color: var(--busy); }
.r-annulee { background: #eef1f3; color: var(--muted); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ============================================================
   Modale formulaire
   ============================================================ */
.admin-modal {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: flex-start; justify-content: center; padding: 30px 20px;
  background: rgba(15, 44, 63, .55); overflow-y: auto;
}
.admin-modal.open { display: flex; }
.admin-modal-dialog {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 720px;
  box-shadow: var(--shadow-lg); animation: pop .2s ease; margin: auto;
}
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.admin-modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.admin-modal-head h2 { font-size: 1.25rem; color: var(--navy); margin: 0; }
.modal-x { background: none; border: none; font-size: 1.7rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--navy); }

.admin-form { padding: 22px 24px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }

/* Grille des 3 plans tarifaires (formulaire) */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.price-field { position: relative; }
.price-field .price-period {
  position: absolute; top: -9px; left: 10px; padding: 0 6px;
  background: #fff; font-size: .72rem; font-weight: 600; color: var(--gold-2);
}
/* Cellule prix (table) */
.price-cell .price-line { display: block; font-weight: 600; color: var(--navy); font-size: .86rem; white-space: nowrap; }
.price-cell .price-line small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.muted { color: var(--muted); }

.media-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.media-item {
  position: relative; width: 92px; height: 68px; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--line); background: var(--bg);
}
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item.is-new { border-color: var(--gold); }
.media-item.is-video {
  width: auto; min-width: 140px; max-width: 260px; height: auto; padding: 10px 30px 10px 12px;
  display: flex; align-items: center; font-size: .82rem; color: var(--ink);
  border-radius: 8px; overflow: visible;
}
.remove-badge {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  background: rgba(15, 44, 63, .85); color: #fff; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem; line-height: 1; cursor: pointer;
}
.remove-badge:hover { background: var(--danger); }

.admin-modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; gap: 18px; }
  .admin-user { display: none; }
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { border-bottom: 8px solid var(--bg); padding: 6px 0; }
  .admin-table td { border: none; padding: 6px 16px; }
  .thumb-cell { width: auto; }
}
