/* ========================================================================== */
/* ESTILOS GLOBALES */
/* ========================================================================== */

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

body {
  font-family: "Montserrat", Arial, sans-serif;
  background-color: #f8f8f8;
  color: #333;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ========================================================================== */
/* HEADER Y NAVBAR */
/* ========================================================================== */

header {
  background-color: #fff;
  padding: 1em 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2em;
}

.brand h2 {
  font-size: 1.8em;
  color: #222;
  font-weight: 700;
}

.brand h2 span {
  color: #c60e0f;
}

.menu {
  list-style: none;
  display: flex;
  gap: 2em;
}

.menu li a {
  text-decoration: none;
  color: #555;
  font-weight: 600;
  font-size: 1.1em;
  padding: 0.5em 0;
  transition: color 0.3s ease-in-out;
}

.menu li a:hover {
  color: #c60e0f;
}

.toggle_menu {
  display: none;
  font-size: 1.8em;
  cursor: pointer;
  color: #555;
}

#toggle_close {
  display: none;
}

/* ========================================================================== */
/* MAIN CONTENT */
/* ========================================================================== */

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2em 3em;
}

/* Ejemplo de CSS para el loading-overlay (si no lo tienes) */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex; /* Asegúrate de que esto esté en tu CSS o en el inline style */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000; /* Debe estar por encima de todo */
}

/* Estilo simple del spinner */
.loader {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #c60e0f; /* Color de tu marca */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% {
       transform: rotate(0deg);
   }
  100% {
    transform: rotate(360deg);
  }
}

/* ========================================================================== */
/* SECTION HEADING */
/* ========================================================================== */

.section-heading {
  text-align: center;
  padding: 3em 0 2em;
}

.section-heading h2 {
  font-size: 2.5em;
  color: #222;
  margin-bottom: 0.5em;
}

.section-heading h2 span {
  color: #c60e0f;
}

.divider {
  width: 60px;
  height: 4px;
  background: #c60e0f;
  margin: 0.5em auto 1.5em;
  border-radius: 2px;
}

.section-heading p {
  font-size: 1.1em;
  color: #666;
  max-width: 700px;
  margin: 0 auto;
}

/* ========================================================================== */
/* FORM CONTAINER */
/* ========================================================================== */

.form-container {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 2em;
  margin: 2em 0;
}

.form-wrapper {
  background: #fff;
  padding: 2.5em;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* ========================================================================== */
/* FORM STYLES */
/* ========================================================================== */

.cotizacion-form {
  display: flex;
  flex-direction: column;
}

fieldset {
  border: none;
  padding: 0;
  margin-bottom: 2.5em;
}

legend {
  font-size: 1.4em;
  font-weight: 700;
  color: #222;
  margin-bottom: 1.5em;
  padding-bottom: 0.8em;
  border-bottom: 2px solid #c60e0f;
  width: 100%;
}

.form-group {
  margin-bottom: 1.5em;
  display: flex;
  flex-direction: column;
}

label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.6em;
  font-size: 0.95em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  padding: 0.8em 1em;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 1em;
  color: #333;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #c60e0f;
  box-shadow: 0 0 0 3px rgba(198, 14, 15, 0.1);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: "Montserrat", Arial, sans-serif;
}

.hint {
  font-size: 0.85em;
  color: #999;
  margin-top: 0.3em;
}

.error-message {
  color: #dc3545;
  font-size: 0.85em;
  margin-top: 0.3em;
  display: none;
}

.error-message.show {
  display: block;
}

/* ========================================================================== */
/* RADIO BUTTONS */
/* ========================================================================== */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 1em;
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  transition: all 0.3s;
  flex-shrink: 0;
}

.radio-label input[type="radio"]:checked + .radio-custom {
  border-color: #c60e0f;
  background: #c60e0f;
}

.radio-custom i {
  color: #fff;
  font-size: 0.8em;
  display: none;
}

.radio-label input[type="radio"]:checked + .radio-custom i {
  display: block;
}

.option-desc {
  font-size: 0.85em;
  color: #999;
  margin-left: 2.5em;
  margin-top: -0.8em;
}

