/* ─────────────────────────────────────────────────────────────────
   MY RENOV — Admin styles
   Mobile-first, accessible, touch targets >= 44px, contrast >= 4.5:1
   ───────────────────────────────────────────────────────────────── */

:root {
  --mr-bg: #f5f6f8;
  --mr-card: #ffffff;
  --mr-primary: #00685b;
  --mr-primary-dark: #004d44;
  --mr-primary-light: #2b8273;
  --mr-text: #1b1c1c;
  --mr-text-muted: #5a6570;
  --mr-border: #e1eae8;
  --mr-danger: #c53030;
  --mr-danger-dark: #9b2424;
  --mr-success: #2f855a;
  --mr-warning: #b7791f;
  --mr-shadow: 0 4px 16px rgba(27, 28, 28, 0.08);
  --mr-shadow-lg: 0 12px 40px rgba(27, 28, 28, 0.12);
  --mr-radius: 0.5rem;
  --mr-radius-lg: 0.75rem;
}

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

body.mr-admin {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  color: var(--mr-text);
  background: var(--mr-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--mr-primary); text-decoration: none; }
a:hover { color: var(--mr-primary-dark); text-decoration: underline; }

/* ─── Reduced motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Admin Header ────────────────────────────────────────────────── */
.mr-header {
  background: var(--mr-card);
  border-bottom: 1px solid var(--mr-border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.mr-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.mr-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--mr-text);
  font-size: 1.05rem;
}
.mr-logo img { height: 36px; width: auto; }
.mr-logo-label {
  font-size: 0.7rem;
  color: var(--mr-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.mr-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mr-user-email {
  font-size: 0.85rem;
  color: var(--mr-text-muted);
  display: none;
}
@media (min-width: 600px) {
  .mr-user-email { display: inline; }
}

/* ─── Navigation ──────────────────────────────────────────────────── */
.mr-nav {
  background: var(--mr-card);
  border-bottom: 1px solid var(--mr-border);
}
.mr-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.mr-nav a {
  padding: 14px 18px;
  color: var(--mr-text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color 0.2s, border-color 0.2s;
}
.mr-nav a:hover { color: var(--mr-primary); }
.mr-nav a.active {
  color: var(--mr-primary);
  border-bottom-color: var(--mr-primary);
}

/* ─── Main content ────────────────────────────────────────────────── */
.mr-main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px;
}
.mr-page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--mr-text);
  margin: 0 0 8px 0;
}
.mr-page-subtitle {
  color: var(--mr-text-muted);
  margin: 0 0 32px 0;
  font-size: 1rem;
}
@media (min-width: 768px) {
  .mr-page-title { font-size: 2.2rem; }
}

/* ─── Cards ───────────────────────────────────────────────────────── */
.mr-card {
  background: var(--mr-card);
  border-radius: var(--mr-radius-lg);
  padding: 24px;
  box-shadow: var(--mr-shadow);
  margin-bottom: 24px;
}
.mr-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  color: var(--mr-text);
}

/* ─── Stats grid (dashboard) ──────────────────────────────────────── */
.mr-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.mr-stat-card {
  background: var(--mr-card);
  padding: 24px;
  border-radius: var(--mr-radius-lg);
  box-shadow: var(--mr-shadow);
}
.mr-stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mr-text-muted);
  font-weight: 600;
}
.mr-stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  color: var(--mr-primary);
  margin-top: 8px;
  line-height: 1;
}

/* ─── Buttons (44x44 min, accessible) ─────────────────────────────── */
.mr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 22px;
  border-radius: var(--mr-radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  line-height: 1;
}
.mr-btn:focus-visible {
  outline: 3px solid var(--mr-primary-light);
  outline-offset: 2px;
}
.mr-btn:active { transform: translateY(1px); }
.mr-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.mr-btn-primary {
  background: var(--mr-primary);
  color: white;
}
.mr-btn-primary:hover:not([disabled]) {
  background: var(--mr-primary-dark);
  color: white;
  text-decoration: none;
}
.mr-btn-secondary {
  background: var(--mr-card);
  color: var(--mr-text);
  border-color: var(--mr-border);
}
.mr-btn-secondary:hover:not([disabled]) {
  background: var(--mr-bg);
  text-decoration: none;
}
.mr-btn-danger {
  background: var(--mr-danger);
  color: white;
}
.mr-btn-danger:hover:not([disabled]) {
  background: var(--mr-danger-dark);
  color: white;
  text-decoration: none;
}
.mr-btn-sm {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 0.85rem;
}
.mr-btn-block {
  width: 100%;
}

/* Spinner inline pour buttons en chargement */
.mr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: mr-spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes mr-spin { to { transform: rotate(360deg); } }

