/* ============================================================
   Personnalisation.fr — Styles globaux
   Inspirés de la maquette v2 (look SaaS pro)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@700;800&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --bleu-fonce: #083a60;
  --bleu-fonce-soft: #052643;
  --bleu-clair: #1b9bd8;
  --bleu-clair-hover: #1789c2;
  --bleu-clair-soft: rgba(27, 155, 216, 0.10);
  --gris-bg: #f5f7f9;
  --gris-card: #ffffff;
  --gris-border: #e3e8ed;
  --gris-texte: #6b7884;
  --gris-light: #eef2f5;
  --noir: #1a2026;
  --vert: #22b573;
  --vert-soft: rgba(34, 181, 115, 0.15);
  --rouge: #e74c3c;
  --orange: #f39c12;
  --orange-soft: rgba(243, 156, 18, 0.15);

  --shadow-sm: 0 1px 3px rgba(8, 58, 96, 0.06);
  --shadow-md: 0 4px 16px rgba(8, 58, 96, 0.08);
  --shadow-lg: 0 12px 40px rgba(8, 58, 96, 0.12);
}

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

html, body { min-height: 100%; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gris-bg);
  color: var(--noir);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'League Spartan', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ===== HEADER ===== */
.top-header {
  background: white;
  border-bottom: 1px solid var(--gris-border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.top-header-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
}
.top-header-brand img {
  height: 42px; width: 42px;
  object-fit: cover;
  border-radius: 8px;
}
.top-header-title {
  font-family: 'League Spartan', sans-serif;
  font-size: 18px; font-weight: 800;
  color: var(--bleu-fonce);
  letter-spacing: 0.02em;
}
.top-header-tag {
  font-size: 11px; color: var(--gris-texte);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-left: 8px;
}
.top-header-nav {
  display: flex; gap: 6px;
}
.top-header-nav a {
  text-decoration: none;
  color: var(--gris-texte);
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.15s;
}
.top-header-nav a:hover {
  background: var(--gris-light); color: var(--noir);
}

/* ===== LAYOUT ===== */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}
.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 28px; font-weight: 800;
  color: var(--bleu-fonce);
  margin-bottom: 6px;
}
.page-subtitle {
  color: var(--gris-texte); font-size: 14px;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--bleu-clair); text-decoration: none;
  font-size: 13px; font-weight: 600;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--bleu-fonce); }

