/* 
  styles.css - Estilos para la aplicación "Reza por un Cardenal"
  Archivo CSS externo con todos los estilos de la aplicación
*/

:root {
  --cardinal-red: #c41e3a;
  --cardinal-red-light: #e54b5d;
  --cardinal-red-dark: #a31b30;
  --gold: #d4af37;
  --gold-light: #e7c860;
  --light-bg: #f9f7f4;
  --dark-text: #2a2a2a;
  --light-text: #fff;
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: "Montserrat", sans-serif;
  background-color: var(--light-bg);
  color: var(--dark-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2.5rem 1.5rem;
  background-image: url("/public/images/banner.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  line-height: 1.6;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.78)
  );
  z-index: -1;
}

.container {
  max-width: 800px;
  width: 95%;
  background-color: rgba(255, 255, 255, 0.97);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.header {
  margin-bottom: 2.5rem;
  position: relative;
}

.logo {
  width: auto;
  height: 70px;
  margin: 0 auto 1.8rem;
  display: block;
  object-fit: contain;
  transition: var(--transition);
}

.logo:hover {
  transform: scale(1.03);
}

h1 {
  color: var(--cardinal-red);
  font-size: 2.4rem;
  margin-bottom: 0.8rem;
  font-weight: 700;
  position: relative;
  display: inline-block;
  letter-spacing: 0.5px;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--cardinal-red-dark),
    var(--cardinal-red),
    var(--cardinal-red-light)
  );
  border-radius: 5px;
}

.description {
  max-width: 650px;
  margin: 0 auto 1.2rem;
  font-size: 1.15rem;
  line-height: 1.7;
  color: #444;
  padding: 0 1rem;
}

.description:last-of-type {
  margin-bottom: 2rem;
}

.description b {
  color: var(--cardinal-red-dark);
  font-weight: 600;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin: 2rem 0;
  position: relative;
}

.custom-date-container {
  display: flex;
  gap: 0.8rem;
  max-width: 320px;
  width: 100%;
}

.date-input {
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  border-radius: 12px;
  border: 2px solid #e0e0e0;
  outline: none;
  transition: var(--transition);
  font-family: "Montserrat", sans-serif;
  background-color: #fff;
  color: #333;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.month-select {
  flex: 1.5;
}

.day-select {
  flex: 1;
}

.date-input:focus {
  border-color: var(--cardinal-red);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

.date-input:hover {
  border-color: #ccc;
}

.btn {
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-width: 170px;
  font-family: "Montserrat", sans-serif;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(
    to right,
    var(--cardinal-red-dark),
    var(--cardinal-red)
  );
  color: var(--light-text);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(
    to right,
    var(--cardinal-red),
    var(--cardinal-red-light)
  );
  transform: translateY(-3px);
  box-shadow: 0 7px 14px rgba(196, 30, 58, 0.25);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(196, 30, 58, 0.3);
}

/* Contenedor de resultados */
.result-container {
  margin-top: 2rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.6s ease, max-height 0.8s ease, min-height 0.8s ease;
  min-height: 0;
  visibility: hidden;
}

.result-container.active {
  opacity: 1;
  min-height: 680px;
  /* Altura mínima para evitar saltos de layout */
  max-height: 2000px;
  padding: 2.5rem;
  background-color: #f9f9f9;
  border-radius: 16px;
  border-left: 5px solid var(--cardinal-red);
  box-shadow: var(--shadow-md);
  position: relative;
  visibility: visible;
}

.result-container.loading {
  background-color: #f9f9f9;
  position: relative;
}

.result-container.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(
    to right,
    var(--cardinal-red-dark),
    var(--cardinal-red),
    var(--cardinal-red-light),
    var(--cardinal-red-dark)
  );
  background-size: 200% 100%;
  animation: loading-gradient 2s linear infinite;
}

@keyframes loading-gradient {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: 0 0;
  }
}

.result-container.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 10% 10%,
      rgba(196, 30, 58, 0.03) 0%,
      transparent 70%
    ),
    radial-gradient(
      circle at 90% 90%,
      rgba(212, 175, 55, 0.03) 0%,
      transparent 70%
    );
  pointer-events: none;
  border-radius: 16px;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cardinal-red);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.result-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 2px;
  background-color: var(--gold);
  border-radius: 2px;
}

.cardinal-image {
  width: 220px;
  height: 220px;
  object-fit: cover;
  object-position: center;
  /* Asegura que la imagen se centre correctamente */
  border-radius: 50%;
  margin: 0 auto 2rem;
  border: 5px solid var(--gold);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: opacity 0.3s ease-in-out,
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform: translateY(0);
  opacity: 1;
  position: relative;
}

.cardinal-image:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  border-color: var(--gold-light);
}

/* Placeholder para la imagen mientras carga */
.cardinal-image[src=""] {
  background-color: #f1f1f1;
  position: relative;
}

.cardinal-image[src=""]:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid #ddd;
  border-top-color: var(--cardinal-red);
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.cardinal-name {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--dark-text);
  transition: var(--transition);
  letter-spacing: 0.5px;
  position: relative;
  display: inline-block;
  padding: 0 15px;
}

.cardinal-name::before,
.cardinal-name::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30px;
  height: 2px;
  background-color: var(--gold);
  transform: translateY(-50%);
}

.cardinal-name::before {
  left: -20px;
}

.cardinal-name::after {
  right: -20px;
}

