/* ==========================================================================
   Case Vacanze Salento — stili applicativi (estendono organic.css)
   ========================================================================== */

.app-root { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; cursor: pointer; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 999px; background: var(--color-accent);
  display: grid; place-items: center; color: var(--color-bg); flex: none;
}
.brand-name { font-family: var(--font-heading); font-size: 19px; }
.site-nav { display: flex; gap: 2px; align-items: center; }
.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.nav-btn {
  position: relative;
  background: transparent; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-heading); font-size: 14px; color: var(--color-text);
  padding: 8px 15px; border-radius: 999px;
}
.nav-btn:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.nav-btn.active { background: var(--color-accent); color: var(--color-bg); }

/* Badge di notifica (messaggi non letti) */
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: var(--color-accent-700);
  color: var(--color-neutral-100); font-family: var(--font-body); font-size: 11px;
  font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.badge.pulse { animation: badgePulse 1.4s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* ---- View / layout ------------------------------------------------------- */
.view { flex: 1; }
.wrap { max-width: 1140px; margin: 0 auto; padding: var(--space-6); }

/* ---- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 100; background: var(--color-accent-2-700); color: var(--color-neutral-100);
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.toast.err { background: var(--color-accent-800); }

/* ---- Hero ---------------------------------------------------------------- */
.hero {
  position: relative; height: 74vh; min-height: 480px; overflow: hidden;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: grid; place-items: center; text-align: center;
  /* background: linear-gradient(135deg, var(--color-accent-700), var(--color-accent-900)); */
  background: linear-gradient(135deg, #8c491a30, #402310a8), url(/assets/css/sa.png);
  color: var(--color-neutral-100);
  /* background-image: url(/assets/css/sa.png); */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
.hero-inner { position: relative; padding: 0 var(--space-6); max-width: 900px; }
.hero .kicker { letter-spacing: .18em; text-transform: uppercase; font-size: 13px; color: var(--color-accent-200); margin-bottom: 14px; }
.hero h1 { font-size: clamp(42px, 7vw, 84px); line-height: 1.02; color: var(--color-neutral-100); margin-bottom: 16px; }
.hero p { font-size: clamp(16px, 2vw, 20px); max-width: 40ch; margin: 0 auto; opacity: .94; }

/* ---- Search card --------------------------------------------------------- */
.search-card { max-width: 680px; margin: calc(-1 * var(--space-8)) auto 0; position: relative; z-index: 5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }

/* ---- Property cards ------------------------------------------------------ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.prop-card { padding: 0; overflow: hidden; gap: 0; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.prop-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.prop-thumb { height: 190px; position: relative; background: var(--color-neutral-200); }
.prop-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prop-thumb .ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--color-neutral-500); font-size: 13px;
}
.prop-body { padding: var(--space-3); display: flex; flex-direction: column; gap: 8px; }
.price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--color-divider); }

/* ---- Gallery ------------------------------------------------------------- */
.gallery-hero { height: 340px; border-radius: var(--radius-lg); overflow: hidden; background: var(--color-neutral-200); margin-bottom: var(--space-4); }
.gallery-hero img { width: 100%; height: 100%; object-fit: cover; }
.thumb-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.thumb-row img { width: 90px; height: 68px; object-fit: cover; border-radius: var(--radius-md); cursor: pointer; opacity: .7; }
.thumb-row img.active, .thumb-row img:hover { opacity: 1; outline: 2px solid var(--color-accent); }

/* ---- Chat ---------------------------------------------------------------- */
.chat-shell { display: flex; flex-direction: column; height: 520px; max-height: 70vh;
  background: var(--color-surface); border-radius: calc(var(--radius-lg) * 1.15); box-shadow: var(--shadow-md); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--color-divider); }
.chat-head .status-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--color-accent-2-500); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--color-neutral-400); border-radius: 999px; }