/* ===== CARDS ===== */
.card {
  background: var(--gris-card);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gris-border);
  margin-bottom: 18px;
}
.card-title {
  font-size: 17px; font-weight: 700; color: var(--noir);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.card-subtitle {
  color: var(--gris-texte); font-size: 13px; margin-bottom: 18px;
}

/* ===== FORMULAIRES ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--noir); margin-bottom: 8px;
}
.form-label .req { color: var(--rouge); margin-left: 2px; }

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gris-border);
  border-radius: 10px;
  font-family: inherit; font-size: 14px;
  background: white;
  color: var(--noir);
  transition: all 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 3px rgba(27, 155, 216, 0.12);
}
.form-textarea { min-height: 100px; resize: vertical; }

.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ===== BOUTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-family: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--bleu-clair); color: white; }
.btn-primary:hover { background: var(--bleu-clair-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27,155,216,0.3); }
.btn-dark { background: var(--bleu-fonce); color: white; }
.btn-dark:hover { background: var(--bleu-fonce-soft); }
.btn-light { background: white; color: var(--noir); border: 1.5px solid var(--gris-border); }
.btn-light:hover { background: var(--gris-light); }
.btn-success { background: var(--vert); color: white; }
.btn-success:hover { background: #1d9b62; transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ===== SÉLECTEUR ENTITÉ ===== */
.entity-picker {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.entity-card {
  border: 2px solid var(--gris-border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  overflow: hidden;
  padding: 0;
  font-family: inherit;
  text-align: left;
  display: block;
  width: 100%;
}
.entity-card:hover {
  border-color: var(--bleu-clair);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.entity-card.selected {
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 4px rgba(27, 155, 216, 0.15);
}
.entity-card-logo {
  height: 80px; background: var(--bleu-fonce);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.entity-card-logo img { max-height: 100%; max-width: 100%; object-fit: contain; }
.entity-card-info { padding: 12px; text-align: center; }
.entity-card-name { font-size: 14px; font-weight: 700; color: var(--noir); }
.entity-card-meta { font-size: 11px; color: var(--gris-texte); margin-top: 2px; }

@media (max-width: 700px) {
  .entity-picker { grid-template-columns: 1fr; }
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 10px; border-radius: 5px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.badge-brodouest { background: rgba(123, 78, 191, 0.15); color: #7b4ebf; }
.badge-emap { background: rgba(27, 155, 216, 0.15); color: var(--bleu-clair); }
.badge-costard { background: rgba(8, 58, 96, 0.15); color: var(--bleu-fonce); }
.badge-status-prod { background: var(--orange-soft); color: var(--orange); }
.badge-status-done { background: var(--vert-soft); color: var(--vert); }
.badge-status-new { background: var(--bleu-clair-soft); color: var(--bleu-clair); }

/* ===== DOSSIER LIST (atelier) ===== */
.dossiers-list {
  display: flex; flex-direction: column; gap: 10px;
}
.dossier-row {
  background: white;
  border: 1.5px solid var(--gris-border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.dossier-row:hover { border-color: var(--bleu-clair); transform: translateX(2px); }
.dossier-row.selected { border-color: var(--bleu-clair); background: var(--bleu-clair-soft); }
.dossier-row-info { flex: 1; min-width: 0; }
.dossier-row-id { font-size: 13px; font-weight: 700; color: var(--bleu-fonce); }
.dossier-row-client { font-size: 14px; font-weight: 600; color: var(--noir); margin-top: 2px; }
.dossier-row-meta { font-size: 11px; color: var(--gris-texte); margin-top: 2px; }
.dossier-row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--bleu-clair);
  border-radius: 14px;
  padding: 36px 16px;
  text-align: center;
  background: var(--bleu-clair-soft);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  margin: 12px 0;
  user-select: none;
}
.upload-zone:hover { background: rgba(27, 155, 216, 0.18); }
.upload-zone.dragover {
  background: rgba(27, 155, 216, 0.25);
  border-color: var(--bleu-fonce);
}
.upload-zone-icon { font-size: 42px; line-height: 1; }
.upload-zone-text { font-size: 16px; font-weight: 700; color: var(--bleu-fonce); margin-top: 8px; }
.upload-zone-hint { font-size: 12px; color: var(--gris-texte); margin-top: 4px; }

.thumbs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin-top: 12px;
}
.thumb-uploaded {
  aspect-ratio: 1; border-radius: 10px;
  background: var(--gris-light);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border: 1px solid var(--gris-border);
}
.thumb-uploaded img { width: 100%; height: 100%; object-fit: cover; }
.thumb-uploaded .placeholder {
  font-size: 32px; color: var(--bleu-clair);
}

/* ===== ALERTES / MESSAGES ===== */
.alert {
  padding: 14px 18px; border-radius: 10px;
  background: var(--bleu-clair-soft);
  border-left: 3px solid var(--bleu-clair);
  margin: 12px 0; font-size: 13px;
  color: var(--bleu-fonce);
}
.alert.success {
  background: rgba(34, 181, 115, 0.08);
  border-left-color: var(--vert);
  color: #156d42;
}
.alert.error {
  background: rgba(231, 76, 60, 0.08);
  border-left-color: var(--rouge);
  color: #8e2a20;
}
.alert.warn {
  background: rgba(243, 156, 18, 0.08);
  border-left-color: var(--orange);
  color: #8e5a08;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--vert); color: white;
  padding: 14px 22px; border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
  max-width: 360px;
}
@keyframes slideIn {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}
.toast.error { background: var(--rouge); }
.toast.info  { background: var(--bleu-clair); }

/* ===== LOADER ===== */
.loader {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DETAILS LIST ===== */
.info-list dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--gris-texte); font-weight: 600;
  margin-top: 14px;
}
.info-list dt:first-child { margin-top: 0; }
.info-list dd {
  font-size: 14px; color: var(--noir);
  margin-top: 4px; font-weight: 500;
}

/* ===== GALERIE MEDIAS ===== */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.media-tile {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--gris-light);
  display: block; overflow: hidden;
  border: 1px solid var(--gris-border);
  transition: transform 0.15s;
  position: relative;
}
.media-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }

.media-tile-video {
  background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu-clair));
}
.video-overlay {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: white;
}
.video-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; padding-left: 4px;
}
.video-label { font-size: 12px; font-weight: 600; margin-top: 8px; }

