:root {
  --rosa: #f8c7d6;
  --azul: #c7e8f8;
  --lila: #e4c7f8;
  --suave: #fdf7ff;
  --gris: #444;
  --borde: #ddd;
  --hover: #f2eaff;
}

body.comisiones-body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--suave);
  color: var(--gris);
  margin: 0;
  padding: 0;
}

header {
  background: linear-gradient(to right, var(--rosa), var(--azul));
  padding: 20px;
  text-align: center;
  border-bottom: 2px solid var(--borde);
}

header h1 {
  margin: 0;
  font-size: 2em;
  color: #fff;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 1rem 2rem;
  position: relative;
}

.nav-left {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: center;
}

nav a,
nav button {
  margin: 0 5px;
  padding: 10px 15px;
  background: white;
  border: none;
  border-radius: 20px;
  text-decoration: none;
  color: var(--gris);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

nav a:hover,
nav button:hover {
  background: var(--lila);
  color: #222;
}

#login-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  margin-left: auto;
}

#login-box button {
  background: var(--rosa);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

#login-box button:hover {
  background: var(--azul);
  color: var(--gris);
}

#user-info {
  font-size: 0.85rem;
  color: var(--gris);
  text-align: right;
}

#user-info img {
  margin-top: 5px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--lila);
}

#comisiones-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 30px;
  max-width: 1000px;
  margin: auto;
}

.comision-card {
  background: white;
  border: 2px solid var(--rosa);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: transform 0.2s ease;
}

.comision-card:hover {
  transform: translateY(-3px);
  background: var(--hover);
}

.comision-card .info {
  flex: 1;
}

.comision-card h2 {
  margin: 0 0 10px;
  color: var(--gris);
}

.precio {
  font-weight: bold;
  color: #5b5b5b;
  margin-bottom: 10px;
}

.imagenes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  margin: 15px 0;
  padding: 12px;
  background: linear-gradient(135deg, #fff5f9 0%, #f5f9ff 100%);
  border-radius: 15px;
  min-height: 100px;
  align-content: start;
  max-width: 400px;
}

.imagenes img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--azul);
  background: #fff;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.imagenes img:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(88, 124, 224, 0.3);
}

.boton-comisionar button {
  background: var(--rosa);
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s ease;
}

.boton-comisionar button:hover {
  background: var(--azul);
  color: var(--gris);
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

label {
  font-weight: bold;
  color: var(--gris);
}

input, select, textarea {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--borde);
  font-size: 1em;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

button[type="submit"] {
  background: var(--azul);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s ease;
  margin-bottom: 1rem;
}

button[type="submit"]:hover {
  background: var(--rosa);
  color: var(--gris);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 220, 250, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-content {
  background-color: #fff0f8;
  border: 2px solid #ffb3e6;
  padding: 20px 30px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  text-align: center;
  animation: aparecer 0.3s ease;
  max-width: 500px;
  width: 90%;
  margin: 5vh auto;
  /* 👇 Agregado para scroll */
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

button.cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.5em;
  color: #d45ab2;
  cursor: pointer;
  z-index: 2;
  padding: 0 8px;
  transition: color 0.2s;
}
button.cerrar:hover {
  color: #a040a0;
  background: #f8c7d6;
  border-radius: 50%;
}

.modal-content button {
  background-color: #ffb3e6;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  margin-top: 10px;
  cursor: pointer;
  font-weight: bold;
}

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

/* 🌟 Móvil */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.5em;
  }

  nav {
    flex-direction: column;
    gap: 10px;
    align-items: center;
  }

  .nav-left {
    position: static;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
  }

  #login-box {
    align-items: center;
    margin-left: 0;
  }

  .comision-card {
    flex-direction: column;
    text-align: center;
    padding: 15px;
    gap: 15px;
  }

  .imagenes {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .imagenes img {
    width: 100%;
    aspect-ratio: 1;
  }

  .boton-comisionar {
    width: 100%;
  }

  .boton-comisionar button {
    width: 100%;
    font-size: 1em;
  }

  .modal-content {
    padding: 20px 6px 12px 6px;
    max-width: 98vw;
    width: 98vw;
    margin: 0 2vw;
  }
  button.cerrar {
    font-size: 1.3em;
    top: 6px;
    right: 6px;
  }
}

