/*
 * The dashboard's own styles.
 *
 * Tailwind does the layout; everything here is what Tailwind has no class for
 * — the keyframes, the scrollbar, the drag-and-drop states of the layout
 * builder, and the handful of component classes the panels share.
 *
 * Lifted verbatim out of the <style> block that used to sit in index.html.
 */
body {
  font-family: 'Inter', sans-serif;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Custom sleek modern toggle switches */
.switch-checkbox:checked + .switch-label {
  background-color: #4f46e5;
}
.switch-checkbox:checked + .switch-label .switch-dot {
  transform: translateX(100%);
}

/* Pulsing status ring */
.status-pulse {
  position: relative;
}
.status-pulse::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}
.pulse-live::after {
  background-color: #22c55e;
}
.pulse-sim::after {
  background-color: #f59e0b;
}

/* Smooth custom scrollbars for logs */
.logs-scrollbar::-webkit-scrollbar {
  width: 4px;
}
.logs-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.logs-scrollbar::-webkit-scrollbar-thumb {
  background: #e4e4e7;
  border-radius: 2px;
}
.dark .logs-scrollbar::-webkit-scrollbar-thumb {
  background: #27272a;
}

/* Readable base font */
body { font-size: 14px; }

/* Improve form input readability */
input, select, textarea {
  font-size: 13px !important;
}

/* Section header consistency */
.card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-subtitle {
  font-size: 12px;
  margin-top: 3px;
  color: #71717a;
}
/* Lighter, not darker, on a dark card — #52525b only reached 2.3:1 contrast here */
.dark .card-subtitle { color: #a1a1aa; }

/* Field label */
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #52525b;
}
.dark .field-label { color: #a1a1aa; }

/* Builder row drag handle invisible until hover */
.custom-category-row:not(:hover) .drag-handle,
.custom-channel-row:not(:hover) .drag-handle {
  opacity: 0.3;
}

/* Role Manager Cards */
.role-card {
  border-radius: 14px;
  border: 1.5px solid #e4e4e7;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  position: relative;
}
.dark .role-card {
  background: #18181b;
  border-color: #27272a;
}
.role-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.role-card-strip {
  height: 4px;
  width: 100%;
}
.role-card-body {
  padding: 14px 16px 16px;
}
.perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: #f4f4f5;
  color: #52525b;
  white-space: nowrap;
}
.dark .perm-chip {
  background: #27272a;
  color: #a1a1aa;
}
.perm-chip.admin { background: #fef2f2; color: #dc2626; }
.dark .perm-chip.admin { background: rgba(220,38,38,0.12); color: #f87171; }

/* Perm checkbox grid in role editor */
.perm-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.perm-checkbox-item:hover {
  background: #f4f4f5;
}
.dark .perm-checkbox-item:hover {
  background: #27272a;
}
.role-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.role-editor-panel {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.dark .role-editor-panel {
  background: #18181b;
  border: 1px solid #27272a;
}

/* Private channel role-access overlay — sits above the full-screen builder */
.role-access-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.role-access-panel {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.dark .role-access-panel {
  background: #18181b;
  border: 1px solid #27272a;
}
.role-access-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.role-access-item:hover { background: #f4f4f5; }
.dark .role-access-item:hover { background: #27272a; }
.role-dot {
  height: 10px;
  width: 10px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.access-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: #f4f4f5;
  color: #52525b;
  white-space: nowrap;
}
.dark .access-chip { background: #27272a; color: #a1a1aa; }

/* Bot-wide controls. Hidden by default and revealed only once the session is
   confirmed as the owner, so a slow auth response can never flash them at a
   server admin. The server enforces the same rule independently. */
.owner-only { display: none !important; }
body.is-owner .owner-only { display: revert !important; }
.admin-only { display: revert; }
body.is-owner .admin-only { display: none !important; }

/* Panel switching. Kept separate from Tailwind's `hidden` on purpose: `hidden`
   still means "this module is switched off", while panel-inactive means "not
   the panel you are looking at". A card needs both to be absent to appear, so
   the two systems compose instead of fighting. */
.panel-inactive { display: none !important; }

.module-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  color: #52525b;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.module-nav-btn:hover { background: #f4f4f5; color: #18181b; }
.module-nav-btn.active { background: #18181b; color: #fff; }
.dark .module-nav-btn { color: #a1a1aa; }
.dark .module-nav-btn:hover { background: #27272a; color: #fafafa; }
.dark .module-nav-btn.active { background: #fafafa; color: #18181b; }

/* Small dot marking a module that is switched on */
.module-nav-dot {
  height: 6px;
  width: 6px;
  border-radius: 9999px;
  background: #10b981;
  flex-shrink: 0;
}
.module-nav-btn.active .module-nav-dot { background: #6ee7b7; }
.module-nav-btn.is-off { opacity: .55; }
