/* Reset y configuración básica */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  transition: background 4s ease, color 4s ease;
  padding: 0 1rem;
  overflow-x: hidden;
}

/* Barra de navegación minimalista */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 0.8rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 100;
  animation: fadeIn 0.8s ease;
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.coleccion-selector,
.voice-selector {
  padding: 0.5rem 1rem;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.coleccion-selector {
  min-width: 180px;
  font-weight: 600;
}

.coleccion-selector:hover,
.voice-selector:hover {
  background: rgba(255, 255, 255, 0.05);
}

.coleccion-selector:focus,
.voice-selector:focus {
  outline: none;
  border-width: 2px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.nav-btn.active {
  border-width: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.voice-selector {
  min-width: 160px;
  max-width: 200px;
  display: none;
}

.voice-selector.visible {
  display: block;
}

/* Header */
header {
  margin-top: 12vh;
  animation: fadeIn 1s ease-in;
}

h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 1px;
  transition: color 4s ease;
}

h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-top: 0.5rem;
  transition: color 4s ease;
  opacity: 0.9;
}

/* Información de colección */
.collection-info {
  margin-top: 3vh;
  max-width: 600px;
  padding: 1rem;
  padding-left: 1.2rem;
  border-radius: 12px;
  border-left: 4px solid currentColor;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  animation: slideDown 0.6s ease;
}

.collection-name {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.collection-desc {
  font-size: 0.95rem;
  opacity: 0.8;
  font-style: italic;
}

/* Main content */
main {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  margin-top: 4vh;
  width: 100%;
  max-width: 700px;
}

.message-container {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem 1rem;
}

.message-text {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0;
  max-width: 800px;
  white-space: pre-wrap;
  word-wrap: break-word;
  border-right: 0.15em solid currentColor;
  overflow: hidden;
  min-height: 2em;
  transition: opacity 2s ease;
  margin: 0;
  animation: blink 0.7s step-end infinite;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: currentColor; }
}

.message-text.complete {
  border-right: none;
  animation: none;
}

/* CTA Button */
.cta {
  margin-top: 8vh;
  padding: 1.1rem 3rem;
  border: 3px solid currentColor;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s ease;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cta:hover {
  background: currentColor;
  color: var(--bg-color);
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.cta:active {
  transform: scale(1.02);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 2rem 0;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 4s ease;
}

footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Animaciones */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Loading state */
.loading {
  font-size: 1.2rem;
  opacity: 0.7;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Responsive */
/* Pantallas muy grandes */
@media (min-width: 1200px) {
  .message-text {
    font-size: 2.5rem;
    max-width: 900px;
  }

  main {
    max-width: 900px;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-left,
  .navbar-right {
    gap: 0.5rem;
  }

  .coleccion-selector {
    min-width: 140px;
    font-size: 0.85rem;
  }

  .voice-selector {
    min-width: 130px;
    font-size: 0.85rem;
  }

  .nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  header {
    margin-top: 14vh;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .message-text {
    font-size: 1.4rem;
    line-height: 1.7;
  }

  .cta {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  .collection-info {
    margin-top: 2vh;
    padding: 0.8rem;
  }

  .collection-name {
    font-size: 1.1rem;
  }

  .collection-desc {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0.4rem 0.5rem;
    gap: 0.4rem;
  }

  .navbar-left {
    width: 100%;
    justify-content: center;
    order: 1;
  }

  .navbar-right {
    width: 100%;
    justify-content: space-between;
    order: 2;
  }

  .coleccion-selector {
    width: 100%;
    text-align: center;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .voice-selector {
    flex: 1;
    max-width: calc(100% - 90px);
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }

  .nav-btn {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  body {
    padding: 0 0.5rem;
  }

  header {
    margin-top: 15vh;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1rem;
  }

  .message-text {
    font-size: 1.35rem;
    line-height: 1.75;
  }
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
  .collection-info,
  .tag {
    background: rgba(255, 255, 255, 0.15);
  }
}

/* Estados de accesibilidad */
button:focus-visible,
select:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

/* Botón flotante de compartir */
.share-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: rgba(255, 255, 255, 0.9);
  color: #4B0082;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-share 2s infinite;
}

.share-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.share-btn:active {
  transform: scale(0.95);
}

@keyframes pulse-share {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 6px 20px rgba(75, 0, 130, 0.3);
  }
}

/* Modal de QR */
.qr-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.qr-modal.active {
  display: flex;
}

.qr-content {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.qr-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: #333;
}

.qr-close:hover {
  background: #e0e0e0;
  transform: rotate(90deg);
}

.qr-content h3 {
  color: #4B0082;
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
}

.qr-code {
  margin: 0 auto 1rem;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  display: inline-block;
}

.qr-code canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-text {
  color: #666;
  margin: 0.5rem 0;
  font-size: 1rem;
}

.qr-url {
  color: #4B0082;
  font-size: 0.85rem;
  word-break: break-all;
  margin: 0.5rem 0;
  font-weight: 600;
}

.end-message {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(5px);
  animation: fadeIn 1s ease;
}

.end-message h4 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
  opacity: 0.9;
}

.end-message p {
  margin: 0.5rem 0;
  opacity: 0.8;
  font-size: 0.95rem;
}
