/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* Auth */
.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Layout principal */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 0.8rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.app-main {
  padding: 1rem;
  flex: 1;
}

/* Cards & champs */
.card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.75rem;
  padding: 1rem 1.2rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.card + .card {
  margin-top: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.field span {
  color: #9ca3af;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
  border-radius: 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
  padding: 0.65rem 0.75rem;
  color: #e5e7eb;
  font-size: 1rem;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

/* Boutons */
.btn {
  border-radius: 999px;
  border: none;
  padding: 0.65rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: rgba(30, 64, 175, 0.12);
  color: #e5e7eb;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  border-color: transparent;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.8);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(248, 113, 113, 0.7);
}

.btn-small {
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
}

.btn-full {
  width: 100%;
}

/* Alertes & badges */
.alert {
  border-radius: 0.6rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

.alert-error {
  background: rgba(127, 29, 29, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.7);
  color: #fecaca;
}

.alert-info {
  background: rgba(30, 64, 175, 0.2);
  border: 1px solid rgba(129, 140, 248, 0.7);
  color: #e0e7ff;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}

.badge-status-N {
  background: rgba(31, 41, 55, 0.9);
  color: #c1ccdf;
}

/* Paris (A) = priorité haute : mis en avant, lisible */
.badge-status-A {
  background: rgba(202,185, 30,1);
  color: #000;
  font-weight: 600;
}

/* Vente physique (B) = priorité moyenne */
.badge-status-B {
  background: rgba(59, 130, 246, 1);
  color: #abc7e8;
}

/* Lot marchand (C) = priorité basse : discret, pas de couleur chaude */
.badge-status-C {
  background: rgba(75, 85, 99, 1);
  color: #9ca3af;
}

/* Liste des objets */
.items-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.8rem;
}

.items-help {
  font-size: 0.8rem;
  color: #9ca3af;
  margin: -0.2rem 0 0.6rem;
  text-align: center;
}

.batch-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: rgba(59, 130, 246, 0.12);
  border-radius: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.batch-progress-text {
  font-size: 0.9rem;
  color: #93c5fd;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.batch-result {
  font-size: 0.8rem;
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

.items-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: fixed;
}

.items-table th,
.items-table td {
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.8);
}

.items-table .col-desirability {
  max-width: 1px;
  width: 22%;
  font-size: 0.75rem;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
}

.items-table .badge-desirability {
  font-size: inherit;
  white-space: normal;
  line-height: 1.25;
  display: inline-block;
  max-width: 100%;
}

.items-table th {
  text-align: left;
  color: #9ca3af;
  font-weight: 500;
}

.items-table tr:hover {
  background: rgba(15, 23, 42, 0.75);
}

.item-row {
  cursor: pointer;
}

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 0.6rem;
  object-fit: cover;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Galerie photos */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.photo-slot {
  border-radius: 0.7rem;
  border: 1px dashed rgba(148, 163, 184, 0.4);
  padding: 0.6rem;
  text-align: center;
  font-size: 0.85rem;
}

.photo-slot-title {
  margin-bottom: 0.3rem;
  color: #c8e73e;
}

.photo-slot img {
  margin: 0 auto 0.3rem;
}

.photo-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.photo-actions {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

@media (max-width: 640px) {
  .photos-grid {
    grid-template-columns: 1fr;
  }
}

/* Bloc IA */
.ai-edit-form .field {
  margin-bottom: 0.8rem;
}

.ai-result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.ai-row-label {
  color: #9ca3af;
  font-size: 0.75rem;
}

.ai-row-value {
  margin-top: 0.1rem;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

.ai-estimate {
  font-weight: 600;
}

.ai-meta {
  font-size: 0.75rem;
  color: #9ca3af;
}

.ai-raw-wrap {
  margin-top: 0.75rem;
  grid-column: 1 / -1;
}

.ai-raw-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #93c5fd;
}

.ai-raw-json {
  margin-top: 0.4rem;
  padding: 0.5rem;
  font-size: 0.7rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.4rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow: auto;
}

/* Utilitaires */
.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-sm {
  gap: 1.4rem;
}

.mt-sm {
  margin-top: 0.6rem;
}

.mt-md {
  margin-top: 1rem;
}

.text-right {
  text-align: right;
}

@media (min-width: 768px) {
  .app-main {
    max-width: 800px;
    margin: 0 auto;
  }
}

