/* Krasny overrides for AdminLTE dark mode */
:root {
  --krasny-accent: #6c5ce7;
  --krasny-accent-hover: #7d6ff0;
}

.dark-mode .main-sidebar {
  background: #1a1a2e !important;
}

.dark-mode .brand-link {
  background: linear-gradient(135deg, #6c5ce7, #a855f7) !important;
  border-bottom: 0 !important;
}

.dark-mode .nav-sidebar .nav-link.active {
  background: rgba(108, 92, 231, 0.25) !important;
  color: #fff !important;
}

.dark-mode .content-wrapper {
  background: #0a0a12 !important;
}

.dark-mode .main-header.navbar {
  background: #12121e !important;
  border-bottom: 1px solid #2a2a4a !important;
}

/* AdminLTE inner sidebar — undo legacy styles.css leaks */
.main-sidebar .sidebar {
  width: auto;
  min-height: auto;
  position: static;
  left: auto;
  top: auto;
  bottom: auto;
  z-index: auto;
  display: block;
  flex-direction: unset;
  border-right: 0;
  background: transparent;
  transform: none !important;
  transition: none;
}

.nav-sidebar > .nav-item {
  display: list-item;
  padding: 0;
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: default;
}

.nav-sidebar > .nav-item:hover {
  background: transparent;
  color: inherit;
}

.agent-card {
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.agent-card-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #0d0d18;
  display: block;
}

.agent-card-thumb-placeholder {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, #16162a, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c5c7a;
  font-size: 13px;
}

.agent-card-body {
  padding: 14px;
}

.agent-card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  color: #e8e8f0;
}

.agent-card-meta {
  font-size: 12px;
  color: #8888a8;
  line-height: 1.5;
}

.agent-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.country-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.country-flag img {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.on { background: #00e676; box-shadow: 0 0 6px #00e676; }
.status-dot.off { background: #5c5c7a; }

.badge-pending-nav {
  font-size: 10px;
  margin-left: 6px;
}

body.krasny-auth-page {
  min-height: 100vh;
  margin: 0;
  background: #0a0a12 !important;
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%) !important;
}

.login-page-krasny {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box-krasny {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-box-krasny .card {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
}

.login-logo-krasny {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #6c5ce7, #a855f7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  margin: 0 auto 12px;
}

.small-box .icon { font-size: 56px; }

.app-modal-backdrop .app-modal {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  color: #e8e8f0;
}

.app-modal-backdrop .app-modal-header {
  border-bottom: 1px solid #2a2a4a;
}

.app-modal-backdrop .form-input,
.modal-backdrop .form-input {
  background: #16162a;
  border: 1px solid #2a2a4a;
  color: #e8e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  width: 100%;
}

.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  color: #e8e8f0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast-success { border-color: #00e676; }
.toast-error { border-color: #ff5252; }
.toast-info { border-color: #6c5ce7; }

.btn-krasny-primary {
  background: #6c5ce7;
  border-color: #6c5ce7;
  color: #fff;
}

.btn-krasny-primary:hover {
  background: #7d6ff0;
  border-color: #7d6ff0;
  color: #fff;
}

.screenshot-preview-modal {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #2a2a4a;
  background: #0d0d18;
  margin-bottom: 16px;
}

.purg-top-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -8px 0 12px;
}

.purg-online-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: #8888a8;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.purg-online-filter input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.content-header .col-sm-6:last-child {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.content-header .col-sm-6:last-child .text-right {
  width: 100%;
}

.purg-bulk-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
}

.purg-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e8e8f0;
  cursor: pointer;
  user-select: none;
}

.purg-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.purg-card-selectable {
  position: relative;
}

.purg-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  margin: 0;
  cursor: pointer;
}

.purg-card-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: #6c5ce7;
}

/* ── Builder cards ──────────────────────────────────────── */
.builder-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
  align-items: stretch;
}

@media (max-width: 1400px) {
  .builder-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .builder-cards-grid { grid-template-columns: 1fr; }
}

.builder-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 430px;
  padding: 22px;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
}

.builder-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.builder-card-head .stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 22px;
  flex-shrink: 0;
}

.builder-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #e8e8f0;
  line-height: 1.2;
}

.builder-card-sub {
  font-size: 12px;
  color: #8888a8;
  margin-top: 2px;
}

.builder-card-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.builder-card-actions {
  margin-top: auto;
  padding-top: 8px;
}

.builder-card-actions .btn {
  width: 100%;
  justify-content: center;
}

.builder-card-status {
  margin-top: 8px;
  font-size: 12px;
  color: #8888a8;
  min-height: 18px;
}

/* ── PDF Templates ──────────────────────────────────────── */
.pdf-templates-section {
  margin-bottom: 28px;
  padding: 0;
  overflow: hidden;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
}

.pdf-templates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #2a2a4a;
}

.pdf-templates-header .section-title {
  font-size: 16px;
  font-weight: 700;
  color: #e8e8f0;
}

.pdf-templates-header .section-sub {
  font-size: 12px;
  color: #8888a8;
  margin-top: 2px;
}