/* Notificaciones estilo burbuja */
.noti-burbuja {
  background: white;
  border: 2px solid var(--azul);
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(120, 200, 255, 0.10);
  padding: 16px 18px;
  margin-bottom: 18px;
  transition: background 0.2s, border 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.noti-burbuja:hover {
  background: var(--azul);
  border-color: var(--azul);
  color: var(--gris);
  box-shadow: 0 4px 16px rgba(120, 200, 255, 0.18);
}

#lista-notificaciones {
  list-style: none;
  padding: 0;
  margin: 0;
}
#lista-notificaciones .noti-burbuja {
  font-size: 1em;
}
#lista-notificaciones .noti-burbuja strong {
  color: #b84cbf;
}
#lista-notificaciones .noti-burbuja .noti-fecha {
  font-size: 0.85em;
  color: #888;
  margin-top: 2px;
}

.custom-file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px 0;
}
.custom-file-upload label[for="imagen"],
.custom-file-upload label[for="imagen-paquete"] {
  background: #b84cbf;
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 1em;
  border: none;
  outline: none;
  box-shadow: 0 2px 8px #b84cbf22;
  margin-right: 8px;
}
.custom-file-upload label[for="imagen"]:hover,
.custom-file-upload label[for="imagen-paquete"]:hover {
  background: #703377;
  color: #fff;
}
.custom-file-upload #nombre-archivo {
  color: #703377;
  font-size: 0.98em;
  font-style: italic;
  background: #fff7fc;
  border-radius: 6px;
  padding: 4px 10px;
}
.custom-file-upload input[type="file"] {
  display: none;
}

/* Estilo bonito y sutil para el link de ejemplo externo */
.url-ejemplo-link {
  display: inline-block;
  background: #f8c7d6;
  color: #703377;
  border-radius: 10px;
  padding: 7px 16px;
  font-weight: 500;
  font-size: 1em;
  text-decoration: none;
  border: 1.5px solid #e4c7f8;
  box-shadow: 0 2px 8px #f8c7d622;
  margin: 8px 0 0 0;
  transition: background 0.18s, color 0.18s, border 0.18s, box-shadow 0.18s;
}
.url-ejemplo-link:hover, .url-ejemplo-link:focus {
  background: #e4c7f8;
  color: #b84cbf;
  border-color: #b84cbf;
  text-decoration: underline;
  box-shadow: 0 4px 16px #e4c7f822;
}

/* 🖼️ Vista previa de imagen */
#preview-container {
  margin: 15px 0;
  padding: 10px;
  border: 2px dashed var(--borde);
  border-radius: 8px;
  background: #fafafa;
  text-align: center;
}

.preview-frame {
  display: inline-block;
  max-width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

#preview-imagen {
  display: block;
  max-width: 280px;
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  margin: 0 auto;
}

/* Estilos específicos para paquete - vista previa pequeña */
#preview-container-paquete {
  margin: 15px 0;
  padding: 10px;
  border: 2px dashed var(--borde);
  border-radius: 8px;
  background: #fafafa;
  text-align: center;
}

#preview-imagen-paquete {
  display: block;
  max-width: 220px;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  margin: 0 auto;
}

/* Contenedor con medidas específicas para controlar el tamaño */
#preview-container::after {
  content: "";
  display: block;
  clear: both;
}

/* Responsive para móviles */
@media (max-width: 600px) {
  #preview-imagen {
    max-width: 220px;
    max-height: 220px;
  }

  #preview-imagen-paquete {
    max-width: 160px;
    max-height: 160px;
  }
  
  #preview-container {
    margin: 10px 0;
    padding: 8px;
  }
  
  .preview-frame {
    padding: 6px;
  }
}

