/* ==========================================================================
   PLUX HERRAMIENTAS: RULETA, BITÁCORA Y LOGROS (DISEÑO LIMPIO Y SOBRIO)
   ========================================================================== */

#modal-ruleta,
#modal-bitacora,
#modal-logros {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.plux-tool-modal-card {
  background: linear-gradient(145deg, var(--card, #1e293b), var(--fondo, #0f172a));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 20px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7);
  color: var(--texto, #f8fafc);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  width: 95%;
  max-width: 920px;
  overflow: hidden;
  position: relative;
  animation: pluxModalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pluxModalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.plux-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  background: rgba(255, 255, 255, 0.02);
}

.plux-tool-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.2px;
}

.plux-tool-header h2 i {
  color: var(--verde, #10b981);
}

.plux-tool-close-btn {
  background: transparent;
  border: none;
  color: var(--gris, #94a3b8);
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  opacity: 0.6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.plux-tool-close-btn:hover {
  opacity: 1;
  color: #ef4444;
  background: transparent;
  transform: rotate(90deg) scale(1.2);
}

/* 1. RULETA */
.ruleta-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
  overflow-y: auto;
  align-items: center;
}

@media (max-width: 820px) {
  .ruleta-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.ruleta-canvas-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ruleta-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 24px solid #ef4444;
  z-index: 10;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.5));
}

#ruleta-canvas {
  width: 310px;
  height: 310px;
  max-width: 100%;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(37, 99, 235, 0.25), 0 8px 30px rgba(0,0,0,0.6);
  border: 4px solid rgba(255, 255, 255, 0.18);
  background: #0f172a;
}

.ruleta-spin-btn {
  margin-top: 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 32px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ruleta-spin-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}

.ruleta-spin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ruleta-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.ruleta-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ruleta-preset-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--texto, #f8fafc);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ruleta-preset-btn:hover {
  background: var(--verde, #10b981);
  color: white;
  border-color: var(--verde, #10b981);
}

.ruleta-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.ruleta-option-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}

.ruleta-del-opt-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}

.ruleta-winner-banner {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: #34d399;
  display: none;
}

/* 2. BITÁCORA */
.bitacora-container {
  display: flex;
  flex-direction: column;
  height: 80vh;
  overflow: hidden;
}

.bitacora-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  gap: 12px;
  flex-wrap: wrap;
}

.bitacora-btn-primary {
  background: var(--verde, #10b981);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.bitacora-btn-primary:hover {
  background: #059669;
}

.bitacora-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bitacora-entry-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 18px;
  position: relative;
  transition: border-color 0.2s ease;
}

.bitacora-entry-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.bitacora-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bitacora-entry-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.bitacora-entry-meta {
  color: var(--gris, #94a3b8);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bitacora-dest-badge {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.bitacora-entry-body {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.bitacora-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bitacora-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.bitacora-del-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.bitacora-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.bitacora-media-item {
  width: 100%;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  background: #000;
}

.bitacora-video-player {
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  background: #000;
  grid-column: span 2;
}

.bitacora-upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}

.bitacora-upload-zone:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.04);
}

/* 3. LOGROS Y HITOS */
.logros-container {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 80vh;
}

.logros-progress-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logros-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.logros-progress-bar-fill {
  height: 100%;
  background: var(--verde, #10b981);
  width: 0%;
  transition: width 0.5s ease;
}

.logros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.logro-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.07));
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: all 0.2s ease;
}

.logro-card.desbloqueado {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.05);
}

.logro-card.bloqueado {
  opacity: 0.5;
  filter: grayscale(1);
}

.logro-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--gris, #94a3b8);
  flex-shrink: 0;
}

.logro-card.desbloqueado .logro-icon-bubble {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.logro-info h4 {
  margin: 0 0 3px 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.logro-info p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gris, #94a3b8);
  line-height: 1.35;
}

.logro-unlocked-date {
  font-size: 0.72rem;
  color: #10b981;
  font-weight: 600;
  margin-top: 4px;
}


/* Tabs de Categorías de Logros */
.logros-tabs-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.logros-cat-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--gris, #94a3b8);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.logros-cat-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.logros-cat-tab.active {
  background: var(--verde, #10b981);
  border-color: var(--verde, #10b981);
  color: #fff;
}

/* Grilla perfecta de 2 columnas para el panel de herramientas */
#modal-panel-herramientas .panel-herramientas-content {
  max-width: 720px !important;
  width: 95% !important;
}

#modal-panel-herramientas .herramientas-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
}

@media (max-width: 600px) {
  #modal-panel-herramientas .herramientas-grid {
    grid-template-columns: 1fr !important;
  }
}
