/* ═══════════════════════════════════════════════════════
   SERVER MENU SHEET — bottom sheet al tocar los ··· del server
   CHANNEL CONTEXT SHEET — al mantener presionado un canal
   CHANNEL EDIT — pantalla de edición de canal
   ═══════════════════════════════════════════════════════ */

/* ── Overlay base ── */
.sm-overlay,
.cc-overlay,
.ce-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 990;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.sm-overlay.open,
.cc-overlay.open,
.ce-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sheet base ── */
.sm-sheet,
.cc-sheet {
  width: 100%;
  max-width: 520px;
  background: #1e2124;
  border-radius: 16px 16px 0 0;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.06, 0.64, 1);
  will-change: transform;
  max-height: 90vh;
  overflow-y: auto;
}
.sm-overlay.open .sm-sheet,
.cc-overlay.open .cc-sheet {
  transform: translateY(0);
}

/* ── Drag handle ── */
.sm-handle,
.cc-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* ══════════════════════════════
   SERVER MENU SHEET
══════════════════════════════ */
.sm-server-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 20px;
}
.sm-server-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.sm-server-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.sm-server-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f2f3f5;
}
.sm-server-stats {
  display: flex;
  gap: 10px;
  margin-top: 3px;
  font-size: 0.78rem;
  color: #949ba4;
}
.sm-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sm-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #949ba4;
  flex-shrink: 0;
}
.sm-stat-dot.online { background: #3ba55c; }

/* Groups of items */
.sm-group,
.cc-group {
  background: #2b2d31;
  border-radius: 12px;
  margin: 0 12px 8px;
  overflow: hidden;
}

.sm-item,
.cc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: #f2f3f5;
  font-size: 0.97rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}
.sm-item:active,
.cc-item:active {
  background: rgba(255, 255, 255, 0.07);
}
.sm-item + .sm-item,
.cc-item + .cc-item {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sm-item svg,
.cc-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.sm-item.danger,
.cc-item.danger {
  color: #ed4245;
}
.sm-item.danger svg,
.cc-item.danger svg {
  opacity: 1;
}

/* ══════════════════════════════
   CHANNEL CONTEXT SHEET
══════════════════════════════ */
.cc-channel-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #f2f3f5;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* ══════════════════════════════
   CHANNEL EDIT — full screen panel
══════════════════════════════ */
.ce-overlay {
  align-items: flex-start;
  background: #111214;
}
.ce-sheet {
  width: 100%;
  height: 100%;
  background: #111214;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.ce-overlay.open .ce-sheet {
  transform: translateX(0);
}

/* Edit top bar */
.ce-topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  position: relative;
  flex-shrink: 0;
  background: #111214;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ce-back-btn {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #b5bac1;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.15s;
}
.ce-back-btn:active { color: #fff; }
.ce-topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f2f3f5;
}

/* Edit body */
.ce-body {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
}

/* Section list (Editar canal → General, Permisos...) */
.ce-section-group {
  background: #2b2d31;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.ce-section-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: #f2f3f5;
  font-size: 0.97rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s;
}
.ce-section-item:active { background: rgba(255,255,255,0.07); }
.ce-section-item + .ce-section-item {
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ce-section-item svg { flex-shrink: 0; opacity: 0.85; }
.ce-section-item .ce-arrow { margin-left: auto; opacity: 0.5; }
.ce-section-item.danger { color: #ed4245; }
.ce-section-item.danger svg { opacity: 1; }

/* ══════════════════════════════
   GENERAL CHANNEL SETTINGS
══════════════════════════════ */
.cg-overlay {
  position: fixed;
  inset: 0;
  background: #111214;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease;
}
/* La hoja de "Categoría" del canal de voz se abre ENCIMA del panel
   "General" (#voiceGeneralOverlay, .cg-overlay, z-index:1100). Al
   reutilizar la clase genérica .sm-overlay (z-index:990) se quedaba
   detrás de ese panel, sin verse hasta cerrarlo. */
#vgCategorySheetOverlay { z-index: 1200; }
.cg-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.cg-topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  position: relative;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: #111214;
}
.cg-back-btn {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #b5bac1;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.15s;
}
.cg-back-btn:active { color: #fff; }
.cg-topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f2f3f5;
}

.cg-body {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
}
.cg-section-heading {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f2f3f5;
  margin-bottom: 4px;
}
.cg-section-sub {
  font-size: 0.85rem;
  color: #949ba4;
  margin-bottom: 22px;
}
.cg-field-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #b5bac1;
  margin-bottom: 8px;
}
.cg-input {
  width: 100%;
  background: #2b2d31;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f2f3f5;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 20px;
}
.cg-input:focus {
  box-shadow: 0 0 0 2px var(--accent);
}
.cg-textarea {
  width: 100%;
  min-height: 90px;
  background: #2b2d31;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f2f3f5;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  box-sizing: border-box;
  resize: none;
  margin-bottom: 4px;
}
.cg-textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.cg-char-count {
  text-align: right;
  font-size: 0.78rem;
  color: #6d6f78;
  margin-bottom: 20px;
}
.cg-select {
  width: 100%;
  background: #2b2d31;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f2f3f5;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b5bac1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.cg-hint {
  font-size: 0.8rem;
  color: #6d6f78;
  margin-bottom: 20px;
}

