/*
Theme Name: Atsamag Immobilier
Theme URI: https://atsamag.com
Author: Atsamag
Description: Thème WordPress pour la plateforme immobilière Atsamag (recherche, calendrier des visites, carte, annonces). Architecture "squelette" : toute la logique métier est apportée par les plugins Atsamag (atsa-search, atsa-bridge, atsa-fintech, atsa-identity, atsamag-v4, etc.) via des hooks do_action()/apply_filters(). Le thème seul n'affiche que des gabarits statiques de secours.
Version: 1.0.9
Requires PHP: 7.4
Text Domain: atsamag-immobilier
*/

:root{
  --green-dark:    #0d7a6b;
  --green-mid:     #14a98f;
  --green-light:   #1ecfb0;
  --green-btn:     #00c9a7;
  --orange:        #c8813a;
  --white:         #ffffff;
  --bg-light:      #eef0ee;
  --bg-page:       #f4f4f2;
  --text-dark:     #1a1a1a;
  --text-muted:    #666666;
  --border:        #e2e2df;
  --navbar-h:      64px;
  --cal-published: #00c9a7;
  --cal-scheduled: #f97316;
  --cal-both:      #e11d48;
}

* { box-sizing: border-box; }

body.atsamag-theme{
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  padding-bottom: calc(var(--navbar-h) + 12px);
}

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

.atsa-page{
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--bg-page);
  overflow: hidden;
}

