/* ==========================================================================
   DESIGN SYSTEM & VARIABLES - HABITAT SOLIDAIRE
   ========================================================================== */

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

:root {
  --primary: #059669;        /* Vert Émeraude Solidaire */
  --primary-hover: #047857;
  --secondary: #0284c7;      /* Bleu Habitat */
  --secondary-hover: #0369a1;
  --accent: #d97706;         /* Or/Cagnotte */
  --accent-hover: #b45309;
  --accent-light: #fef3c7;
  
  --background: #ffffff;     /* Fond blanc pur */
  --card-bg: #ffffff;
  --text-main: #0f172a;      /* Slate 900 */
  --text-muted: #334155;     /* Slate 700 (optimise pour fond blanc) */
  --border: #94a3b8;         /* Slate 400 (plus de contraste sur fond blanc) */
  --border-light: #cbd5e1;   /* Slate 300 (plus de contraste) */
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* En-tête Navigation */
.header-nav {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  height: 48px;
  width: 48px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.brand-name span {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--border-light);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

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

/* Main Layout */
.app-main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.05) 0%, rgba(2, 132, 199, 0.05) 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* Onglets d'affichage */
.tabs-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
}

.tab-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 1.5rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--primary);
  border-radius: 3px 3px 0 0;
}

/* Section de filtres */
.search-filter-section {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  color: var(--text-main);
  transition: var(--transition);
  width: 100%;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--card-bg);
}

.btn-filter-reset {
  background-color: #f1f5f9;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  height: 42px;
}

.btn-filter-reset:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
}

/* Vue Onglets */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grille d'annonces */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

/* Cartes des annonces */
.listing-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.listing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.card-img-wrapper {
  position: relative;
  height: 200px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.listing-card:hover .card-img {
  transform: scale(1.05);
}

.card-tags {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: #fff;
  letter-spacing: 0.05em;
}

.tag-price {
  background-color: var(--secondary);
}

.tag-location {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
}

.card-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-details {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.card-description {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* SECTION CAGNOTTE */
.cagnotte-section {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-top: auto;
}

.cagnotte-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.cagnotte-label {
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.cagnotte-stats {
  font-weight: 600;
  color: var(--text-main);
}

.progress-bar-bg {
  height: 10px;
  background-color: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #fb923c 100%);
  border-radius: 5px;
  width: 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.3);
}

.card-actions {
  display: flex;
  gap: 0.75rem;
}

.gogol-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

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

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

.btn-accent {
  background-color: var(--accent);
  color: #fff;
  flex-grow: 1;
}

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

.btn-secondary {
  background-color: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

/* SECTION DEMANDEURS */
.demandeur-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 900px) {
  .demandeur-container {
    grid-template-columns: 2fr 1fr;
  }
}

.demandeurs-table-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.registry-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.registry-table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.registry-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.family-name {
  font-weight: 700;
  color: var(--text-main);
}

.family-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  text-align: center;
}

.status-searching {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-funding {
  background-color: #fef3c7;
  color: #92400e;
}

.status-housed {
  background-color: #d1fae5;
  color: #065f46;
}

.applicant-form-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

/* Modales Dialogs */
.gogol-dialog {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: calc(100% - 2rem);
  margin: auto;
  outline: none;
  background-color: var(--card-bg);
}

.gogol-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
}

.dialog-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.dialog-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--text-main);
}

.dialog-body {
  padding: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.dialog-body p {
  margin-bottom: 1rem;
}

.dialog-body p:last-child {
  margin-bottom: 0;
}

.dialog-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Formulaires et Boutons */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: #f1f5f9;
  color: var(--text-main);
  transition: var(--transition);
  width: 100%;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--card-bg);
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input {
  width: auto;
}

/* Pied de page */
.footer {
  background-color: var(--text-main);
  color: #94a3b8;
  border-top: 1px solid var(--border-light);
  padding: 2rem 1.5rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

@media (min-width: 768px) {
  .footer-container {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer-left {
  font-size: 0.9rem;
}

.footer-right {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-right a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.footer-right a:hover {
  color: #fff;
}

/* Panel d'erreur d'annonces vides */
.no-listings {
  text-align: center;
  padding: 4rem 2rem;
  background-color: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.no-listings p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Bouton CTA Hero avec animation de pulsation premium */
.btn-hero-cta {
  background: linear-gradient(135deg, var(--primary) 0%, #10b981 100%) !important;
  box-shadow: 0 4px 14px 0 rgba(5, 150, 105, 0.4) !important;
  animation: pulse-glow 2.5s infinite;
  transition: var(--transition);
}

.btn-hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(5, 150, 105, 0.5) !important;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 4px 14px 0 rgba(5, 150, 105, 0.4); }
  50% { box-shadow: 0 4px 22px 6px rgba(5, 150, 105, 0.65); }
  100% { box-shadow: 0 4px 14px 0 rgba(5, 150, 105, 0.4); }
}