/* ========================================================================== */
/* CHECKBOX */
/* ========================================================================== */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 0.8em;
  font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  border-color: #c60e0f;
  background: #c60e0f;
}

.checkbox-custom i {
  color: #fff;
  font-size: 0.75em;
  display: none;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom i {
  display: block;
}

/* ========================================================================== */
/* FILE INPUT */
/* ========================================================================== */

.file-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.file-input-wrapper input[type="file"] {
  display: none;
}

.file-label {
  padding: 1.2em;
  border: 2px dashed #c60e0f;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fff5f5;
  color: #c60e0f;
  font-weight: 600;
}

.file-label:hover {
  background: #ffe0e0;
}

.file-label i {
  display: block;
  font-size: 2em;
  margin-bottom: 0.5em;
}

.file-name {
  font-size: 0.85em;
  color: #999;
  text-align: center;
}

/* ========================================================================== */
/* FORM ACTIONS */
/* ========================================================================== */

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
  margin-top: 2em;
}

button[type="submit"],
button[type="reset"] {
  padding: 1em;
  font-size: 1em;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

button[type="submit"] {
  background: #c60e0f;
  color: #fff;
}

button[type="submit"]:hover {
  background: #9c0b0c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(198, 14, 15, 0.3);
}

button[type="reset"] {
  background: #e0e0e0;
  color: #333;
}

button[type="reset"]:hover {
  background: #d0d0d0;
}

/* ========================================================================== */
/* SUCCESS MESSAGE */
/* ========================================================================== */

.success-message {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: #fff;
  padding: 3em 2em;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.2);
}

.success-message i {
  font-size: 3em;
  margin-bottom: 1em;
  display: block;
  animation: scaleIn 0.5s ease;
}

.success-message h3 {
  font-size: 1.8em;
  margin-bottom: 0.8em;
}

.success-message p {
  font-size: 1.1em;
  margin-bottom: 1.5em;
  opacity: 0.95;
}

.whatsapp-link {
  display: inline-block;
  background: #fff;
  color: #25d366;
  padding: 0.8em 1.5em;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s;
}

.whatsapp-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================================================== */
/* SIDEBAR */
/* ========================================================================== */

.form-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
}

