/* ============================================================
   style.css — Charte urbaine sombre pour Salles Racines Carrées
   Palette : noir profond, gris anthracite, accents urbains
   Layout : CSS Grid + Flexbox, responsive 1/2/3 colonnes
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg-primary:    #111111;
  --bg-secondary:  #1a1a1a;
  --bg-card:       #222222;
  --bg-hover:      #2c2c2c;
  --bg-input:      #1e1e1e;
  --border:        #333333;
  --border-light:  #3a3a3a;
  --text-primary:  #e0e0e0;
  --text-secondary:#999999;
  --text-muted:    #666666;
  --accent:        #ff8c42;
  --accent-hover:  #ffa060;
  --danger:        #e74c3c;
  --danger-hover:  #c0392b;
  --success:       #27ae60;
  --blue:          #3498db;
  --type-theatre:  #9b59b6;
  --type-concert:  #e67e22;
  --type-multi:    #2ecc71;
  --type-autre:    #95a5a6;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 2px 8px rgba(0,0,0,0.3);
  --transition:    0.15s ease;
}

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

html, body {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* ── Navigation ──────────────────────────────────────────────── */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand a {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-brand a:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-logout {
  color: var(--danger) !important;
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ── Flash Messages ──────────────────────────────────────────── */
.flash-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px 0;
}

.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.flash-success {
  background: rgba(39, 174, 96, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

.flash-error {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.flash-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── Filters ──────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-input,
.filter-select {
  width: 100%;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.required {
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.form-title {
  font-size: 22px;
  margin-bottom: 20px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-accent {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

/* ── Salles Grid ──────────────────────────────────────────────── */
.salles-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.salles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ── Salle Card ──────────────────────────────────────────────── */
.salle-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.salle-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.salle-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.salle-nom {
  font-size: 16px;
  font-weight: 600;
}

.salle-nom a {
  color: var(--text-primary);
}

.salle-nom a:hover {
  color: var(--accent);
}

.salle-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.salle-type-théâtre { background: rgba(155, 89, 182, 0.2); color: var(--type-theatre); }
.salle-type-concert  { background: rgba(230, 126, 34, 0.2); color: var(--type-concert); }
.salle-type-multi   { background: rgba(46, 204, 113, 0.2); color: var(--type-multi); }
.salle-type-autre   { background: rgba(149, 165, 166, 0.2); color: var(--type-autre); }

.salle-card-body {
  flex: 1;
  margin-bottom: 12px;
}

.salle-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.salle-info a {
  color: var(--blue);
}

.salle-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Status Badges ────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Status Email */
.status-email-vérifié { background: rgba(46, 204, 113, 0.2); color: var(--success); }
.status-email-générique { background: rgba(241, 196, 15, 0.2); color: #f1c40f; }
.status-email-à_vérifier { background: rgba(155, 89, 182, 0.2); color: var(--type-theatre); }
.status-email-inconnu { background: rgba(149, 165, 166, 0.2); color: var(--type-autre); }

/* Status Prospection */
.status-prospection-contacte { background: rgba(39, 174, 96, 0.2); color: var(--success); }
.status-prospection-non_contacte { background: rgba(231, 76, 60, 0.2); color: var(--danger); }
.status-prospection-a_rappeler { background: rgba(52, 152, 219, 0.2); color: var(--blue); }
.status-prospection-refuse { background: rgba(127, 140, 141, 0.2); color: var(--text-muted); }
.status-prospection-en_cours { background: rgba(243, 156, 18, 0.2); color: #f39c12; }
.status-prospection-interesse { background: rgba(155, 89, 182, 0.2); color: var(--type-theatre); }

/* ── Prospection Page ───────────────────────────────────────── */
.prospection-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.legend-label {
  color: var(--text-secondary);
}

.prospection-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.prospection-column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.column-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.column-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.column-count {
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.column-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100px;
}

.column-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

.prospection-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition);
}

.prospection-card:hover {
  border-color: var(--accent);
}

.prospection-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.prospection-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.prospection-card-title:hover {
  color: var(--accent);
}

.prospection-info {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.prospection-card-actions {
  display: flex;
  gap: 6px;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
}

/* ── Notes Section ───────────────────────────────────────────── */
.notes-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.notes-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.note-form {
  margin-bottom: 16px;
}

.note-form .form-group {
  margin-bottom: 8px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.note-content {
  color: var(--text-primary);
  line-height: 1.5;
}

.notes-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 18px;
  margin-bottom: 16px;
}

/* ── Detail Page ──────────────────────────────────────────────── */
.detail-header {
  margin-bottom: 16px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.detail-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 15px;
  color: var(--text-primary);
}

.detail-actions {
  display: flex;
  gap: 12px;
}

/* ── Stats Page ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stats-section {
  margin-bottom: 30px;
}

.stats-section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.stats-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.stats-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-secondary);
}

.stats-table td {
  font-size: 14px;
  color: var(--text-primary);
}

/* ── Login Page ───────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-form .form-group {
  text-align: left;
}

.login-form .form-input {
  margin-bottom: 16px;
}

/* ── Responsive ───────────────────────────────────────────────── */
/* 3 colonnes desktop (> 900px) — par défaut */
/* 2 colonnes tablette (600-900px) */
@media (max-width: 900px) {
  .salles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 1 colonne mobile (< 600px) */
@media (max-width: 600px) {
  .salles-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group {
    min-width: 100%;
  }
  .nav-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .detail-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .main-content {
    padding: 12px;
  }
}