
/* --- Main Content --- */
.ciutadania-content {
  flex: 1;
  padding: 2rem;
  max-width: 90%;     /* una mica més ample per encabir 3 columnes */
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;    /* centra verticalment el contingut dins del main */
  justify-content: center; /* centra horitzontalment */
}

.column-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 targetes en línia */
  gap: 1.5rem; /* espai entre columnes/files */
}

/* Breakpoint per passar a 2 columnes */
@media (max-width: 1200px) {
  .column-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Tipografia --- */
h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #0032A0;
  text-align: center;
}

/* --- Targetes --- */
.card-ciutadania {
  width: 100%;
  max-width: none;               /* evita límits que trenquin la graella */
  background-color: #3A83F540;
  border-radius: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  height: 600px;
  max-height: 80vh;
  margin: 0;
  display: flex;
  flex-direction: column;        /* organitza fills en columna */
  justify-content: space-between; /* reparteix espai amunt/avall */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-ciutadania:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

/* Targetes que obren modal (millora UX) */
.card-ciutadania-iframe {
  cursor: pointer;
}

/* --- Contingut intern de la targeta --- */
.inside-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  font-size: 1.3rem;
  font-weight: 600;
  border-radius: 10px;
  background-color: #fff;
  width: 90%;
  margin-top: 2rem;
  margin-bottom: 3rem;
  height: 15rem;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  color: #0032A0;
  padding: 1rem;
}

/* --- Botó --- */
.ciu-button {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  width: 90%;
  padding: 0.75rem 2rem;
  margin-top: 2rem;
  font-weight: bold;
  border-radius: 10px;
  background-color: #fff;
  border: 2px solid #0032A0;
  color: #0032A0;
  font-size: 1.2rem;
}

/* --- Responsive targetes i tipografia --- */
@media (max-width: 768px) {
  .ciutadania-content {
    padding: 1rem;
    width: 95%;
    max-width: 100%;
  }

  .column-grid {
    grid-template-columns: 1fr; /* en pantalles petites, només 1 columna */
    gap: 1.5rem;
  }

  .card-ciutadania {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    height: auto;
  }

  h1 {
    font-size: 1.5rem;
    padding-top: 0;
  }

  .inside-card {
    width: 90%;
    height: auto;
    padding: 1.8rem;
    font-size: 1rem;
  }

  .ciu-button {
    width: 90%;
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    margin-top: auto; /* empeny el botó cap avall */
  }
}

@media (max-width: 480px) {
  .card-ciutadania {
    margin-bottom: 1rem;
  }

  .inside-card {
    font-size: 0.9rem;
    height: auto;
    padding: 1.8rem;
  }

  .ciu-button {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.5rem;
    padding-top: 0;
  }
}

/* ===============================
   MODALS IFRAME (Targeta 2 i 3)
   =============================== */

/* Amagats per defecte i fora del flux (no ocupen cel·la de la graella) */
.iframe-modal-ciutadania,
.iframe-modal-ciutadania2 {
  display: none;                 /* Important: evita que apareguin com targetes */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Contingut del modal (comú) */
.iframe-modal-content {
  background: #fff;
  width: 90%;
  max-width: 1000px;
  height: 80%;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Botó de tancar (comú) */
.iframe-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  z-index: 10;
}

.iframe-close:hover {
  color: #4c1d95;
}

/* L’iframe ocupa tot l’espai disponible */
.iframe-ciutadania {
  flex: 1;
  width: 100%;
  border: none;
}

/* ===============================
   MODAL GENÈRIC (formulari d’enviament)
   =============================== */

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;                 /* Amagat per defecte */
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

/* Classe helper per obrir-lo si ho prefereixes via CSS + JS */
.modal.open {
  display: flex;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 0.4rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
              0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content h2 {
  margin: 1rem 0;
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-content p {
  margin: 1rem 0 1.5rem 0;
  color: #666;
  line-height: 1.5;
}

#modal-icon {
  display: block;
  margin-bottom: 1rem;
}

#modal-icon .success {
  color: #10b981;
  font-size: 3rem;
}

#modal-icon .error {
  color: #ef4444;
  font-size: 3rem;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-button {
  background-color:#8878db;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  margin: 0 8px;
}

.modal-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(102, 126, 234, 0.4);
}

.modal-button.secondary {
  background: #8878db;
}

.modal-button.secondary:hover {
  background: #764ba2;
  box-shadow: 0 8px 15px rgba(107, 114, 128, 0.4);
}

/* Spinner per al botó d’enviament */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff40;
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-card.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Responsive modal genèric */
@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  .modal-buttons {
    flex-direction: column;
  }
  .modal-button {
    width: 100%;
    margin: 4px 0;
  }
}

/* Textarea coherent amb tipografia del lloc */
textarea {
  font-family: 'Montserrat', sans-serif;
}