.msg-row { display: flex; flex-direction: column; max-width: 78%; position: relative; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-row.theirs { align-self: flex-start; align-items: flex-start; }
.bubble {
  padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45;
  word-wrap: break-word; white-space: pre-wrap;
}
.msg-row.mine .bubble { background: var(--color-accent); color: var(--color-bg); border-bottom-right-radius: 5px; }
.msg-row.theirs .bubble { background: var(--color-neutral-200); color: var(--color-text); border-bottom-left-radius: 5px; }
.bubble.deleted { font-style: italic; opacity: .7; background: transparent !important; border: 1px dashed var(--color-divider); color: var(--color-neutral-600) !important; }
.msg-meta { font-size: 10.5px; color: var(--color-neutral-500); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.msg-tick { color: var(--color-accent-2-600); }

.msg-actions { position: relative; }
.msg-menu-btn { background: transparent; border: 0; cursor: pointer; color: var(--color-neutral-500); font-size: 15px; padding: 2px 6px; border-radius: 999px; line-height: 1; }
.msg-menu-btn:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.msg-menu {
  position: absolute; z-index: 20; background: var(--color-bg); border: 1px solid var(--color-divider);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); min-width: 190px; overflow: hidden;
}
.msg-menu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; cursor: pointer;
  padding: 9px 14px; font-size: 13px; color: var(--color-text); }
.msg-menu button:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.msg-menu button.danger { color: var(--color-accent-700); }

.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--color-divider); background: var(--color-bg); }
.chat-input .input { flex: 1; }

/* Elenco conversazioni (staff) */
.conv-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.conv-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md);
  cursor: pointer; border: 1px solid transparent; }
.conv-item:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.conv-item.active { background: var(--color-accent-100); border-color: var(--color-accent-300); }
.conv-avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--color-accent-2-200); color: var(--color-accent-2-800);
  display: grid; place-items: center; font-family: var(--font-heading); flex: none; }

/* ---- Admin --------------------------------------------------------------- */
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: var(--space-3) 0 var(--space-6);
  border-bottom: 1px solid var(--color-divider); padding-bottom: var(--space-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.stat-num { font-size: 30px; font-family: var(--font-heading); font-variant-numeric: tabular-nums; }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.img-tile { position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4/3; background: var(--color-neutral-200); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; }
.img-tile .img-badge { position: absolute; top: 6px; left: 6px; }
.img-tile .img-tools { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 4px; }
.icon-btn { width: 28px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--color-bg) 90%, transparent); display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.icon-btn.danger { color: var(--color-accent-700); }

.dropzone { border: 2px dashed var(--color-divider); border-radius: var(--radius-lg); padding: 26px;
  text-align: center; color: var(--color-neutral-600); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.drag { border-color: var(--color-accent); background: var(--color-accent-100); }

/* ---- Utilities ----------------------------------------------------------- */
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.center { text-align: center; }
.hidden { display: none !important; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--color-divider); border-top-color: var(--color-accent);
  border-radius: 999px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: grid; place-items: center; padding: var(--space-8); }

/* ---- Notifiche (campanella + pannello) ----------------------------------- */
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  width: 340px; max-width: 92vw; max-height: 460px; display: flex; flex-direction: column;
  background: var(--color-bg); border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--color-divider); }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--color-divider); align-items: flex-start; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.notif-item.unread { background: var(--color-accent-100); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--color-accent-100) 80%, var(--color-text) 5%); }
.notif-ico { flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: color-mix(in srgb, currentColor 12%, transparent); }
.notif-empty { padding: 26px 14px; text-align: center; color: var(--color-neutral-500); font-size: 13px; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { margin-top: var(--space-8); border-top: 1px solid var(--color-divider); }
.footer-inner { max-width: 1140px; margin: 0 auto; padding: var(--space-8) var(--space-6);
  display: flex; flex-wrap: wrap; gap: var(--space-8); justify-content: space-between; }
.footer-bar { border-top: 1px solid var(--color-divider); }
.footer-bar span { display: block; max-width: 1140px; margin: 0 auto; padding: var(--space-3) var(--space-6); font-size: 13px; }

@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  .site-nav .nav-label { display: none; }
  .wrap { padding: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  .badge.pulse, .spinner { animation: none; }
  .prop-card { transition: none; }
}