/* ─── Forms (labels visibles, inputs >= 44px) ─────────────────────── */
.mr-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
}
.mr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mr-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--mr-text);
}
.mr-label-required::after {
  content: ' *';
  color: var(--mr-danger);
}
.mr-helper {
  font-size: 0.82rem;
  color: var(--mr-text-muted);
  margin-top: 2px;
}
.mr-input, .mr-textarea, .mr-select {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--mr-border);
  border-radius: var(--mr-radius);
  font-family: inherit;
  font-size: 1rem;
  background: var(--mr-card);
  color: var(--mr-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.mr-input:focus, .mr-textarea:focus, .mr-select:focus {
  outline: none;
  border-color: var(--mr-primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 91, 0.15);
}
.mr-textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.mr-field-error .mr-input,
.mr-field-error .mr-textarea,
.mr-field-error .mr-select { border-color: var(--mr-danger); }
.mr-error-msg {
  color: var(--mr-danger);
  font-size: 0.82rem;
  margin-top: 4px;
  font-weight: 500;
}
.mr-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ─── Tables (desktop) / Cards (mobile) ───────────────────────────── */
.mr-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mr-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--mr-card);
  border-radius: var(--mr-radius-lg);
  overflow: hidden;
  box-shadow: var(--mr-shadow);
}
.mr-table th, .mr-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--mr-border);
}
.mr-table th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mr-text-muted);
  background: var(--mr-bg);
}
.mr-table tr:last-child td { border-bottom: 0; }
.mr-table tr:hover td { background: var(--mr-bg); }

/* Status badges */
.mr-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mr-badge-published { background: #d4edda; color: #155724; }
.mr-badge-draft { background: #fff3cd; color: #5c4500; }

/* Mobile cards (used when table doesn't fit) */
.mr-realisation-card {
  background: var(--mr-card);
  border-radius: var(--mr-radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--mr-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mr-realisation-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.mr-realisation-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--mr-radius);
  object-fit: cover;
  background: var(--mr-bg);
  flex-shrink: 0;
}

/* ─── Empty state ─────────────────────────────────────────────────── */
.mr-empty {
  text-align: center;
  padding: 60px 24px;
  background: var(--mr-card);
  border-radius: var(--mr-radius-lg);
  box-shadow: var(--mr-shadow);
}
.mr-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px auto;
  color: var(--mr-primary);
  opacity: 0.7;
}
.mr-empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--mr-text);
}
.mr-empty-message {
  color: var(--mr-text-muted);
  margin: 0 0 24px 0;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Skeleton loaders ────────────────────────────────────────────── */
.mr-skeleton-card {
  background: var(--mr-card);
  padding: 16px;
  border-radius: var(--mr-radius-lg);
  margin-bottom: 12px;
  box-shadow: var(--mr-shadow);
}
.mr-skeleton-img, .mr-skeleton-line {
  background: linear-gradient(90deg, #e8e8e8 0%, #f0f0f0 50%, #e8e8e8 100%);
  background-size: 200% 100%;
  animation: mr-shimmer 1.6s linear infinite;
  border-radius: 6px;
}
.mr-skeleton-img { aspect-ratio: 4/3; margin-bottom: 12px; }
.mr-skeleton-line { height: 14px; margin-bottom: 8px; }
.mr-skeleton-line.mr-w-80 { width: 80%; }
.mr-skeleton-line.mr-w-60 { width: 60%; }
@keyframes mr-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ─── Toast notifications ─────────────────────────────────────────── */
#mr-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 40px);
}
@media (max-width: 600px) {
  #mr-toast-container { top: auto; bottom: 20px; left: 20px; right: 20px; align-items: stretch; }
}
.mr-toast {
  background: var(--mr-card);
  padding: 14px 20px;
  border-radius: var(--mr-radius);
  box-shadow: var(--mr-shadow-lg);
  border-left: 4px solid var(--mr-primary);
  font-size: 0.95rem;
  font-weight: 500;
  max-width: 380px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
}
@media (max-width: 600px) {
  .mr-toast { max-width: 100%; transform: translateY(20px); }
}
.mr-toast-visible { opacity: 1; transform: translateX(0); }
@media (max-width: 600px) {
  .mr-toast-visible { transform: translateY(0); }
}
.mr-toast-success { border-left-color: var(--mr-success); }
.mr-toast-error { border-left-color: var(--mr-danger); }
.mr-toast-info { border-left-color: var(--mr-primary); }

/* ─── Modal de confirmation ───────────────────────────────────────── */
.mr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 28, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: mr-fadein 0.2s ease;
}
.mr-modal {
  background: var(--mr-card);
  border-radius: var(--mr-radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--mr-shadow-lg);
  animation: mr-slidein 0.25s ease;
}
.mr-modal h3 {
  margin: 0 0 12px 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--mr-text);
}
.mr-modal p {
  color: var(--mr-text-muted);
  margin: 0 0 24px 0;
  line-height: 1.6;
}
.mr-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
@keyframes mr-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes mr-slidein { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── Upload dropzone (redesign v3) ───────────────────────────────── */
.mr-upload-block {
  border: 2px dashed rgba(0,104,91,0.35);
  border-radius: 12px;
  background: #f8fafb;
  padding: 16px;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.mr-upload-block.dragover {
  border-color: var(--mr-primary);
  background: #eaf3f1;
  box-shadow: inset 0 0 0 2px rgba(0,104,91,0.15);
}

.mr-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  width: 100%;
  box-sizing: border-box;
  min-height: auto;
}
.mr-dropzone:hover {
  background: rgba(255,255,255,0.95);
}
.mr-dropzone-icon-wrap {
  width: 52px;
  height: 52px;
  background: var(--mr-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0,104,91,0.2);
  transition: transform 0.3s cubic-bezier(.2,.7,.2,1);
  flex-shrink: 0;
}
.mr-dropzone:hover .mr-dropzone-icon-wrap {
  transform: scale(1.06);
}
.mr-dropzone-icon-wrap svg {
  width: 24px;
  height: 24px;
  color: white;
  stroke: white;
}
.mr-dropzone-title {
  font-family: 'Manrope', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--mr-text);
  margin: 0 0 4px 0;
}
.mr-dropzone-subtitle {
  font-size: 0.85rem;
  color: var(--mr-text-muted);
  margin: 0 0 12px 0;
}
.mr-dropzone-formats {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--mr-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.mr-format-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: rgba(0,104,91,0.08);
  color: var(--mr-primary);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mr-dropzone-input { display: none; }

.mr-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.mr-photo-preview-grid:empty { display: none; }
.mr-preview-divider {
  height: 1px;
  background: rgba(0,104,91,0.12);
  margin: 24px 0 4px 0;
  display: none;
}
.mr-upload-block:has(.mr-photo-preview-grid:not(:empty)) .mr-preview-divider {
  display: block;
}
.mr-preview-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--mr-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  display: none;
}
.mr-upload-block:has(.mr-photo-preview-grid:not(:empty)) .mr-preview-label {
  display: block;
}

