/* ImovHub — Design System (modelosis / Apple-inspired) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --black: #1d1d1f;
  --white: #ffffff;
  --pure-black: #000000;
  --light-gray: #f5f5f7;
  --apple-blue: #0071e3;
  --link-blue: #0066cc;
  --link-blue-dark: #2997ff;
  --gray-80: rgba(0, 0, 0, 0.8);
  --gray-48: rgba(0, 0, 0, 0.48);
  --border: #d2d2d7;
  --filter-bg: #fafafc;
  --dark-surface-1: #272729;
  --shadow-card: rgba(0, 0, 0, 0.22) 3px 5px 30px 0px;
  --nav-bg: rgba(0, 0, 0, 0.8);
  --error: #ff3b30;
  --success-bg: #ecfdf3;
  --success-text: #1d6f42;
  --warning-bg: #fff8e6;
  --warning-text: #8a6100;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-text: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  --radius-sm: 8px;
  --radius-pill: 980px;
  --max-width: 980px;
}

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

body {
  background: var(--white);
  color: var(--black);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--link-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* NAV */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  height: 48px;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.nav-brand {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.28px;
  justify-self: start;
}
.nav-brand:hover { text-decoration: none; opacity: 0.9; }
.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  justify-self: center;
}
.nav-links a {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-self: end;
}
.nav-cta {
  display: inline-block;
  background: var(--apple-blue);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.nav-cta:hover { opacity: 0.88; text-decoration: none; }

/* BUTTONS */
.btn {
  display: inline-block;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  border: none;
  text-align: center;
  transition: opacity 0.15s, background 0.15s;
}
.btn-blue {
  background: var(--apple-blue);
  color: #fff;
  padding: 8px 22px;
  border-radius: var(--radius-pill);
}
.btn-blue:hover { opacity: 0.88; text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--apple-blue);
  padding: 8px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--apple-blue);
}
.btn-outline:hover { background: rgba(0, 113, 227, 0.06); text-decoration: none; }
.btn-dark {
  background: var(--black);
  color: #fff;
  padding: 8px 22px;
  border-radius: var(--radius-sm);
}
.btn-dark:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.btn-filter {
  background: var(--filter-bg);
  color: var(--gray-80);
  padding: 6px 14px;
  border-radius: 11px;
  border: 3px solid rgba(0, 0, 0, 0.04);
  font-size: 14px;
}
.btn-block { display: block; width: 100%; }
.btn-sm { font-size: 14px; padding: 6px 16px; }

/* TYPOGRAPHY */
.display-hero {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.28px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.28px;
  margin-bottom: 8px;
}
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-48);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.text-muted { color: var(--gray-80); }
.text-subtle { color: var(--gray-48); font-size: 14px; }
.text-link { color: var(--link-blue); font-size: 14px; }

/* LAYOUT */
.page-gray { background: var(--light-gray); min-height: calc(100vh - 48px); }
.page-white { background: var(--white); min-height: calc(100vh - 48px); }
.container { max-width: var(--max-width); margin: 0 auto; padding: 48px 32px; }
.container-narrow { max-width: 480px; margin: 0 auto; padding: 64px 24px; }
.section-divider { border: none; border-top: 1px solid var(--border); }

/* APP SHELL */
.app-shell { display: flex; min-height: calc(100vh - 48px); }
.app-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--pure-black);
  color: #f5f5f7;
  display: flex;
  flex-direction: column;
}
.app-sidebar-brand {
  padding: 20px 24px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: -0.28px;
}
.app-sidebar-nav { flex: 1; padding: 16px 12px; }
.app-sidebar-nav a,
.app-sidebar-nav span {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  margin-bottom: 4px;
}
.app-sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.app-sidebar-nav a.active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.app-sidebar-nav span.disabled { color: rgba(255, 255, 255, 0.35); cursor: default; }
.app-sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}
.app-main { flex: 1; min-width: 0; background: var(--light-gray); }
.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.28px;
}
.app-content { padding: 32px; }

/* CARDS */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 24px;
  transition: box-shadow 0.3s;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.card:hover { box-shadow: var(--shadow-card); }
.card h3 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.196px;
  margin-bottom: 8px;
}
.card p { font-size: 14px; color: var(--gray-80); line-height: 1.43; }
.card-link { font-size: 14px; color: var(--link-blue); margin-top: 12px; display: inline-block; }
.card-link:hover { text-decoration: underline; }

.property-card { overflow: hidden; padding: 0; }
.property-card-image {
  aspect-ratio: 4/3;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-48);
  font-size: 14px;
  position: relative;
}
.property-card-image img { width: 100%; height: 100%; object-fit: cover; }
.property-card-body { padding: 20px; }
.property-card-price {
  font-size: 21px;
  font-weight: 600;
  color: var(--black);
  margin: 8px 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.metric-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.metric-card .label { font-size: 14px; color: var(--gray-48); }
.metric-card .value {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.28px;
}

/* FORMS */
.form-panel {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 32px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  max-width: 720px;
}
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.224px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-text);
  font-size: 17px;
  outline: none;
  letter-spacing: -0.374px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert-error { background: #fff2f1; color: #c41e12; border: 1px solid #ffcfc9; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #b8e6c8; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #ffe08a; }

.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.28px;
}
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--gray-48); }