/* 🌟 Móvil */
@media (max-width: 600px) {
  #lista-notificaciones .noti-burbuja {
    padding: 12px 8px;
    font-size: 0.98em;
  }
}

/* ========== ESTILOS PARA PAQUETES ========== */

.tabs-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.tab-btn {
  padding: 12px 24px;
  border: 2px solid var(--rosa);
  background: white;
  color: var(--gris);
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: var(--rosa);
  color: white;
}

.tab-btn:hover {
  background: var(--lila);
  color: white;
}

.paquete-card {
  background: white;
  border: 2px solid var(--azul);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.08);
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 20px;
  align-items: center;
  transition: transform 0.2s ease;
  margin-bottom: 20px;
}

.paquete-card:hover {
  transform: translateY(-3px);
  background: var(--hover);
}

.paquete-info {
  flex: 1;
}

.paquete-card h2 {
  margin: 0 0 10px;
  color: var(--gris);
}

.paquete-descripcion {
  color: #666;
  margin-bottom: 10px;
  font-size: 0.95em;
}

.paquete-items-preview,
.paquete-precios-preview {
  color: #555;
  margin-bottom: 8px;
  font-size: 0.9em;
}

.paquete-items-preview strong,
.paquete-precios-preview strong {
  color: var(--gris);
}

.paquete-imagenes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
  margin: 15px 0;
  padding: 12px;
  background: linear-gradient(135deg, #fff5f9 0%, #f5f9ff 100%);
  border-radius: 15px;
  align-content: start;
  max-width: 400px;
}

.paquete-imagenes img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--azul);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.paquete-imagenes img:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(88, 124, 224, 0.3);
}

.paquete-boton {
  display: flex;
  justify-content: center;
}

.btn-paquete {
  background: var(--azul);
  border: none;
  padding: 12px 20px;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s ease;
  white-space: nowrap;
}

.btn-paquete:hover:not(:disabled) {
  background: var(--rosa);
  color: var(--gris);
  transform: scale(1.05);
}

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

/* Modal de selección de items */
#modal-paquete-items .modal-content {
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

#paquete-items-container {
  display: grid;
  gap: 15px;
  margin: 20px 0;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.paquete-item-selector {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #f9f5ff;
  border: 2px solid #e0d5ff;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.paquete-item-selector:hover {
  background: #f0e6ff;
  border-color: var(--rosa);
}

.paquete-item-selector input[type="checkbox"] {
  width: auto;
  margin-left: auto;
  margin-right: 0;
  cursor: pointer;
  width: 20px;
  height: 20px;
}

.item-selector-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.item-selector-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--borde);
}

.item-selector-info {
  flex: 1;
  text-align: left;
}

.item-selector-info h4 {
  margin: 0 0 5px 0;
  color: var(--gris);
  font-size: 0.95em;
}

.item-selector-info p {
  margin: 0;
  color: #777;
  font-size: 0.85em;
}

#paquete-precio-info {
  background: linear-gradient(to right, #f8e6ff, #fff0f8);
  border-left: 4px solid var(--rosa);
  padding: 15px;
  border-radius: 10px;
  margin: 15px 0;
}

#paquete-precio-info p {
  margin: 5px 0;
  color: var(--gris);
}

#precio-total {
  font-size: 1.5em;
  color: var(--rosa);
}

/* Responsive para paquetes */
@media (max-width: 768px) {
  .paquete-card {
    grid-template-columns: 1fr;
  }
  
  .paquete-imagenes {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    padding: 10px;
  }
  
  .paquete-imagenes img {
    width: 100%;
    aspect-ratio: 1;
  }
  
  #paquete-items-container {
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .tabs-container {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    flex: 1;
    min-width: 150px;
  }
  
  .paquete-card {
    padding: 15px;
  }
  
  .paquete-imagenes {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 6px;
    padding: 8px;
  }
  
  .paquete-imagenes img {
    width: 100%;
    aspect-ratio: 1;
  }
  
  .item-selector-img {
    width: 50px;
    height: 50px;
  }
}
