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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #162447 50%, #0f3460 100%);
  background-attachment: fixed;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(233, 69, 96, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(83, 53, 74, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 80%,
      rgba(15, 52, 96, 0.1) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: -1;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 2rem;
  text-align: center;
  background: linear-gradient(45deg, #e94560, #d73754, #53354a);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
  text-shadow: 0 0 30px rgba(233, 69, 96, 0.3);
  letter-spacing: 2px;
  font-weight: 700;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.confesiones {
  width: 100%;
  max-width: 700px;
  background: rgba(15, 52, 96, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  min-height: 300px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.confesiones::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e94560, transparent);
  border-radius: 20px 20px 0 0;
}

.confesion {
  background: linear-gradient(
    135deg,
    rgba(83, 53, 74, 0.9),
    rgba(83, 53, 74, 0.7)
  );
  backdrop-filter: blur(10px);
  padding: 1.2rem 1.5rem;
  border-radius: 15px;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.confesion:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: rgba(233, 69, 96, 0.3);
}

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

.confesion:last-child {
  margin-bottom: 0;
}

button {
  background: linear-gradient(135deg, #e94560, #d73754);
  border: none;
  padding: 1.2rem 3rem;
  border-radius: 50px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 20px rgba(233, 69, 96, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 2px solid transparent;
  margin-bottom: 20px;
}

button::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: left 0.5s;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(233, 69, 96, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(233, 69, 96, 0.3);
}

@media (max-width: 768px) {
  body {
    padding: 1rem 0.5rem;
  }

  .confesiones {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .confesion {
    padding: 1rem 1.2rem;
  }

  button {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  h1 {
    margin-bottom: 1.5rem;
  }

  .confesiones {
    padding: 1rem;
  }

  .confesion {
    padding: 0.8rem 1rem;
  }
}

/* Estilos para el formulario de confesión */
.form-group {
  margin-bottom: 2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

#confession {
  width: 100%;
  min-height: 150px;
  max-height: 300px;
  background: rgba(83, 53, 74, 0.6);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 1.2rem;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

#confession::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#confession:focus {
  border-color: rgba(233, 69, 96, 0.5);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
  background: rgba(83, 53, 74, 0.8);
}

.char-counter {
  text-align: right;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.form-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.submit-btn {
  background: linear-gradient(135deg, #e94560, #d73754);
  min-width: 180px;
}

.back-btn {
  background: linear-gradient(
    135deg,
    rgba(83, 53, 74, 0.9),
    rgba(83, 53, 74, 0.7)
  );
  border: 2px solid rgba(255, 255, 255, 0.2);
  min-width: 120px;
}

.back-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(83, 53, 74, 1),
    rgba(83, 53, 74, 0.9)
  );
  border-color: rgba(255, 255, 255, 0.3);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.submit-btn:disabled:hover {
  transform: none;
  box-shadow: 0 10px 20px rgba(233, 69, 96, 0.3);
}

.success-message {
  text-align: center;
  padding: 2rem;
  animation: fadeInUp 0.5s ease-out;
}

.success-icon {
  font-size: 4rem;
  color: #4caf50;
  margin-bottom: 1rem;
  animation: bounce 0.6s ease-out;
}

.success-message h3 {
  color: #4caf50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.success-message p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

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

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Responsive para formulario */
@media (max-width: 768px) {
  .form-buttons {
    flex-direction: column;
    align-items: center;
  }

  .submit-btn,
  .back-btn {
    width: 100%;
    max-width: 250px;
  }

  #confession {
    min-height: 120px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .form-group label {
    font-size: 1rem;
  }

  #confession {
    padding: 1rem;
    min-height: 100px;
  }

  .success-icon {
    font-size: 3rem;
  }
}

/* Estilos para confesiones con fecha */
.confesion-texto {
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

.confesion-fecha {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  font-style: italic;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

/* Loading spinner */
.loading-message {
  text-align: center;
  padding: 3rem 2rem;
  color: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid #e94560;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* Mensaje cuando no hay confesiones */
.no-confesiones {
  text-align: center;
  padding: 3rem 2rem;
  color: rgba(255, 255, 255, 0.7);
}

.no-confesiones p {
  font-size: 1.1rem;
  margin: 0;
}

/* Mensaje de error */
.error-message {
  text-align: center;
  padding: 2rem;
  color: #e94560;
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: 10px;
  margin: 1rem 0;
}

/* Animación para nuevas confesiones */
.confesion-nueva {
  animation: slideInFromTop 0.5s ease-out;
}

@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive para fechas */
@media (max-width: 768px) {
  .confesion-fecha {
    font-size: 0.8rem;
  }

  .loading-message {
    padding: 2rem 1rem;
  }

  .loading-spinner {
    width: 35px;
    height: 35px;
  }
}

@media (max-width: 480px) {
  .confesion-texto {
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
  }

  .confesion-fecha {
    font-size: 0.75rem;
  }
}