@media (max-width: 600px) {
  .mr-dropzone { padding: 40px 16px; min-height: 200px; }
  .mr-dropzone-icon-wrap { width: 72px; height: 72px; margin-bottom: 18px; }
  .mr-dropzone-icon-wrap svg { width: 32px; height: 32px; }
  .mr-dropzone-title { font-size: 1.15rem; }
}
.mr-photo-preview {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--mr-radius);
  overflow: hidden;
  background: var(--mr-bg);
  box-shadow: var(--mr-shadow);
}
.mr-photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mr-photo-preview .mr-photo-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
}
.mr-photo-preview .mr-photo-progress-bar {
  height: 100%;
  background: var(--mr-primary);
  width: 0;
  transition: width 0.2s;
}
.mr-photo-preview .mr-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  background: rgba(27, 28, 28, 0.7);
  color: white;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mr-photo-preview .mr-photo-remove:hover { background: rgba(27, 28, 28, 0.9); }
.mr-photo-preview .mr-photo-remove:focus-visible { outline: 3px solid var(--mr-primary-light); outline-offset: 2px; }

/* ─── Login page (special, sans header/nav) ───────────────────────── */
.mr-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1b1c1c 0%, #00685b 100%);
  padding: 20px;
}
.mr-login-box {
  background: var(--mr-card);
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: var(--mr-shadow-lg);
  max-width: 420px;
  width: 100%;
}
.mr-login-logo {
  display: block;
  margin: 0 auto 24px auto;
  height: 64px;
  width: auto;
}
.mr-login-title {
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--mr-text);
  margin: 0 0 8px 0;
}
.mr-login-subtitle {
  text-align: center;
  color: var(--mr-text-muted);
  font-size: 0.92rem;
  margin: 0 0 32px 0;
}
.mr-login-back {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 0.88rem;
  color: var(--mr-text-muted);
}

/* ─── Layout utilities ────────────────────────────────────────────── */
.mr-flex { display: flex; }
.mr-flex-between { display: flex; justify-content: space-between; align-items: center; }
.mr-flex-wrap { flex-wrap: wrap; }
.mr-gap-12 { gap: 12px; }
.mr-mt-24 { margin-top: 24px; }
.mr-mb-24 { margin-bottom: 24px; }
.mr-text-muted { color: var(--mr-text-muted); }
.mr-text-center { text-align: center; }

/* ─── Responsive hidden ───────────────────────────────────────────── */
.mr-hide-mobile { display: none; }
.mr-show-mobile { display: block; }
@media (min-width: 768px) {
  .mr-hide-mobile { display: block; }
  .mr-show-mobile { display: none; }
}