/* ===== UTILITIES ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-gap { gap: 10px; }
.flex-between { justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .page { padding: 16px 12px 40px; }
  .top-header { padding: 10px 14px; }
  .top-header-title { font-size: 15px; }
  .top-header-tag { display: none; }
  .top-header-nav a { padding: 6px 10px; font-size: 12px; }
  .top-header-brand img { height: 36px; width: 36px; }

  .page-title { font-size: 22px; }
  .card { padding: 18px; border-radius: 12px; }
  .card-title { font-size: 15px; }

  .btn { padding: 12px 16px; font-size: 14px; }
  .btn-lg { padding: 14px 20px; font-size: 15px; }

  .entity-card-logo { height: 64px; padding: 10px; }
  .entity-card-info { padding: 10px; }

  .upload-zone { padding: 28px 12px; }
  .upload-zone-icon { font-size: 36px; }
  .upload-zone-text { font-size: 14px; }

  .media-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .thumbs-grid { grid-template-columns: repeat(3, 1fr); }

  .client-hero { padding: 20px; gap: 14px; }
  .client-hero-logo { max-height: 44px; max-width: 180px; }
  .client-hero-text h2 { font-size: 18px; }

  .dossier-row { padding: 12px 14px; }
  .dossier-row-side { width: 100%; justify-content: flex-start; margin-top: 4px; }

  .home-grid { gap: 12px; }
  .home-card { padding: 22px 18px; }
  .home-card .icon { font-size: 28px; margin-bottom: 10px; }
  .home-card h3 { font-size: 16px; }

  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* ===== ACCUEIL — Cards de navigation ===== */
.home-hero {
  text-align: center;
  padding: 24px 0 36px;
}
.home-hero h1 {
  font-size: 34px; color: var(--bleu-fonce);
  margin-bottom: 8px;
}
.home-hero p {
  color: var(--gris-texte); font-size: 15px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.home-card {
  background: white;
  border: 1.5px solid var(--gris-border);
  border-radius: 16px;
  padding: 28px 22px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  display: block;
  position: relative;
  overflow: hidden;
}
.home-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--bleu-clair);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s;
}
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--bleu-clair);
}
.home-card:hover::before { transform: scaleX(1); }
.home-card .icon {
  font-size: 36px; margin-bottom: 14px; display: block;
}
.home-card h3 {
  font-size: 18px; color: var(--bleu-fonce); margin-bottom: 6px;
}
.home-card p {
  font-size: 13px; color: var(--gris-texte); line-height: 1.5;
}
.home-card .arrow {
  display: inline-block; margin-top: 14px;
  color: var(--bleu-clair); font-weight: 600; font-size: 13px;
}

/* ===== CLIENT SPACE ===== */
.client-hero {
  background: var(--bleu-fonce);
  border-radius: 16px;
  padding: 28px 32px;
  color: white;
  margin-bottom: 24px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px; flex-wrap: wrap;
}
.client-hero-logo {
  max-height: 56px; max-width: 240px; object-fit: contain;
}
.client-hero-text h2 {
  font-size: 22px; margin-bottom: 4px;
  color: white;
}
.client-hero-text p {
  font-size: 13px; opacity: 0.85;
}
.client-secure-badge {
  background: rgba(34, 181, 115, 0.2);
  color: white;
  padding: 6px 12px; border-radius: 14px;
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}

/* ===== FOOTER ===== */
.app-footer {
  text-align: center;
  padding: 24px;
  color: var(--gris-texte);
  font-size: 12px;
}
.app-footer a { color: var(--bleu-clair); text-decoration: none; }
