/* ═══════════════════════════════════════════════════
   dashboard.css  —  Lycoris Dashboard
   Theme-consistent with style.css (dark + sakura)
   ═══════════════════════════════════════════════════ */


/* ── Dashboard Layout ── */

.dashboard-main {
  padding: 40px 0 60px;
  min-height: 60vh;
}

.dashboard-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.dashboard-subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 1rem;
}

/* ── Login Prompt (when not authenticated) ── */

.dashboard-login-prompt {
  text-align: center;
  padding: 60px 20px;
}
.dashboard-login-prompt .prompt-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}
.dashboard-login-prompt h2 {
  font-size: 1.5rem;
  margin: 0 0 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.dashboard-login-prompt p {
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 420px;
  margin-inline: auto;
}
.dashboard-login-prompt .btn {
  font-size: 1rem;
}

/* ── Server Selector (custom dropdown with search) ── */

.server-selector {
  position: relative;
  max-width: 480px;
  margin-bottom: 28px;
}
.server-selector-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 18, 32, 0.72);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.server-selector-trigger:hover,
.server-selector-trigger:focus {
  border-color: rgba(255, 51, 102, 0.4);
  box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.1);
  outline: none;
}
.server-selector-trigger .trigger-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.server-selector-trigger .trigger-placeholder {
  color: var(--muted2);
  flex: 1;
}
.server-selector-trigger .trigger-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server-selector-trigger .trigger-chevron {
  color: var(--muted2);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.server-selector.is-open .trigger-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.server-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 15, 28, 0.96);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scaleY(0.96);
  transform-origin: top;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.server-selector.is-open .server-dropdown {
  opacity: 1;
  transform: translateY(0) scaleY(1);
  pointer-events: auto;
}

.server-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--stroke);
}
.server-search {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.server-search::placeholder {
  color: var(--muted2);
}
.server-search:focus {
  border-color: rgba(255, 51, 102, 0.4);
}
.server-search-wrap {
  position: relative;
}
.server-search-wrap::before {
  content: "\f002"; /* fa-magnifying-glass */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted2);
  font-size: 0.8rem;
  pointer-events: none;
}

.server-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.server-list::-webkit-scrollbar {
  width: 6px;
}
.server-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.server-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.12s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}
.server-item:hover,
.server-item.is-focused {
  background: rgba(255, 255, 255, 0.08);
}
.server-item.is-selected {
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.25);
}
.server-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}
.server-item-fallback {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.server-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.server-item-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.server-item-badge.admin {
  background: rgba(255, 51, 102, 0.15);
  color: #ff6b8a;
}

.server-list-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted2);
  font-size: 0.9rem;
}

/* ── Server Status Cards (Caso A / Caso B) ── */

.server-status {
  animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Caso A: Bot not in server */
.status-bot-absent {
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.status-bot-absent .status-icon {
  font-size: 2.5rem;
  color: var(--muted2);
  margin-bottom: 4px;
}
.status-bot-absent h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.status-bot-absent p {
  margin: 0;
  color: var(--muted);
  max-width: 340px;
}
.status-bot-absent .btn-invite {
  margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), #ff5d86);
  color: #0b0f1a;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(255, 51, 102, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.status-bot-absent .btn-invite:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(255, 51, 102, 0.35);
}
.status-bot-absent .status-no-perms {
  color: var(--muted2);
  font-size: 0.9rem;
  font-style: italic;
}

/* ── Config Panel (when bot IS in server) ── */

.config-panel {
  animation: fadeSlideIn 0.3s ease;
}

.config-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.config-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 51, 102, 0.3);
}
.config-header-info h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.config-header-info p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.config-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: relative;
  overflow: hidden;
}
.config-card-icon {
  font-size: 1.5rem;
  color: var(--accent);
}
.config-card h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.config-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.config-card-action {
  margin-top: auto;
  padding-top: 8px;
}
.config-card .btn-config {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.config-card .btn-config:hover {
  background: rgba(255, 255, 255, 0.10);
  transform: translateY(-1px);
}

/* Caso B: Locked config card (no MANAGE_GUILD perms) */
.config-card.is-locked {
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}
.config-card.is-locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 18, 0.45);
  border-radius: inherit;
}

.config-locked-banner {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(255, 165, 0, 0.08);
  border: 1px solid rgba(255, 165, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  animation: fadeSlideIn 0.3s ease;
}
.config-locked-banner .lock-icon {
  font-size: 1.2rem;
  color: #ffa500;
  flex-shrink: 0;
}
.config-locked-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}
.config-locked-banner strong {
  color: #ffbe4d;
}

/* User-level config (always unlocked) */
.config-card.is-user-config {
  opacity: 1 !important;
  pointer-events: auto !important;
  user-select: auto !important;
}
.config-card.is-user-config::after {
  display: none !important;
}
.config-card.is-user-config .config-card-icon {
  color: #7c3aed;
}

/* ── Loading States ── */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--muted);
}
.loading-spinner::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
  .server-selector {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .dashboard-title {
    font-size: 1.4rem;
  }
  .config-locked-banner {
    flex-direction: column;
    text-align: center;
  }
}