/* ---------- Header ---------- */
.atsa-header{
  background: linear-gradient(90deg, var(--green-dark), var(--green-mid));
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.atsa-logo img{ display:block; height: 36px; width:auto; }
.atsa-header-right{ display:flex; align-items:center; gap:14px; }
.atsa-profile-btn{
  display:flex; align-items:center; justify-content:center;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
}
.atsa-profile-btn:hover{ background: rgba(255,255,255,.28); }

/* ---------- Search bar ---------- */
.atsa-search-bar{
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  padding: 16px 20px;
}
.atsa-search-bar p{ text-align:center; font-size:14px; color:var(--text-muted); margin:0 0 10px; }
.atsa-search-row{ display:flex; gap:8px; flex-wrap:wrap; }
.atsa-search-row input{
  flex:1; min-width:180px; padding:8px 12px; border-radius:8px; border:1px solid #ddd; font-size:14px;
}
@media (max-width:600px){
  .atsa-search-row input{ flex-basis:100%; }
  .atsa-search-row .atsa-btn{ flex:1; justify-content:center; }
}
.atsa-btn{
  display:flex; align-items:center; gap:6px; padding:8px 14px;
  border-radius:8px; border:1px solid #ddd; background:#fff;
  font-size:13px; font-weight:600; color:var(--text-dark);
  cursor:pointer; white-space:nowrap;
}
.atsa-btn svg{ width:16px; height:16px; flex-shrink:0; stroke:currentColor; fill:none; stroke-width:2; }
.atsa-btn.primary{ background:var(--orange); color:#fff; border:none; }

/* ---------- Row 2 : calendar + map ---------- */
.atsa-row2{
  display:grid; grid-template-columns:1fr 1fr; gap:16px; padding:16px 20px 0; align-items:stretch;
}
.atsa-card{ background:#fff; border:1px solid var(--border); border-radius:12px; overflow:hidden; display:flex; flex-direction:column; }
.atsa-card-head{ background:linear-gradient(90deg,var(--green-dark),var(--green-mid)); color:#fff; padding:8px 12px; flex-shrink:0; }
.atsa-card-head .title{ font-weight:600; font-size:12px; margin:0; line-height:1.25; }
.atsa-card-head .subtitle{ font-size:10px; color:#cfe9e1; margin:1px 0 0; line-height:1.2; }
.atsa-card-body{ padding:8px 10px; flex:1; }
.atsa-dot{ width:6px; height:6px; border-radius:50%; display:inline-block; margin-right:3px; }
.atsa-mini-cal{ display:grid; grid-template-columns:repeat(7,1fr); gap:1px; font-size:10px; text-align:center; }
.atsa-mini-cal span{ color:var(--text-muted); font-weight:600; font-size:8px; padding-bottom:1px; display:block; }
.atsa-mini-cal .d{ position:relative; padding:2px 0; border-radius:5px; color:var(--text-dark); line-height:1.3; }
.atsa-mini-cal .d.has-dot::after{ content:""; position:absolute; bottom:0; left:50%; transform:translateX(-50%); width:4px; height:4px; border-radius:50%; }
.atsa-mini-cal .d.pub::after{ background:var(--cal-published); }
.atsa-mini-cal .d.sch::after{ background:var(--cal-scheduled); }
.atsa-mini-cal .d.both::after{ background:var(--cal-both); }
.atsa-mini-cal .d.today{ background:var(--bg-light); font-weight:700; }
.atsa-legend{ display:flex; flex-wrap:wrap; gap:6px 8px; font-size:9px; color:var(--text-muted); margin:6px 0 0; line-height:1.3; }
@media (min-width:769px){
  .atsa-card-body{ padding:14px 16px; }
  .atsa-mini-cal{ font-size:12px; }
  .atsa-mini-cal span{ font-size:11px; }
  .atsa-mini-cal .d{ padding:4px 0; }
  .atsa-mini-cal .d.has-dot::after{ bottom:1px; width:5px; height:5px; }
  .atsa-legend{ font-size:11px; gap:10px; }
}
.atsa-map{ position:relative; flex:1; min-height:180px; background:#dcecd8; }
.atsa-map svg{ position:absolute; inset:0; width:100%; height:100%; }
.atsa-map .map-label{ position:absolute; bottom:6px; left:8px; font-size:10px; color:#3a5a3f; font-weight:600; background:rgba(255,255,255,.7); padding:2px 6px; border-radius:4px; }
.atsa-pin{ position:absolute; width:10px; height:10px; background:var(--green-dark); border-radius:50% 50% 50% 0; transform:translate(-50%,-100%) rotate(-45deg); box-shadow:0 1px 2px rgba(0,0,0,.3); }

/* ---------- Listings ---------- */
.atsa-listing-header{
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap:nowrap; gap:8px; padding:20px 20px 10px;
}
.atsa-listing-header h3{ margin:0; font-size:16px; font-weight:600; white-space:nowrap; flex-shrink:0; }
.atsa-listing-header select{
  font-size:13px; border-radius:20px; padding:6px 12px; border:1px solid #ddd;
  background:#fff; white-space:nowrap; flex-shrink:0;
}
.atsa-listing-grid{
  display:grid; grid-template-columns:repeat(3,1fr); gap:16px; padding:0 20px 20px;
}
@media (min-width:1300px){ .atsa-listing-grid{ grid-template-columns:repeat(4,1fr); } }
@media (min-width:1600px){ .atsa-listing-grid{ grid-template-columns:repeat(5,1fr); } }
@media (max-width:768px){ .atsa-listing-grid{ grid-template-columns:1fr; } }
.atsa-listing-card{ background:#fff; border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.atsa-listing-photo{ position:relative; height:150px; background:#c9c9c9; }
.atsa-listing-icons{ position:absolute; top:8px; right:8px; display:flex; gap:6px; }
.atsa-icon-circle{
  width:26px; height:26px; border-radius:50%; background:#fff;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.atsa-icon-circle svg{ width:14px; height:14px; }
.atsa-listing-body{ padding:10px 12px; }
.atsa-listing-price{ font-weight:700; font-size:15px; margin:0 0 4px; }
.atsa-listing-meta{ font-size:12px; color:var(--text-muted); margin:0; }
#atsa-infinite-loader{ text-align:center; padding:16px; color:var(--text-muted); font-size:13px; }

/* ---------- Bottom navbar ---------- */
.atsa-navbar{
  position:fixed; left:0; right:0; bottom:0; z-index:500;
  height:var(--navbar-h); background:#fff; border-top:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-around;
  max-width:1600px; margin:0 auto;
}
.atsa-navbar a{
  display:flex; flex-direction:column; align-items:center; gap:2px;
  font-size:10px; color:var(--text-muted); flex:1; padding:6px 0;
}
.atsa-navbar a svg{ width:22px; height:22px; stroke:currentColor; fill:none; stroke-width:2; }
.atsa-navbar a.is-active{ color:var(--green-dark); font-weight:600; }

.atsa-ai-fab{
  position:fixed; right:20px; bottom:calc(var(--navbar-h) + 16px); z-index:600;
  display:flex; align-items:center; gap:8px; padding:12px 18px; border-radius:30px;
  background:linear-gradient(90deg,#7b3ff2,#a45bff); color:#fff; border:none;
  font-size:14px; font-weight:600; box-shadow:0 4px 14px rgba(123,63,242,.4); cursor:pointer;
}
.atsa-ai-fab svg{ width:18px; height:18px; }
.atsa-ai-panel{
  position:fixed; right:20px; bottom:calc(var(--navbar-h) + 70px); z-index:600;
  width:320px; max-width:calc(100vw - 32px); max-height:60vh;
  background:#fff; border-radius:16px; box-shadow:0 8px 30px rgba(0,0,0,.25);
  display:none; flex-direction:column; overflow:hidden;
}
.atsa-ai-panel.open{ display:flex; }
.atsa-ai-panel-head{
  background:linear-gradient(90deg,#7b3ff2,#a45bff); color:#fff; padding:12px 16px;
  display:flex; align-items:center; justify-content:space-between; font-weight:600; font-size:14px;
}
.atsa-ai-panel-head button{ background:none; border:none; color:#fff; font-size:18px; cursor:pointer; line-height:1; }
.atsa-ai-messages{ flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:8px; }
.atsa-ai-msg{ font-size:13px; padding:8px 12px; border-radius:12px; max-width:85%; line-height:1.4; }
.atsa-ai-msg.bot{ background:var(--bg-light); align-self:flex-start; }
.atsa-ai-msg.user{ background:var(--green-dark); color:#fff; align-self:flex-end; }
.atsa-ai-input-row{ display:flex; gap:6px; padding:10px; border-top:1px solid var(--border); }
.atsa-ai-input-row input{ flex:1; border:1px solid #ddd; border-radius:20px; padding:8px 14px; font-size:13px; }
.atsa-ai-input-row button{ background:#7b3ff2; color:#fff; border:none; border-radius:50%; width:34px; height:34px; cursor:pointer; }

@media (max-width:600px){
  .atsa-header{ padding:10px 14px; }
  .atsa-logo img{ height:20px; }
  .atsa-ai-fab span{ display:none; }
  .atsa-ai-fab{ padding:12px; width:46px; height:46px; justify-content:center; }
}
