/* ClaudeImmo — Dordogne Real Estate Dashboard */
:root {
  --stone: #c4a882;
  --stone-light: #f5f0e8;
  --stone-dark: #8b7355;
  --green: #4a7c59;
  --green-light: #e8f0ea;
  --green-dark: #2d5a3a;
  --earth: #6b4e37;
  --earth-light: #f0e8e0;
  --sky: #5a8fa8;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --red: #dc2626;
  --red-light: #fef2f2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: var(--earth);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand a { color: var(--white); text-decoration: none; font-size: 1.25rem; font-weight: 700; }
.nav-subtitle { color: var(--stone); margin-left: 0.5rem; font-size: 0.85rem; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; padding: 0.25rem 0; border-bottom: 2px solid transparent; transition: all 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--white); border-bottom-color: var(--stone); }
.nav-logout { opacity: 0.6; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; padding: 0.5rem 1rem; border: none; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.875rem; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
legend { font-weight: 600; padding: 0 0.5rem; font-size: 0.9rem; }

/* Login */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-card { background: var(--white); padding: 2.5rem; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; }
.login-card h1 { text-align: center; color: var(--earth); font-size: 2rem; }
.login-subtitle { text-align: center; color: var(--gray-500); margin-bottom: 2rem; }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid rgba(220,38,38,0.2); }

/* Dashboard */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.dashboard-header h1 { font-size: 1.5rem; }

/* Filters */
.filters-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: end; padding: 1rem; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.filter-input { padding: 0.4rem 0.6rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.85rem; }
.filter-sm { width: 100px; }
.listings-stats { color: var(--gray-500); font-size: 0.875rem; margin-bottom: 1rem; }

/* Listings Grid */
.listings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }

.listing-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.listing-card-img { width: 100%; height: 200px; object-fit: cover; background: var(--gray-200); }
.listing-card-body { padding: 1rem; }
.listing-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listing-card-city { color: var(--gray-500); font-size: 0.85rem; margin-bottom: 0.5rem; }
.listing-card-price { font-size: 1.25rem; font-weight: 700; color: var(--green-dark); }
.listing-card-specs { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--gray-500); margin-top: 0.5rem; }
.listing-card-badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 500; }
.badge-agency { background: var(--stone-light); color: var(--earth); }
.badge-type { background: var(--green-light); color: var(--green-dark); }
.badge-score { background: var(--earth-light); color: var(--earth); }
.badge-new { background: #fef3c7; color: #92400e; }
.badge-multi { background: #e0e7ff; color: #3730a3; }

/* Listing Detail */
.listing-detail { max-width: 900px; margin: 0 auto; }
.back-link { color: var(--gray-500); text-decoration: none; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: var(--gray-700); }
.listing-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.listing-price-big { font-size: 2rem; font-weight: 700; color: var(--green-dark); display: block; }
.listing-price-sqm { font-size: 0.9rem; color: var(--gray-500); }
.listing-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.listing-city { color: var(--gray-500); }

/* Gallery */
.gallery { margin-bottom: 1.5rem; }
.gallery-main { width: 100%; border-radius: var(--radius); overflow: hidden; margin-bottom: 0.5rem; }
.gallery-main img { width: 100%; max-height: 500px; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; }
.gallery-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.6; transition: opacity 0.2s; border: 2px solid transparent; }
.gallery-thumb:hover, .gallery-thumb.active { opacity: 1; border-color: var(--green); }

/* Specs */
.listing-specs { display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem; background: var(--white); border-radius: var(--radius); margin-bottom: 1.5rem; }
.spec { padding: 0.5rem 1rem; background: var(--gray-100); border-radius: var(--radius); font-size: 0.9rem; }

/* Description */
.listing-description { background: var(--white); padding: 1.5rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.listing-description h2 { margin-bottom: 0.75rem; }
.listing-description p { color: var(--gray-700); line-height: 1.7; }

/* AI Analysis */
.ai-analysis { background: var(--white); padding: 1.5rem; border-radius: var(--radius); margin-bottom: 1.5rem; }
.ai-analysis h2 { margin-bottom: 1rem; color: var(--earth); }
.criteria-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.criteria-category h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--stone-dark); margin-bottom: 0.75rem; padding-bottom: 0.25rem; border-bottom: 2px solid var(--stone-light); }
.criteria-item { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.85rem; }
.criteria-label { color: var(--gray-700); }
.criteria-value { font-weight: 500; }
.value-yes { color: var(--green); }
.value-no { color: var(--gray-300); }
.rating-bar { display: inline-block; position: relative; }

/* Listing source */
.listing-source { margin-bottom: 2rem; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.5rem; margin-top: 2rem; }
.pagination button { padding: 0.4rem 0.8rem; border: 1px solid var(--gray-300); background: var(--white); border-radius: var(--radius); cursor: pointer; }
.pagination button.active { background: var(--green); color: var(--white); border-color: var(--green); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Settings */
.settings-page h1 { margin-bottom: 1.5rem; }
.settings-section { background: var(--white); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.settings-section h2 { margin-bottom: 1rem; font-size: 1.1rem; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

/* Alerts page */
.alert-form { background: var(--white); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.alerts-list .alert-item { background: var(--white); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 0.75rem; display: flex; justify-content: space-between; align-items: center; }
.alert-item-name { font-weight: 600; }
.alert-item-filters { font-size: 0.8rem; color: var(--gray-500); }
.alert-item-actions { display: flex; gap: 0.5rem; }

/* Agencies list */
.agency-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--gray-100); }
.agency-item:last-child { border-bottom: none; }

/* Health */
.health-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; }
.health-ok { background: var(--green); }
.health-err { background: var(--red); }

/* Criteria list */
.criteria-list-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--gray-100); font-size: 0.85rem; }

/* Scrape history */
.scrape-history table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.scrape-history th, .scrape-history td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--gray-100); }
.scrape-history th { font-weight: 600; color: var(--gray-500); }

.loading { color: var(--gray-500); font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links { gap: 0.75rem; font-size: 0.8rem; }
  .container { padding: 1rem; }
  .filters-bar { flex-direction: column; }
  .listing-header { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .listings-grid { grid-template-columns: 1fr; }
}
