/* ============================================================
   🧩 COMPONENTS: FORMULARIS
   ------------------------------------------------------------
   Estils globals per a formularis, inputs, selects, textareas,
   checkbox i enllaços auxiliars. Inspirat en la paleta daurada
   i blava de BorsaDocent.
   ============================================================ */


/* === CONTENIDOR GENERAL DEL FORMULARI === */
.form-container {
  max-width: 500px;
  margin: 40px auto;
  padding: 2rem;
  background: #fff;
  border: 2px solid var(--color-daurat, #d4af37);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

/* Etiquetes */
.form-container label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: #333;
}

/* Inputs, selects i textareas */
.form-container input,
.form-container select,
.form-container textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Focus amb paleta corporativa */
.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
  border-color: var(--color-daurat, #d4af37);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
  outline: none;
}

/* Subtext o línies decoratives */
.form-underline {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #f1c40f, #d4af37);
  margin: 10px auto 22px;
  border-radius: 10px;
  opacity: 0.9;
}

.form-subtext {
  margin-bottom: 20px;
  color: #555;
  font-size: 0.95rem;
}

/* Enllaços del formulari */
.form-link a {
  color: var(--color-principal, #2563eb);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.form-link a:hover {
  text-decoration: underline;
  background-color: rgba(37, 99, 235, 0.08);
}

/* === CHECKBOX LEGAL / PRIVACITAT === */
.checkbox-legal {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  margin-top: 10px;
  color: #444;
  font-family: inherit;
  line-height: 1.3;
}

.checkbox-legal input[type="checkbox"] {
  accent-color: var(--color-principal, #1e3a8a);
  width: 18px;
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
}

.checkbox-legal a {
  color: #444;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.checkbox-legal a:hover {
  color: var(--color-daurat, #d4af37);
}

/* === CHECKBOXES DE FILTRE (PANELL ESCOLA) === */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.checkbox-wrapper {
  display: inline-block;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--color-daurat, #d4af37);
  border-radius: 6px;
  background-color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  height: 26px;
}

.checkbox-label:hover {
  background-color: #fff6dd;
  border-color: #b8932f;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #b8932f;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}


/*Desplegables index*/
.custom-select {
  position: relative;
  width: 220px;
  font-family: inherit;
  user-select: none;
}

.custom-select .selected {
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  color: #333;
}

/* Quan s’activa el desplegable (mostrant opcions) */
.custom-select.active .selected {
  background-color: #fff;
  border-color: #d4af37;
  color: #333;
}

.custom-select .options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d4af37;
  border-top: none;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  border-radius: 0 0 6px 6px;
}

.custom-select .options li {
  padding: 10px;
  cursor: pointer;
  color: #333;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Només la opció en hover */
.custom-select .options li:hover {
 background-color: #cce5ff;

;
  color: #000;
}

/* Mostrar opcions quan actiu */
.custom-select.active .options {
  display: block;
}

/*Darkmode*/

/* ========================================================= */
/* 🌙 DARK MODE — FORMULARIS GLOBALS                         */
/* ========================================================= */

/* ============================= */
/* 1️⃣ CONTENIDOR GENERAL        */
/* ============================= */

[data-theme="dark"] .form-container {
  background: #111827; /* gris blau profund */
  border: 1px solid rgba(212,175,55,0.5);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  color: #e5e7eb;
}


/* ============================= */
/* 2️⃣ ETIQUETES                 */
/* ============================= */

[data-theme="dark"] .form-container label {
  color: #e5e7eb;
}


/* ============================= */
/* 3️⃣ INPUTS / SELECTS / TEXTAREA */
/* ============================= */

[data-theme="dark"] .form-container input,
[data-theme="dark"] .form-container select,
[data-theme="dark"] .form-container textarea {
  background-color: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
  color: #e5e7eb;
}

[data-theme="dark"] .form-container input::placeholder,
[data-theme="dark"] .form-container textarea::placeholder {
  color: #64748b;
}

/* Focus */
[data-theme="dark"] .form-container input:focus,
[data-theme="dark"] .form-container select:focus,
[data-theme="dark"] .form-container textarea:focus {
  border-color: #d4af37;
  box-shadow: 0 0 0 3px rgba(212,175,55,0.25);
}


/* ============================= */
/* 4️⃣ SUBTEXT                   */
/* ============================= */

[data-theme="dark"] .form-subtext {
  color: #94a3b8;
}


/* ============================= */
/* 5️⃣ ENLLAÇOS                  */
/* ============================= */

[data-theme="dark"] .form-link a {
  color: #93c5fd;
}

[data-theme="dark"] .form-link a:hover {
  background-color: rgba(147,197,253,0.12);
}


/* ============================= */
/* 6️⃣ CHECKBOX LEGAL            */
/* ============================= */

[data-theme="dark"] .checkbox-legal {
  color: #cbd5e1;
}

[data-theme="dark"] .checkbox-legal a {
  color: #cbd5e1;
}

[data-theme="dark"] .checkbox-legal a:hover {
  color: #d4af37;
}

[data-theme="dark"] .checkbox-legal input[type="checkbox"] {
  accent-color: #d4af37;
}


/* ============================= */
/* 7️⃣ CHECKBOX GROUP (PANELL)   */
/* ============================= */

[data-theme="dark"] .checkbox-label {
  background-color: #0f172a;
  border: 1px solid rgba(212,175,55,0.5);
  color: #e5e7eb;
}

[data-theme="dark"] .checkbox-label:hover {
  background-color: rgba(212,175,55,0.12);
  border-color: #d4af37;
}

[data-theme="dark"] .checkbox-label input[type="checkbox"] {
  accent-color: #d4af37;
}


/* ============================= */
/* 8️⃣ CUSTOM SELECT             */
/* ============================= */

[data-theme="dark"] .custom-select .selected {
  background-color: #0f172a;
  border: 1px solid rgba(255,255,255,0.08);
  color: #e5e7eb;
  box-shadow: none;
}

[data-theme="dark"] .custom-select.active .selected {
  border-color: #d4af37;
}

[data-theme="dark"] .custom-select .options {
  background: #111827;
  border: 1px solid #d4af37;
}

[data-theme="dark"] .custom-select .options li {
  color: #e5e7eb;
}

[data-theme="dark"] .custom-select .options li:hover {
  background-color: rgba(212,175,55,0.15);
  color: #ffffff;
}


/* ============================= */
/* 9️⃣ ANIMACIÓ SUAU D’ENTRADA   */
/* ============================= */

[data-theme="dark"] .form-container {
  animation: formAppearDark .25s ease;
}

@keyframes formAppearDark {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
