/* ============================================================
   ADMIN — Entreprise Multiple NG
   Palette assortie au site public
   ============================================================ */

:root {
  --dark:        #1A1A1A;
  --dark-2:      #252525;
  --dark-3:      #2F2F2F;
  --orange:      #E8B020;
  --orange-dark: #C8971A;
  --cream:       #F5F0E8;
  --white:       #FFFFFF;
  --gray:        #6B6B6B;
  --gray-light:  #B0B0B0;
  --border:      #E0D9C8;
  --error:       #DC3545;
  --success:     #28A745;
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.08);
  --shadow:      0 8px 24px rgba(0,0,0,0.12);
  --radius:      8px;
  --transition:  0.2s ease;
  --font:        'Montserrat', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

/* L'attribut HTML `hidden` doit toujours masquer l'élément, même s'il a un display: flex via une classe */
[hidden] { display: none !important; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea {
  font-family: var(--font);
  font-size: 0.95rem;
}
a { color: inherit; text-decoration: none; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--orange);
  color: var(--white);
}
.btn-primary:hover:not(:disabled) {
  background: var(--orange-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--white);
  color: var(--dark);
}
.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
}
.btn-danger:hover {
  background: var(--error);
  color: var(--white);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
}
.login-card {
  background: var(--white);
  padding: 48px 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 12px;
}
.login-card h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: var(--dark);
}
.login-subtitle {
  color: var(--gray);
  margin-bottom: 32px;
  line-height: 1.5;
}
.login-card .btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}
.login-help {
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--gray-light);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  margin-bottom: 8px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
}
.login-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--dark);
  transition: border-color var(--transition);
  font-family: inherit;
  font-size: 1rem;
}
.login-field input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,176,32,0.15);
}
.login-error {
  padding: 10px 14px;
  background: rgba(220,53,69,0.1);
  color: var(--error);
  border-radius: 6px;
  font-size: 0.88rem;
  text-align: center;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ----- En-tête ----- */
.admin-header {
  background: var(--dark);
  color: var(--white);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}
.admin-header-left, .admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
}
.admin-logo img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}
.admin-logo span {
  font-weight: 700;
  font-size: 1rem;
}

.save-status {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
}
.save-status.saved { color: var(--gray-light); }
.save-status.unsaved {
  background: rgba(232,176,32,0.2);
  color: var(--orange);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.user-email {
  color: var(--gray-light);
  font-size: 0.85rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu .btn-ghost {
  color: var(--gray-light);
  border-color: rgba(255,255,255,0.15);
}
.user-menu .btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

/* ----- Corps : sidebar + main ----- */
.admin-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ----- Sidebar ----- */
.admin-sidebar {
  width: 240px;
  background: var(--dark-2);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.admin-sidebar .tab {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition);
}
.admin-sidebar .tab:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
}
.admin-sidebar .tab.active {
  background: var(--orange);
  color: var(--white);
  font-weight: 600;
}
.admin-sidebar hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 12px 8px;
}
.tab-external {
  padding: 12px 16px;
  color: var(--gray-light);
  font-size: 0.85rem;
}
.tab-external:hover { color: var(--white); }

/* ----- Main ----- */
.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--cream);
}
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray);
}
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PANNEAUX (formulaires d'édition)
   ============================================================ */
/* ============================================================
   ONGLETS DE LANGUE (FR / EN) en haut de chaque section
   ============================================================ */
.lang-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--white);
  padding: 8px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.lang-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--gray);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
}
.lang-tab:hover { color: var(--dark); border-color: var(--dark-3); }
.lang-tab.active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}
.lang-tabs-hint {
  flex: 1;
  font-size: 0.82rem;
  color: var(--gray);
  margin-left: 12px;
}

/* ============================================================
   SECTIONS REPLIABLES (paramètres avancés)
   ============================================================ */
.advanced-toggle, .advanced-section {
  margin-top: 16px;
}
.advanced-toggle > summary,
.advanced-section > summary {
  cursor: pointer;
  padding: 10px 14px;
  background: var(--cream);
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray);
  list-style: none;
  user-select: none;
  transition: all var(--transition);
}
.advanced-toggle > summary::before,
.advanced-section > summary::before {
  content: '▸ ';
  display: inline-block;
  margin-right: 6px;
  transition: transform var(--transition);
}
.advanced-toggle[open] > summary::before,
.advanced-section[open] > summary::before {
  content: '▾ ';
}
.advanced-toggle > summary:hover,
.advanced-section > summary:hover {
  background: var(--white);
  border-color: var(--orange);
  color: var(--dark);
}
.advanced-hint {
  color: var(--gray-light);
  font-weight: 400;
  font-size: 0.82rem;
}

.pane-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.pane-header h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.pane-header p {
  color: var(--gray);
  font-size: 0.9rem;
}

.field-group {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.field-group h3 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}
.field-row.single { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .field-row { grid-template-columns: 1fr; gap: 12px; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field label .lang-tag {
  background: var(--orange);
  color: var(--white);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
}
.field label .lang-tag.en { background: var(--dark-3); }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--dark);
  transition: border-color var(--transition);
  font-family: inherit;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,176,32,0.15);
}
.field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}
.field-hint {
  font-size: 0.78rem;
  color: var(--gray-light);
}

/* ----- Image preview / upload ----- */
.image-field {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: var(--cream);
  border-radius: 6px;
  border: 1px dashed var(--border);
}
.image-field .img-preview {
  width: 120px;
  height: 90px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-light);
}
.image-field .img-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-field .img-info {
  flex: 1;
  min-width: 0;
}
.image-field .img-info .img-path {
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--gray);
  word-break: break-all;
  margin-bottom: 8px;
}
.image-field .img-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   LISTES (Services, Portfolio, Témoignages, Stats, Valeurs)
   ============================================================ */
.list-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.list-item-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
}
.list-item-header .item-actions {
  display: flex;
  gap: 6px;
}
.list-item-handle {
  cursor: grab;
  color: var(--gray-light);
  padding: 0 8px;
}
.list-item-handle:active { cursor: grabbing; }

.btn-add-item {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--gray);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}
.btn-add-item:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(232,176,32,0.04);
}

/* ============================================================
   MODAL D'UPLOAD
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--white);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--gray);
  cursor: pointer;
  line-height: 1;
}
.modal-card h3 {
  margin-bottom: 20px;
}

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--gray);
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--orange);
  background: rgba(232,176,32,0.04);
  color: var(--orange-dark);
}
.dropzone-content svg {
  margin: 0 auto 12px;
  display: block;
}
.dropzone-content small {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--gray-light);
}

.upload-progress {
  margin-top: 20px;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--orange);
  width: 0%;
  transition: width 0.3s ease;
}
.upload-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(220,53,69,0.1);
  color: var(--error);
  border-radius: 6px;
  font-size: 0.88rem;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 2000;
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .admin-body { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
  }
  .admin-sidebar .tab {
    padding: 8px 14px;
    white-space: nowrap;
    font-size: 0.85rem;
  }
  .admin-sidebar hr,
  .tab-external { display: none; }
  .admin-main { padding: 20px; }
  .admin-header { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .admin-header-right { flex-wrap: wrap; }
  .user-menu { padding-left: 0; border-left: none; }
}