.list-item {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.list-item-id { font-size: 12px; color: var(--gray-48); font-family: ui-monospace, monospace; }
.list-item-title { font-size: 17px; font-weight: 600; margin: 4px 0; }
.list-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-48);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
}

/* COMPARE BADGE */
.compare-badge {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--pure-black);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  font-size: 14px;
}
.compare-badge.hidden { display: none; }

/* FOOTER */
.footer {
  padding: 32px;
  text-align: center;
  background: var(--light-gray);
  font-size: 12px;
  color: var(--gray-48);
  border-top: 1px solid var(--border);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--white);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.modal-tabs button {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-family: var(--font-text);
  font-size: 14px;
  color: var(--gray-48);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.modal-tabs button.active {
  color: var(--black);
  font-weight: 600;
  border-bottom-color: var(--apple-blue);
}
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

/* TABLE */
.table-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.compare-table th,
.compare-table td {
  border: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}
.compare-table th { background: var(--light-gray); font-weight: 600; }
.compare-table .sticky-col {
  position: sticky;
  left: 0;
  background: var(--white);
  font-weight: 600;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--filter-bg);
  color: var(--gray-80);
  text-transform: capitalize;
}

.checkbox-label {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
}

/* HERO / LANDING */
.hero {
  padding: 96px 32px 80px;
  text-align: center;
  background: var(--light-gray);
}
.hero p {
  font-size: 21px;
  color: var(--gray-80);
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: left;
}
.hero-dark {
  background: var(--pure-black);
  color: #fff;
  padding: 80px 32px;
}
.hero-dark .section-label { color: rgba(255, 255, 255, 0.48); }
.hero-dark h1 { color: #fff; }
.hero-dark p { color: rgba(255, 255, 255, 0.75); }
.hero-panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 32px;
}
.hero-panel ul { list-style: none; }
.hero-panel li { padding: 8px 0; color: rgba(255, 255, 255, 0.85); font-size: 15px; }

/* CHAT WIDGET */
.chat-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--apple-blue);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: opacity 0.15s;
}
.chat-fab:hover { opacity: 0.88; }
.chat-panel {
  position: absolute;
  bottom: 68px;
  left: 0;
  width: 320px;
  max-width: calc(100vw - 48px);
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 28rem;
}
.chat-panel-header {
  background: var(--pure-black);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--light-gray);
  min-height: 12rem;
  max-height: 18rem;
}
.chat-bubble {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 85%;
  margin-bottom: 8px;
}
.chat-bubble-user { background: var(--apple-blue); color: #fff; }
.chat-bubble-bot { background: var(--white); border: 1px solid var(--border); color: var(--black); }
.chat-panel-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}
.chat-panel-footer input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-text);
}

.plan-card-current { border-color: var(--apple-blue) !important; box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.2); }

.hidden { display: none !important; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

[data-compare-id].compare-selected {
  outline: 2px solid var(--apple-blue);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .hero-split { grid-template-columns: 1fr; gap: 32px; }
  .detail-grid { grid-template-columns: 1fr; gap: 32px; }
  .nav { padding: 0 16px; }
  .nav-links { display: none; }
  .app-sidebar { display: none; }
  .container { padding: 32px 20px; }
  .app-content { padding: 20px; }
  .app-header { padding: 16px 20px; }
  .vitrine-layout { flex-direction: column; }
  .vitrine-sidebar { width: 100%; position: static; }
  .card-grid-ad-span { grid-column: 1 / -1; }
}

/* Vitrine publicidade */
.vitrine-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.vitrine-content { flex: 1; min-width: 0; }
.vitrine-sidebar {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}
.ad-slot {
  width: 100%;
  aspect-ratio: var(--ad-aspect, 970 / 90);
  margin-bottom: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--light-gray);
  border: 1px dashed var(--border);
}
.ad-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ad-slot a { display: block; height: 100%; }
.ad-slot-placeholder,
.ad-slot-preview .ad-slot-placeholder {
  width: 100%;
  height: 100%;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-80);
  font-size: 14px;
  text-align: center;
  padding: 16px;
  background: repeating-linear-gradient(
    -45deg,
    var(--light-gray),
    var(--light-gray) 8px,
    #ececec 8px,
    #ececec 16px
  );
}
.ad-slot-placeholder small { font-size: 12px; margin-top: 4px; color: var(--text-subtle); }
.ad-slot--vitrine_top { max-height: 120px; }
.card-grid-ad-span { grid-column: 1 / -1; }

/* Admin tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  font-weight: 600;
  color: var(--gray-80);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table code {
  font-size: 13px;
  background: var(--light-gray);
  padding: 2px 6px;
  border-radius: 4px;
}