/* NSFW toggle row */
.cg-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.cg-toggle-info { flex: 1; }
.cg-toggle-label {
  font-size: 0.97rem;
  font-weight: 700;
  color: #f2f3f5;
  margin-bottom: 4px;
}
.cg-toggle-desc {
  font-size: 0.82rem;
  color: #949ba4;
  line-height: 1.4;
}
.cg-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 2px;
}
.cg-toggle input { opacity: 0; width: 0; height: 0; }
.cg-toggle-slider {
  position: absolute;
  inset: 0;
  background: #4e5058;
  border-radius: 26px;
  transition: background 0.2s;
  cursor: pointer;
}
.cg-toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}
.cg-toggle input:checked + .cg-toggle-slider { background: var(--accent); }
.cg-toggle input:checked + .cg-toggle-slider::before { transform: translateX(18px); }
/* X icon on slider */
.cg-toggle-slider::after {
  content: '×';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  color: #949ba4;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.2s;
}
.cg-toggle input:checked + .cg-toggle-slider::after { opacity: 0; }

/* ══════════════════════════════
   UNSAVED CHANGES BAR
══════════════════════════════ */
.cg-unsaved-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #111214;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
}
.cg-unsaved-text {
  font-size: 0.88rem;
  color: #f2f3f5;
  flex: 1;
  min-width: 0;
}
.cg-unsaved-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cg-btn-reset {
  background: #2b2d31;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: #f2f3f5;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.cg-btn-reset:active { background: #393c43; }
.cg-btn-save {
  background: #5865f2;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.cg-btn-save:active { background: #4752c4; }

/* ══════════════════════════════
   SELECT BUTTON (replaces <select>)
══════════════════════════════ */
.cg-select-btn {
  width: 100%;
  background: #2b2d31;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f2f3f5;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  transition: background 0.12s;
  box-sizing: border-box;
}
.cg-select-btn:active { background: #393c43; }

/* ══════════════════════════════
   GENERIC PICKER SHEET
══════════════════════════════ */
.picker-sheet {
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.picker-sheet-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f2f3f5;
  text-align: center;
  padding: 14px 20px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.picker-sheet-list {
  display: flex;
  flex-direction: column;
  padding: 8px 0 4px;
}
.picker-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: none;
  border: none;
  color: #f2f3f5;
  font-size: 0.97rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.picker-sheet-item:last-child { border-bottom: none; }
.picker-sheet-item:active { background: rgba(255,255,255,0.06); }
.picker-sheet-item.picker-selected {
  background: rgba(88,101,242,0.12);
}
.picker-item-label { flex: 1; }
.picker-check { flex-shrink: 0; }

/* ══════════════════════════════
   UNSAVED CHANGES BAR
══════════════════════════════ */
.cg-unsaved-bar {
  position: relative;
  z-index: 1;
  background: #1e1f22;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  flex-shrink: 0;
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height 0.25s cubic-bezier(0.34, 1.06, 0.64, 1),
              padding 0.25s cubic-bezier(0.34, 1.06, 0.64, 1);
  flex-wrap: wrap;
}
.cg-unsaved-bar.visible {
  max-height: 80px;
  padding: 10px 16px;
}
.cg-unsaved-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f2f3f5;
  flex: 1;
  min-width: 0;
}
.cg-unsaved-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cg-btn-reset {
  background: #4e5058;
  border: none;
  border-radius: 8px;
  color: #f2f3f5;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}
.cg-btn-reset:active { background: #3c3e44; }
.cg-btn-save {
  background: #5865f2;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 16px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}
.cg-btn-save:active { background: #4752c4; }

/* (unsaved bar pushes topbar naturally via flex column) */

/* ══════════════════════════════
   SLOWMODE / STATUS SELECT BUTTON
   (reemplaza el <select> nativo)
══════════════════════════════ */
.cg-select-btn {
  width: 100%;
  background: #2b2d31;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  color: #f2f3f5;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  margin-bottom: 6px;
  box-sizing: border-box;
  transition: background 0.12s;
}
.cg-select-btn:active { background: #35383f; }

/* ══════════════════════════════
   CHAR COUNT — restante (no total)
══════════════════════════════ */
.cg-char-count {
  text-align: right;
  font-size: 0.78rem;
  color: #6d6f78;
  margin-bottom: 20px;
}


/* ══════════════════════════════
   POPUP MODAL — fondo con blur+fade y
   recuadro con animación pop (usado por
   "Eliminar categoría" / "Eliminar canal")
══════════════════════════════ */
.sm-popup-overlay {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  transition: background .24s ease, backdrop-filter .24s ease, opacity .24s ease;
  box-sizing: border-box;
}
.sm-popup-overlay.open {
  background: rgba(0,0,0,0.7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 1;
  pointer-events: auto;
}
.sm-popup-box {
  background: #1e1f22;
  border-radius: 16px;
  width: min(460px, 92vw);
  padding: 28px 28px 24px;
  position: relative;
  box-sizing: border-box;
  transform: scale(0.8);
  opacity: 0;
  transition: transform .26s cubic-bezier(0.34,1.56,0.64,1), opacity .18s ease;
}
.sm-popup-overlay.open .sm-popup-box {
  transform: scale(1);
  opacity: 1;
}
