/* ========== VARIABLES GLOBALES ========== */
:root {
  --verde: #8ACC34;
  --azul: #44ABA8;
  --morado: #733298;
  --blanco: #ffffff;
  --gris: #f8f8f8;
  --gris-oscuro: #f0f0f0;
  --rojo: #f44336;
  --verde-exito: #4caf50;
  --azul-info: #2196f3;
}

/* ========== ESTILOS GENERALES ========== */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--verde), var(--azul));
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
}

h1, h2 {
  color: var(--morado);
  text-align: center;
  margin-bottom: 25px;
  text-shadow: 1px 2px 4px rgba(0,0,0,0.1);
}

h1 {
  color: var(--blanco);
  text-shadow: 1px 2px 6px rgba(0,0,0,0.2);
}

/* ========== CONTENEDORES DE FORMULARIOS ========== */
.form-container {
  background: var(--blanco);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 400px;
  border-top: 6px solid var(--verde);
  margin-bottom: 20px;
}

/* Para formulario-datos.html - más ancho */
.form-container.datos {
  max-width: 420px;
  padding: 35px;
}

/* ========== CAMPOS DE FORMULARIO ========== */
.campo {
  margin-bottom: 22px;
}

.campo label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
  font-size: 15px;
}

/* Inputs y selects generales */
input, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--verde);
  font-size: 15px;
  background-color: var(--gris);
  transition: all 0.3s ease;
  appearance: none;
  box-sizing: border-box;
  font-family: inherit;
}

/* Select específico */
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--verde) 50%), 
                  linear-gradient(135deg, var(--verde) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(1em + 4px), calc(100% - 15px) calc(1em + 4px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* Focus states */
input:focus,
select:focus {
  border-color: var(--azul);
  box-shadow: 0 0 8px rgba(68, 171, 168, 0.4);
  outline: none;
  background-color: var(--blanco);
}

/* Campos bloqueados (solo lectura) */
.campo.bloqueado input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 2px solid var(--verde);
  font-size: 15px;
  background-color: var(--gris);
  transition: all 0.3s ease;
  appearance: none;
  box-sizing: border-box;
  font-family: inherit;
  pointer-events: none;
}

/* ========== BOTONES ========== */
button {
  width: 100%;
  background-color: var(--verde);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  margin-top: 20px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: all 0.3s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

button:hover {
  background-color: var(--morado);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(115, 50, 152, 0.3);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Botón copiar enlace */
.btn-copiar {
  background-color: var(--morado);
  width: auto;
  padding: 10px 20px;
  font-size: 14px;
  margin-top: 10px;
}

.btn-copiar:hover {
  background-color: var(--azul);
}

/* ========== MENSAJES ========== */
.mensaje {
  background-color: #e8f5e9;
  border: 2px solid var(--verde-exito);
  padding: 18px;
  border-radius: 12px;
  margin-top: 25px;
  text-align: center;
  display: none;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
}

.mensaje.error {
  background-color: #ffebee;
  border-color: var(--rojo);
}

.mensaje.info {
  background-color: #e3f2fd;
  border-color: var(--azul-info);
}

/* ========== INFO QR ========== */
.info-qr {
  background-color: rgba(227, 242, 253, 0.9);
  border: 2px solid var(--azul-info);
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 25px;
  font-size: 15px;
  text-align: center;
  color: #0d47a1;
  font-weight: 500;
}

/* ========== TARJETA QR ========== */
.qr-card {
  margin-top: 30px;
  background-color: var(--blanco);
  border: 3px solid var(--verde);
  border-radius: 20px;
  padding: 25px;
  width: 100%;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.qr-card h2 {
  color: var(--morado);
  margin-bottom: 15px;
  font-size: 22px;
}

.qr-card p {
  font-size: 14px;
  color: #666;
  margin-top: 15px;
  line-height: 1.4;
}

/* ========== CONTENEDOR QR ========== */
#qrContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
  background-color: var(--blanco);
  border-radius: 12px;
  padding: 10px;
}

/* ========== PANEL DE COMPARTIR ========== */
.share-panel {
  display: none;
  margin: 25px auto 0;
  background: var(--blanco);
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 380px;
  border: 2px solid var(--verde);
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

.share-panel h3 {
  color: var(--morado);
  text-align: center;
  margin-bottom: 25px;
  font-size: 20px;
  font-weight: 600;
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px 5px;
  border-radius: 12px;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  min-height: 85px;
}

.share-btn i {
  font-size: 28px;
  margin-bottom: 8px;
}

.share-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  filter: brightness(1.1);
}

.share-btn:active {
  transform: translateY(0);
}

/* Colores específicos */
.whatsapp { background: linear-gradient(135deg, #25D366, #128C7E); }
.email { background: linear-gradient(135deg, #EA4335, #D14836); }
.telegram { background: linear-gradient(135deg, #0088cc, #006699); }
.sms { background: linear-gradient(135deg, #34B7F1, #0D8BDB); }
.copy { background: linear-gradient(135deg, var(--morado), #5a2a7a); }
.download { background: linear-gradient(135deg, var(--azul), #3a9c99); }

.share-link {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.share-link input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.share-link button {
  background-color: var(--verde);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
  min-width: 50px;
}

.share-link button:hover {
  background-color: var(--azul);
}

.close-share {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 22px;
  color: #888;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: 0.3s;
}

.close-share:hover {
  background-color: #f5f5f5;
  color: var(--rojo);
}

.qr-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
  flex-wrap: wrap;
}

.qr-actions button {
  width: auto;
  padding: 12px 25px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  min-width: 140px;
  justify-content: center;
}

.btn-share {
  background-color: var(--azul);
}

.btn-share:hover {
  background-color: #3a9c99;
}

/* Notificación flotante */
.notification {
  position: fixed;
  top: 25px;
  right: 25px;
  background: var(--verde-exito);
  color: white;
  padding: 18px 24px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  display: none;
  z-index: 1000;
  animation: slideIn 0.4s ease-out;
  max-width: 350px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.notification.error {
  background: linear-gradient(135deg, var(--rojo), #d32f2f);
}

@keyframes slideIn {
  from { 
    transform: translateX(100%) translateY(-20px); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0) translateY(0); 
    opacity: 1; 
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive */
@media (max-width: 480px) {
  .share-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .share-btn {
    min-height: 80px;
    font-size: 12px;
  }
  
  .share-btn i {
    font-size: 24px;
  }
  
  .qr-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .qr-actions button {
    width: 100%;
    max-width: 250px;
  }
  
  .notification {
    left: 20px;
    right: 20px;
    max-width: none;
  }
}

/* Efecto de pulso para botón compartir */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.btn-share.pulse {
  animation: pulse 1s infinite;
}

/* Estilo para cuando hay datos cargados */
.form-container:has(input:valid):has(select:valid) {
  border-color: var(--azul);
  transition: border-color 0.3s ease;
}

/* ========== UTILIDADES ========== */
.requerido::after {
  content: " *";
  color: var(--rojo);
  font-weight: bold;
}

.texto-centro {
  text-align: center;
}

.texto-pequeno {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
  body {
    padding: 15px;
  }
  
  .form-container {
    padding: 25px;
    max-width: 100%;
  }
  
  .form-container.datos {
    padding: 25px;
  }
  
  .qr-card {
    padding: 20px;
    max-width: 100%;
  }
  
  input, select, button {
    padding: 14px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
}

/* ========== ANIMACIONES ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-container, .qr-card {
  animation: fadeIn 0.4s ease-out;
}

/* ========== ESTADOS DE CARGA ========== */
.cargando {
  position: relative;
  color: transparent !important;
}

.cargando::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

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