/* ==========================================================================
   Estètica càlida i calmada (Terracota, Crema i Verd) amb espai per respirar
   ========================================================================== */

:root {
  --bg-cream: #FAF7F2;
  --bg-white: #FFFFFF;
  --bg-soft: #F3EFE6;
  --bg-dark: #1A2536;

  --primary: #C84B31;          /* Terracota càlid */
  --primary-hover: #A83820;
  --primary-light: #FCECE8;

  --secondary: #1E3A5F;        /* Blau profund */
  --secondary-light: #E8F0F8;

  --accent-green: #236B4E;     /* Verd confiança */
  --accent-green-light: #E3F5ED;

  --amber-light: #FEF3C7;

  --text-main: #1E293B;
  --text-muted: #475569;
  --text-light: #64748B;
  --border-color: #E5E0D5;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Lora', Georgia, serif;

  --shadow-sm: 0 2px 8px rgba(26, 37, 54, 0.04);
  --shadow-md: 0 12px 28px -6px rgba(26, 37, 54, 0.07);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.22s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-cream);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Textura subtil de fons */
.panot-bg {
  background-image: radial-gradient(rgba(200, 75, 49, 0.055) 1.5px, transparent 1.5px),
                    radial-gradient(rgba(30, 58, 95, 0.04) 1.5px, var(--bg-cream) 1.5px);
  background-size: 34px 34px;
  background-position: 0 0, 17px 17px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-calm {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Capçalera i Navegació */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--bg-dark);
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.94rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  color: var(--text-main);
  cursor: pointer;
}

/* Botons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition);
  font-family: var(--font-sans);
}

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

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

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-main);
  border-color: var(--border-color);
}

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

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.86rem;
}

/* Hero Calmat a l'Inici */
.calm-hero {
  padding: 3.5rem 0 2.5rem;
}

.calm-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--bg-dark);
  margin-bottom: 1.4rem;
  letter-spacing: -0.01em;
}

.calm-hero h1 .highlight {
  color: var(--primary);
  font-style: italic;
}

/* Requadre destacat per a la crida als propietaris */
.owner-callout {
  background: var(--bg-white);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.45rem 1.65rem;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-sm);
}

.owner-callout-title {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.45rem;
}

.owner-callout p {
  font-size: 1.06rem;
  color: var(--text-main);
  line-height: 1.65;
  margin-bottom: 0;
}

.calm-sub {
  font-size: 1.02rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Targetes suaus, més curtes i compactes */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-header-inline {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
}

.card-step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.card-step.green {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.card-step.blue {
  background: var(--secondary-light);
  color: var(--secondary);
}

.card h3 {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  color: var(--bg-dark);
  margin-bottom: 0;
}

.card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Bloc de Correu destacat amb calma */
.contact-calm-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin: 2.25rem 0 1.75rem;
}

/* Missatge final d'iniciativa ciutadana */
.citizen-note {
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.6rem;
  color: var(--text-main);
  font-size: 0.96rem;
}

.contact-calm-card h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  color: var(--bg-dark);
  margin-bottom: 0.6rem;
}

.email-box {
  margin-top: 1.25rem;
  background: var(--bg-soft);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.email-address {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--primary);
  word-break: break-all;
}

.copy-btn {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

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

/* Formulari i Controls */
.form-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--bg-dark);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--text-main);
  background: var(--bg-cream);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-white);
}

textarea.form-control {
  min-height: 95px;
  resize: vertical;
}

/* ==========================================================================
   ESTILS DEL FÒRUM (Com estava abans)
   ========================================================================== */
.section {
  padding: 3.5rem 0;
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

.section-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.4vw, 2.5rem);
  color: var(--bg-dark);
  margin-bottom: 0.65rem;
}

.section-header p {
  font-size: 1.02rem;
  color: var(--text-muted);
}

.forum-layout {
  display: grid;
  grid-template-columns: 265px 1fr;
  gap: 1.85rem;
  align-items: start;
}

.forum-sidebar {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  border: 1px solid var(--border-color);
  position: sticky;
  top: 94px;
}

.category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.category-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.category-btn:hover {
  background: var(--bg-soft);
}

.category-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.forum-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.35rem;
  background: var(--bg-white);
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.search-input-wrap {
  flex: 1;
  min-width: 210px;
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.thread-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 1.45rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-light);
}

.thread-tag {
  background: var(--secondary-light);
  color: var(--secondary);
  font-weight: 700;
  padding: 0.18rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.thread-tag.cat-propietaris {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.thread-tag.cat-propostes {
  background: var(--primary-light);
  color: var(--primary);
}

.thread-tag.cat-ajuts {
  background: var(--amber-light);
  color: #B45309;
}

.thread-title {
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--bg-dark);
  margin-bottom: 0.45rem;
}

.thread-body {
  color: var(--text-muted);
  font-size: 0.95rem;
  white-space: pre-line;
  margin-bottom: 1rem;
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-top: 1px solid var(--bg-soft);
  padding-top: 0.8rem;
}

.action-pill {
  background: var(--bg-soft);
  border: 1px solid transparent;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.action-pill:hover, .action-pill.voted {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(200, 75, 49, 0.25);
}

.replies-section {
  margin-top: 0.95rem;
  border-top: 1px dashed var(--border-color);
  background: var(--bg-cream);
  padding: 0.95rem;
  border-radius: var(--radius-sm);
}

.reply-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.89rem;
}

.reply-item:last-of-type {
  border-bottom: none;
}

/* Recursos Oficials */
.resource-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: 1.65rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

.resource-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.resource-org {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary);
  margin-bottom: 0.3rem;
}

.resource-card h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--bg-dark);
  margin-bottom: 0.45rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-dark);
  color: white;
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: var(--transition);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Peu de pàgina serè */
.calm-footer {
  margin-top: 4rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.calm-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.visit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

.visit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}

@media (max-width: 900px) {
  .forum-layout {
    grid-template-columns: 1fr;
  }
  .forum-sidebar {
    position: static;
  }
  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .mobile-menu-btn {
    display: inline-flex;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 74px;
    left: 0;
    right: 0;
    background: var(--bg-white);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-link {
    width: 100%;
    justify-content: center;
  }
}

/* Desplegable de barris amb cercador integrat */
.district-combobox {
  position: relative;
  width: 100%;
}

.district-trigger {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.district-trigger::after {
  content: "▾";
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.district-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 250;
  overflow: hidden;
}

.district-combobox.open .district-dropdown {
  display: block;
}

.district-search-wrap {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-cream);
}

.district-search-input {
  width: 100%;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: var(--bg-white);
  color: var(--text-main);
}

.district-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.district-options-list {
  max-height: 230px;
  overflow-y: auto;
  padding: 0.35rem 0;
}

.district-group-label {
  padding: 0.45rem 0.75rem 0.2rem;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary);
  background: var(--bg-soft);
}

.district-option {
  padding: 0.45rem 0.85rem;
  font-size: 0.89rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease;
}

.district-option:hover,
.district-option.highlighted {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.district-no-results {
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
}