.info-box {
  background: #fff;
  padding: 1.5em;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.info-box h3 {
  font-size: 1.1em;
  color: #222;
  margin-bottom: 0.8em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.info-box h3 i {
  color: #c60e0f;
  font-size: 1.3em;
}

.info-box p {
  color: #666;
  font-size: 0.95em;
  margin-bottom: 1em;
}

.info-box.highlight {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
  border-left: 4px solid #c60e0f;
}

.btn-small {
  display: inline-block;
  background: #c60e0f;
  color: #fff;
  padding: 0.6em 1.2em;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9em;
  transition: all 0.3s;
}

.btn-small:hover {
  background: #9c0b0c;
  transform: translateY(-2px);
}

.tips-list {
  list-style: none;
  text-align: left;
}

.tips-list li {
  padding: 0.5em 0;
  color: #666;
  font-size: 0.9em;
  position: relative;
  padding-left: 1.5em;
}

.tips-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #c60e0f;
  font-weight: bold;
}

/* ========================================================================== */
/* FOOTER */
/* ========================================================================== */

footer {
  background-color: #333;
  color: #eee;
  text-align: center;
  padding: 2em;
  margin-top: 3em;
}

.footer-content h2 {
  font-size: 1.8em;
  color: #eee;
  margin-bottom: 0.5em;
}

.footer-content h2 span {
  color: #c60e0f;
}

.footer-content h5 {
  font-size: 1em;
  color: #bbb;
  margin-bottom: 1.5em;
  font-weight: 400;
}

.social-networks {
  display: flex;
  justify-content: center;
  gap: 1.5em;
  margin-top: 1em;
}

.social-networks a {
  color: #fff;
  font-size: 1.8em;
  transition: color 0.3s, transform 0.2s;
}

.social-networks a:hover {
  color: #c60e0f;
  transform: translateY(-3px);
}

/* ========================================================================== */
/* RESPONSIVE DESIGN */
/* ========================================================================== */

@media (max-width: 1024px) {
  .form-container {
    grid-template-columns: 1fr;
  }

  .form-sidebar {
    order: -1;
    grid-template-columns: repeat(2, 1fr);
    display: grid;
    gap: 1.5em;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 1.5em;
  }

  .brand h2 {
    font-size: 1.6em;
  }

  .menu {
    flex-direction: column;
    position: fixed;
    top: 0;
    right: -250px;
    width: 250px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    padding-top: 5em;
    transition: right 0.3s ease-in-out;
    align-items: flex-start;
    gap: 1em;
    z-index: 999;
  }

  .menu li a {
    padding: 0.8em 1.5em;
    width: 100%;
    border-bottom: 1px solid #eee;
  }

  .menu.show-menu {
    right: 0;
  }

  .toggle_menu {
    display: block;
  }

  main {
    padding: 0 1.5em 2em;
  }

  .section-heading h2 {
    font-size: 1.8em;
  }

  .form-wrapper {
    padding: 1.5em;
  }

  .form-actions {
    grid-template-columns: 1fr;
    gap: 1em;
  }

  .form-sidebar {
    grid-template-columns: 1fr;
  }

  fieldset {
    margin-bottom: 1.8em;
  }

  legend {
    font-size: 1.2em;
    margin-bottom: 1.2em;
  }

  .info-box {
    padding: 1.2em;
  }
}

@media (max-width: 480px) {
  .brand h2 {
    font-size: 1.4em;
  }

  .section-heading h2 {
    font-size: 1.5em;
  }

  main {
    padding: 0 1em 2em;
  }

  .form-wrapper {
    padding: 1em;
  }

  .form-group {
    margin-bottom: 1.2em;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    padding: 0.7em 0.8em;
    font-size: 16px;
  }

  label {
    font-size: 0.9em;
    margin-bottom: 0.5em;
  }

  .radio-label,
  .checkbox-label {
    font-size: 0.95em;
  }

  button[type="submit"],
  button[type="reset"] {
    padding: 0.9em;
    font-size: 0.95em;
  }

  .success-message {
    padding: 2em 1em;
  }

  .success-message h3 {
    font-size: 1.4em;
  }

  .success-message i {
    font-size: 2.5em;
  }

  .footer-content h2 {
    font-size: 1.4em;
  }

  .footer-content h5 {
    font-size: 0.9em;
  }

  .social-networks {
    gap: 1em;
  }

  .social-networks a {
    font-size: 1.5em;
  }
}

/* ========================================================================== */
/* ===  SECCIÓN: BOTÓN VOLVER ARRIBA (SCROLL TO TOP)  === */
/* ========================================================================== */

.scroll-to-top {
  /* Fijo en la esquina inferior derecha */
  position: fixed;
  bottom: 25px;
  right: 25px;

  /* Diseño del botón */
  background-color: #c60e0f; /* Color principal de tu marca (rojo/vinotinto) */
  color: #fff;
  width: 45px;
  height: 45px;
  line-height: 45px; /* Centra el icono verticalmente */
  text-align: center;
  border-radius: 50%;
  font-size: 1.2em;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 999;

  /* Animación de visibilidad/transición */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.scroll-to-top:hover {
  background-color: #9c0b0c; /* Tono más oscuro al pasar el ratón */
  transform: translateY(-2px); /* Pequeño efecto de elevación */
}

/* Clase para mostrar el botón cuando el usuario hace scroll */
.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

/* ========================================================================== */
/* CALCULADORA DE DIVISAS CON API */
/* ========================================================================== */

.currency-calculator {
  background: #fff;
  padding: 1.5em; /* Reducir el padding externo */
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  /* Eliminamos margin y max-width: la calculadora debe ocupar el 100% del sidebar (350px) */
  position: relative;
  font-family: inherit; /* Mejor heredar la fuente principal (Montserrat) */
}

.calculator-header {
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin-bottom: 1.5em;
  padding-bottom: 1em;
  border-bottom: 2px solid #c60e0f;
}

.calculator-header i {
  font-size: 1.8em;
  color: #c60e0f;
}

.calculator-header h3 {
  font-size: 1.4em;
  color: #222;
  margin: 0;
  flex: 1;
}

.refresh-btn {
  background: #f0f0f0;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: #555;
  font-size: 1em;
}

.refresh-btn:hover {
  background: #c60e0f;
  border-color: #c60e0f;
  color: #fff;
}

.refresh-btn:active {
  transform: rotate(360deg);
}

.calculator-body {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  position: relative;
}

.currency-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.currency-input-group label {
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
}

.currency-input-group input {
  padding: 0.8em 1em;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
  transition: border-color 0.3s;
  font-family: inherit; /* Usar la fuente del body si no se especifica otra */
}

.currency-input-group input:focus {
  outline: none;
  border-color: #c60e0f;
  box-shadow: 0 0 0 3px rgba(198, 14, 15, 0.1);
}

/* formulario.css (Aproximadamente en la línea 646) */

.currency-select-group {
  display: grid;
  /* Cambiar a una sola columna (vertical) */
  grid-template-columns: 1fr; /* Antes: 1fr auto 1fr */
  gap: 1em; /* Un gap más generoso ahora que están apilados */
  align-items: center; /* Centrar elementos verticalmente */
  justify-items: center; /* Centrar elementos horizontalmente */
}

.currency-from,
.currency-to {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.currency-from label,
.currency-to label {
  font-weight: 600;
  color: #333;
  font-size: 0.95em;
}

.currency-select-group select {
  padding: 0.8em;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.95em;
  color: #333;
  cursor: pointer;
  transition: border-color 0.3s;
  font-family: inherit;
  background-color: #fff;
}

.currency-select-group select:focus {
  outline: none;
  border-color: #c60e0f;
  box-shadow: 0 0 0 3px rgba(198, 14, 15, 0.1);
}

/* formulario.css (Aproximadamente en la línea 675) */

.swap-btn {
  background: #f0f0f0;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  width: 40px; /* Tamaño reducido de la corrección anterior (mantener) */
  height: 40px; /* Tamaño reducido de la corrección anterior (mantener) */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: #555;
  font-size: 1.2em;
  /* Aplicar rotación para que las flechas apunten hacia arriba/abajo */
  transform: rotate(90deg);
  margin: 0.5em auto; /* Pequeño margen vertical y centrado horizontal */
}

/* Modificar el hover para reflejar la rotación vertical */
.swap-btn:hover {
  background: #c60e0f;
  border-color: #c60e0f;
  color: #fff;
  transform: rotate(270deg); /* Continúa la rotación en el mismo eje */
}

.result-display {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  padding: 1.5em;
  border-radius: 10px;
  text-align: center;
  border-left: 4px solid #c60e0f;
}

.result-amount {
  font-size: 2em;
  font-weight: 700;
  color: #c60e0f;
  margin-bottom: 0.3em;
}

.exchange-rate {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 0.3em;
}

.last-update {
  font-size: 0.75em;
  color: #999;
  font-style: italic;
}

.calculate-btn {
  background: #c60e0f;
  color: #fff;
  border: none;
  padding: 1em;
  border-radius: 8px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
}

.calculate-btn:hover {
  background: #9c0b0c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(198, 14, 15, 0.3);
}

.info-note {
  display: flex;
  gap: 0.8em;
  align-items: flex-start;
  background: #e8f5e9;
  padding: 1em;
  border-radius: 8px;
  border-left: 3px solid #4caf50;
}

.info-note i {
  color: #4caf50;
  font-size: 1.2em;
  flex-shrink: 0;
  margin-top: 0.2em;
}

.info-note p {
  margin: 0;
  font-size: 0.85em;
  color: #2e7d32;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 10;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #c60e0f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-overlay p {
  margin-top: 1em;
  color: #666;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
  .currency-calculator {
    padding: 1.5em;
  }

  .currency-select-group {
    grid-template-columns: 1fr;
    gap: 1em;
  }

  .swap-btn {
    transform: rotate(90deg);
    margin: 0 auto;
  }

  .swap-btn:hover {
    transform: rotate(270deg);
  }

  .result-amount {
    font-size: 1.6em;
  }
}
