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

/* Scoped variables inside the main component block */
.contact-form-component {
  --bg:        #F5F3EF;
  --surface:   #FDFCFA;
  --border:    #D8D4CC;
  --border-focus: #6a4118;
  --text:      #1C1916;
  --text-muted: #8A8480;
  --accent:    #101a37;
  --success:   #4A7C59;
  --error:     #B85042;
  --radius:    4px;
}

html, body {
  min-height: 100vh;
  background-color: #F5F3EF; /* Fallback for body */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  color: #1C1916;
  padding: 2rem;
  padding-top: 1rem;  
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.contact-form-component__wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
}

.contact-form-component__header {
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.6s ease forwards;
}

.contact-form-component__eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.contact-form-component__header h1 {
  font-family: 'Roboto', serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.2;
  color: #000000be;
}

.contact-form-component__header h1 b{
  font-family: 'Roboto', serif;
  font-weight: 800;
  line-height: 1.2;
  color: #000000c7;
  white-space: nowrap;
}

.contact-form-component__header h1 em {
  font-style: normal;
  color: #000000be;
}

.contact-form-component__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.6s ease 0.15s forwards;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
}

.contact-form-component__form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.contact-form-component__field {
  margin-bottom: 1.5rem;
  position: relative;
}

.contact-form-component__field:last-of-type { margin-bottom: 0; }

.contact-form-component__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.contact-form-component__field:focus-within .contact-form-component__label {
  color: var(--text);
}

.contact-form-component__input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.6rem 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, outline 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

select.contact-form-component__input {
  cursor: pointer;
  color: var(--text-muted); /* Shows muted by default */
  padding-right: 1.5rem; /* Space for custom arrow */
}

/* Used to give the select the active text color when an option is chosen */
select.contact-form-component__input:not(:invalid) {
  color: var(--text);
}

/* Custom select arrow */
.contact-form-component__custom-select::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0.9rem;
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='%238A8480' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  transition: transform 0.2s;
}

.contact-form-component__custom-select:focus-within::after {
  transform: rotate(180deg);
}

.contact-form-component__input::placeholder { 
  color: var(--text-muted);
  opacity: 0.6; 
}

.contact-form-component__input:focus {
  border-bottom-color: var(--border-focus);
}

/* Outline removido intencionadamente de los inputs a pedido del usuario */

/* Accessibility improvements */
.contact-form-component__submitBtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.contact-form-component__input:focus:not(:focus-visible), .contact-form-component__submitBtn:focus:not(:focus-visible) {
  outline: none;
}

.contact-form-component__input.error-input {
  border-bottom-color: var(--error);
}

.contact-form-component__error {
  font-size: 0.7rem;
  color: var(--error);
  margin-top: 0.35rem;
  display: none;
}

.contact-form-component__error.visible { display: block; }

.contact-form-component__divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
  opacity: 0.5;
}

.contact-form-component__btn-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contact-form-component__submitBtn {
  flex: 0 0 auto;
  background: var(--accent);
  color: #F5F3EF;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem clamp(0.5rem, 3vw, 1.5rem);
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(0.55rem, 2vw, 0.78rem);
  font-weight: 500;
  letter-spacing: clamp(0.03em, 0.5vw, 0.12em);
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.contact-form-component__submitBtn:hover { opacity: 0.85; }
.contact-form-component__submitBtn:active { transform: scale(0.98); }
.contact-form-component__submitBtn:disabled { opacity: 0.5; cursor: not-allowed; }

.contact-form-component__btn-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 140px;
}

/* Success UI y Utilidades */
.contact-form-component .hidden {
  display: none !important;
}

.contact-form-component__success-box {
  text-align: center;
  padding: 1.5rem 0;
  animation: fadeUp 0.5s ease forwards;
}

.contact-form-component__success-icon {
  width: 52px;
  height: 52px;
  background: var(--success);
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.contact-form-component__success-title {
  font-family: 'Roboto', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.contact-form-component__success-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.contact-form-component__success-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form-component__btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.5rem;
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(0.55rem, 2vw, 0.78rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.contact-form-component__btn-secondary:hover {
  background: rgba(0,0,0,0.02);
  border-color: #aaa;
}

/* Toast */
.contact-form-component__toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
  z-index: 100;
  white-space: nowrap;
}

.contact-form-component__toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.contact-form-component__toast.success { background: var(--success); }
.contact-form-component__toast.error-toast { background: var(--error); }

/* Loader */
.contact-form-component__spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}

.contact-form-component__submitBtn.loading .contact-form-component__spinner { display: block; }
.contact-form-component__submitBtn.loading .contact-form-component__btn-text { opacity: 0; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

@media (max-width: 480px) {
  .contact-form-component__eyebrow { font-size: 0.5rem; }
  .contact-form-component__header h1 { font-size: clamp(1.4rem, 7vw, 1.8rem); }
  .contact-form-component__form-row { grid-template-columns: 1fr; }
  .contact-form-component__card { padding: 1.5rem; }
  
  .contact-form-component__btn-wrap {
    flex-direction: column; 
    align-items: stretch;
    justify-content: center;
    gap: 0.75rem;
  }
  
  .contact-form-component__submitBtn {
    width: 100%; 
    font-size: 0.68rem;
    padding: 1rem;
  }
  
  .contact-form-component__btn-note {
    text-align: center;
    max-width: 100%;
    font-size: 0.75rem;
    white-space: normal;
  }
}