.prayer {
  font-style: italic;
  color: #444;
  margin: 2rem 0;
  padding: 2rem;
  border-top: 1px solid #e2e2e2;
  border-bottom: 1px solid #e2e2e2;
  line-height: 1.7;
  text-align: left;
  font-size: 1.05rem;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.prayer::before {
  content: '"';
  font-size: 4rem;
  position: absolute;
  top: -5px;
  left: 10px;
  color: rgba(196, 30, 58, 0.1);
  font-family: Georgia, serif;
}

.prayer::after {
  content: '"';
  font-size: 4rem;
  position: absolute;
  bottom: -40px;
  right: 10px;
  color: rgba(196, 30, 58, 0.1);
  font-family: Georgia, serif;
}

.prayer p {
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.prayer strong {
  color: var(--cardinal-red-dark);
}

.share-container {
  margin-top: 2rem;
}

.download-container {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.download-btn {
  padding: 0.9rem 1.8rem;
  background: var(--cardinal-red-dark);
  color: var(--light-text);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-md);
}

.download-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 7px 14px rgba(212, 175, 55, 0.25);
}

.download-btn:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(212, 175, 55, 0.3);
}

.download-btn.loading {
  background: linear-gradient(
    to right,
    var(--cardinal-red-dark),
    var(--cardinal-red)
  );
  opacity: 0.8;
  pointer-events: none;
  /* Evita múltiples clics mientras se procesa */
}

.download-message {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.download-message.visible {
  opacity: 1;
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.share-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.share-btn:hover {
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.share-btn.facebook {
  background: linear-gradient(to bottom right, #4267b2, #3b5998);
}

.share-btn.twitter {
  background: linear-gradient(to bottom right, #1da1f2, #0d8bd9);
}

.share-btn.whatsapp {
  background: linear-gradient(to bottom right, #25d366, #20b858);
}

.footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  font-size: 0.95rem;
  color: #666;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.footer .logo {
  height: 55px;
  margin-bottom: 1rem;
  opacity: 0.95;
}

.footer-tagline {
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin: 0;
  font-size: 0.9rem;
  color: #666;
  position: relative;
  display: inline-block;
  padding: 0 10px;
}

.footer-tagline::before,
.footer-tagline::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 1px;
  background-color: rgba(102, 102, 102, 0.5);
  transform: translateY(-50%);
}

.footer-tagline::before {
  left: -15px;
}

.footer-tagline::after {
  right: -15px;
}

.decoration {
  position: absolute;
  z-index: -1;
}

.decoration-1 {
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(196, 30, 58, 0.05) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.decoration-2 {
  bottom: -80px;
  left: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(212, 175, 55, 0.05) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.decoration-3 {
  top: 30%;
  left: -40px;
  width: 80px;
  height: 80px;
  background: radial-gradient(
    circle,
    rgba(196, 30, 58, 0.03) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.decoration-4 {
  bottom: 30%;
  right: -40px;
  width: 80px;
  height: 80px;
  background: radial-gradient(
    circle,
    rgba(212, 175, 55, 0.03) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

/* Animaciones */
@keyframes fade-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.header,
.description,
.input-group {
  animation: fade-in 0.8s ease-out forwards;
}

.description {
  animation-delay: 0.2s;
}

.input-group {
  animation-delay: 0.4s;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #c7c7c7;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a9a9a9;
}

/* Estilos específicos para dispositivos móviles */
@media (min-width: 768px) {
  .input-group {
    flex-direction: row;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  .container {
    padding: 2rem 1.3rem;
  }

  h1 {
    font-size: 1.9rem;
  }

  .description {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding: 0;
  }

  .cardinal-name {
    font-size: 1.6rem;
  }

  .prayer {
    padding: 1.5rem;
    font-size: 0.95rem;
    margin: 1.5rem 0;
  }

  .logo {
    height: 50px;
  }

  .result-container.active {
    padding: 1.8rem 1.2rem;
    min-height: 550px;
  }

  .cardinal-image {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
  }

  .btn {
    width: 100%;
  }

  .custom-date-container {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1.8rem 1rem;
  }

  .cardinal-name::before,
  .cardinal-name::after {
    width: 15px;
  }

  .cardinal-name::before {
    left: -10px;
  }

  .cardinal-name::after {
    right: -10px;
  }

  .result-container.active {
    min-height: 520px;
  }

  /*** nuevo desde aquí ***/
  /* Estilos para el selector de idiomas */
  .language-selector {
    position: relative;
    display: inline-block;
    margin: 10px 0;
    z-index: 1000;
  }

  .language-select-btn {
    display: flex;
    align-items: center;
    background-color: white;
    border: 1px solid var(--cardinal-red);
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    color: var(--cardinal-red);
    transition: all 0.3s ease;
  }

  .language-select-btn:hover {
    background-color: #f8f8f8;
    border-color: #c51f22;
  }

  .flag-emoji {
    margin-right: 8px;
    font-size: 1.2em;
  }

  .language-select-btn .fa-chevron-down {
    margin-left: 8px;
    font-size: 0.8em;
    transition: transform 0.3s ease;
  }

  .language-select-btn.active .fa-chevron-down {
    transform: rotate(180deg);
  }

  .language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
  }

  .language-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    clear: both;
    font-weight: 400;
    line-height: 1.42857143;
    color: #333;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease;
  }

  .language-option:hover {
    background-color: #f5f5f5;
  }

  .language-option .flag-emoji {
    margin-right: 8px;
    font-size: 1.2em;
  }

  .language-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Estilos personalizados para SweetAlert2 */
  .swal-custom-popup {
    font-family: 'Montserrat', sans-serif;
    border-radius: 10px;
  }
  
  .swal-custom-title {
    font-weight: 600;
    font-size: 1.2rem;
  }
  
  .swal-custom-content {
    font-weight: 400;
  }
  
  .swal2-confirm {
    border-radius: 20px !important;
    padding: 0.5rem 1.5rem !important;
    font-weight: 500 !important;
  }
  
  /* Ocultar inicialmente el contenedor de resultados */
  #result {
    display: none;
  }
  
}
