/* FitRonix Admin — Command Palette (Ctrl+K) */

.admin-app .adm-cmd-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 300px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--accent) 15%);
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--bg-elevated) 96%, #fff 4%) 0%,
    var(--bg-elevated) 100%
  );
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  font-family: Shabnam, Vazirmatn, Tahoma, sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.admin-app .adm-cmd-search-trigger:hover,
.admin-app .adm-cmd-search-trigger:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent),
    0 2px 8px rgba(0, 0, 0, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.admin-app .adm-cmd-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
}

.admin-app .adm-cmd-search-icon svg {
  display: block;
}

.admin-app .adm-cmd-search-ph {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  direction: rtl;
  text-align: start;
  unicode-bidi: plaintext;
}

.admin-app .adm-cmd-kbd {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 10px;
  font-weight: 600;
  font-style: normal;
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--text-tertiary);
  line-height: 1.3;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  flex-shrink: 0;
}

html[data-theme="light"] .admin-app .adm-cmd-search-trigger {
  border-color: color-mix(in srgb, var(--border) 70%, #94a3b8 30%);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

html[data-theme="light"] .admin-app .adm-cmd-search-trigger:hover,
html[data-theme="light"] .admin-app .adm-cmd-search-trigger:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, #cbd5e1);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent),
    0 4px 12px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .admin-app .adm-cmd-search-ph {
  color: #475569;
}

html[data-theme="light"] .admin-app .adm-cmd-kbd {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #64748b;
}

.adm-cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(12vh, 96px) 16px 24px;
  background: rgba(6, 8, 14, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.adm-cmd-palette.on {
  display: flex;
}

.adm-cmd-palette-box {
  width: min(640px, 96vw);
  max-height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-elevated, var(--bg));
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(249, 115, 22, 0.08);
  overflow: hidden;
  animation: admCmdIn 0.16s ease-out;
}

@keyframes admCmdIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.adm-cmd-palette-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.adm-cmd-palette-head .adm-cmd-search-icon {
  font-size: 18px;
  color: var(--accent);
}

.adm-cmd-palette-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
}

.adm-cmd-palette-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 500;
}

.adm-cmd-palette-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.adm-cmd-palette-body {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
  min-height: 120px;
}

.adm-cmd-palette-section {
  padding: 6px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.adm-cmd-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.adm-cmd-hit:hover,
.adm-cmd-hit.on {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.22);
}

.adm-cmd-hit-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  flex-shrink: 0;
}

.adm-cmd-hit-main {
  flex: 1;
  min-width: 0;
}

.adm-cmd-hit-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-cmd-hit-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-cmd-hit .tag {
  flex-shrink: 0;
  font-size: 10px;
}

.adm-cmd-palette-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
}

.adm-cmd-palette-foot kbd {
  display: inline-flex;
  padding: 1px 6px;
  margin-inline: 2px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 10px;
  font-family: inherit;
}

.adm-cmd-palette-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.adm-cmd-palette-loading {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

html[data-theme="light"] .adm-cmd-palette {
  background: rgba(15, 23, 42, 0.28);
}

html[data-theme="light"] .adm-cmd-palette-box {
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.18),
    0 0 0 1px rgba(249, 115, 22, 0.12);
}

@media (max-width: 768px) {
  .admin-app .adm-cmd-search-trigger {
    min-width: 44px;
    max-width: 44px;
    padding: 8px;
    justify-content: center;
  }

  .admin-app .adm-cmd-search-ph,
  .admin-app .adm-cmd-kbd {
    display: none;
  }

  .adm-cmd-palette {
    padding-top: 8vh;
  }
}