.pdf-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px;
}

.pdf-template-card {
  background: #12121e;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pdf-template-card:hover {
  border-color: #6c5ce7;
  transform: translateY(-2px);
}

.pdf-template-preview {
  position: relative;
  height: 160px;
  background: #0d0d18 center/cover no-repeat;
  cursor: pointer;
}

.pdf-template-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5c5c7a;
  font-size: 12px;
  background: linear-gradient(135deg, #16162a, #1a1a2e);
}

.pdf-template-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.pdf-template-preview-modal {
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  max-width: 78%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.pdf-template-preview-modal .ppt-title {
  font-size: 10px;
  font-weight: 700;
  color: #222;
  line-height: 1.2;
}

.pdf-template-preview-modal .ppt-sub {
  font-size: 8px;
  color: #666;
  margin: 4px 0 8px;
  line-height: 1.3;
}

.pdf-template-preview-modal .ppt-btn {
  display: inline-block;
  font-size: 8px;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.pdf-template-meta {
  padding: 12px 14px;
}

.pdf-template-name {
  font-size: 14px;
  font-weight: 600;
  color: #e8e8f0;
  margin-bottom: 2px;
}

.pdf-template-date {
  font-size: 11px;
  color: #8888a8;
  margin-bottom: 10px;
}

.pdf-template-actions {
  display: flex;
  gap: 6px;
}

.pdf-templates-empty {
  padding: 48px 20px;
  text-align: center;
  color: #8888a8;
}

.pdf-templates-empty .icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.6;
}

/* ── Discord Bot page ───────────────────────────────────── */
.discord-top-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.online  { background: rgba(0, 230, 118, 0.12); color: #00e676; }
.status-badge.offline { background: rgba(150, 150, 150, 0.12); color: #8888a8; }
.status-badge.connecting { background: rgba(255, 193, 7, 0.12); color: #ffc107; }
.status-badge.error   { background: rgba(255, 82, 82, 0.12); color: #ff5252; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.online  .status-dot { background: #00e676; box-shadow: 0 0 6px #00e676; }
.status-badge.offline .status-dot { background: #8888a8; }
.status-badge.connecting .status-dot { background: #ffc107; animation: discord-pulse 1s infinite; }
.status-badge.error   .status-dot { background: #ff5252; }

@keyframes discord-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.discord-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.discord-info-box {
  background: rgba(255, 61, 61, 0.08);
  border: 1px solid rgba(255, 61, 61, 0.2);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.discord-error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(255, 82, 82, 0.2);
  border-radius: 8px;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.step.active { color: var(--accent); font-weight: 600; }
.step.done   { color: var(--success); }

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: rgba(136, 136, 168, 0.15);
  flex-shrink: 0;
}

.step.active .step-num { background: var(--accent); color: #fff; }
.step.done   .step-num { background: var(--success); color: #0a0a14; }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 8px;
  min-width: 24px;
}

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.guild-card {
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.guild-card:hover {
  border-color: var(--accent);
  background: rgba(255, 61, 61, 0.06);
}

.guild-card.selected {
  border-color: var(--accent);
  background: rgba(255, 61, 61, 0.1);
}

.guild-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #fff;
  font-weight: 700;
}

.guild-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.guild-id   { font-size: 11px; color: var(--text-muted); font-family: monospace; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-item .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.info-item .value {
  font-size: 14px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-primary);
}

.discord-empty-guilds {
  padding: 16px;
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.25);
  border-radius: 8px;
}

.discord-empty-guilds .title {
  color: #ffc107;
  font-size: 14px;
  margin: 0 0 8px;
  font-weight: 600;
}

.discord-empty-guilds p:last-child {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

#guildSection,
#configuredSection {
  display: none;
}

/* Session idle timer (navbar) */
.session-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  padding: 4px 8px 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.session-timer__icon {
  opacity: 0.75;
  font-size: 12px;
}

.session-timer__label {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-width: 3.2em;
  color: #e8e8f0;
}

.session-timer__btn {
  padding: 2px 8px !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  border-radius: 4px !important;
  background: rgba(108, 92, 231, 0.35) !important;
  border: 1px solid rgba(108, 92, 231, 0.55) !important;
  color: #fff !important;
}

.session-timer__btn:hover:not(:disabled) {
  background: rgba(108, 92, 231, 0.55) !important;
}

.session-timer__btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.session-timer--warn {
  border-color: rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.12);
}

.session-timer--warn .session-timer__label {
  color: #ffc107;
}

.session-timer--critical {
  border-color: rgba(220, 53, 69, 0.5);
  background: rgba(220, 53, 69, 0.15);
}

.session-timer--critical .session-timer__label {
  color: #ff6b7a;
}

.toast.toast-warning {
  background: #b8860b;
  color: #fff;
}

@media (max-width: 576px) {
  .session-timer {
    gap: 6px;
    padding: 4px 6px;
    margin-right: 4px;
  }

  .session-timer__icon {
    display: none;
  }
}
