/* ==========================================================================
   Commands Section Styles - سمسار
   Matches Dark & Light Theme System
   ========================================================================== */

/* Fix: Remove underline from login button */
.login-button,
.login-button:hover,
.login-button:focus,
.login-button:visited,
.login-button:active,
.legal-topbar .login-button {
  text-decoration: none !important;
}

/* Standalone Commands Page Layout */
.commands-page-main {
  min-height: calc(100vh - 200px);
  padding: 30px 0 90px;
}

.commands-hero {
  text-align: center;
  padding: 40px 0 35px;
  max-width: 820px;
  margin: 0 auto;
}


.commands-hero h1 {
  font-size: clamp(34px, 4.5vw, 54px);
  font-weight: 900;
  line-height: 1.25;
  margin: 0 auto 16px;
  color: var(--home-ink);
  text-align: center;
}

.commands-hero h1 strong {
  color: #a271ff;
  background: linear-gradient(90deg, #b092ff, #7969ff);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.commands-hero p {
  color: var(--home-muted);
  font-size: 16px;
  line-height: 1.8;
  margin: 0 auto 24px;
  max-width: 650px;
  text-align: center;
}



.commands-page-section {
  padding: 20px 0 60px;
  position: relative;
  scroll-margin-top: 110px;
}

/* ─── Tip / Dashboard Integration Notice ─── */


/* ─── Filter & Search Toolbar ─── */
.commands-toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  padding: 16px 20px;
  border-radius: 20px;
  background: var(--home-panel);
  border: 1px solid var(--home-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.commands-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.commands-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(184, 166, 231, 0.12);
}

.commands-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--home-muted);
  font: 700 13px Tajawal, Arial, sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.commands-filter-btn:hover {
  color: var(--home-ink);
  background: rgba(162, 113, 255, 0.08);
}

.commands-filter-btn.is-active {
  background: linear-gradient(135deg, rgba(142, 94, 255, 0.28), rgba(89, 101, 242, 0.2));
  border-color: rgba(181, 153, 255, 0.35);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(104, 69, 255, 0.25);
}

.commands-filter-btn .filter-count {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 800;
  direction: ltr;
}

.commands-filter-btn.is-active .filter-count {
  background: #9d74ff;
  color: #ffffff;
}

/* Search Box */
.commands-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
}

.commands-search-box svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9d74ff;
  pointer-events: none;
}

.commands-search-input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 68px;
  border-radius: 12px;
  border: 1px solid rgba(181, 166, 255, 0.2);
  background: rgba(14, 17, 36, 0.65);
  color: var(--home-ink);
  font: 500 13px/44px Tajawal, Arial, sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.commands-search-shortcut {
  position: absolute;
  left: 38px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--home-muted);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.commands-search-box:focus-within .commands-search-shortcut,
.commands-search-input:not(:placeholder-shown) ~ .commands-search-shortcut {
  opacity: 0;
  pointer-events: none;
}

.commands-search-input::placeholder {
  color: #7d7d96;
}

.commands-search-input:focus {
  border-color: #9d74ff;
  background: rgba(18, 21, 44, 0.85);
  box-shadow: 0 0 0 3px rgba(157, 116, 255, 0.2);
}

.commands-clear-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--home-muted);
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.commands-clear-search:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}



/* ─── Commands Grid ─── */
.commands-grid-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

/* Individual Command Card */
.command-doc-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(23, 24, 46, 0.88), rgba(13, 14, 28, 0.88));
  border: 1px solid rgba(180, 154, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.command-doc-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(162, 113, 255, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.command-doc-card:hover {
  transform: translateY(-4px);
  border-color: rgba(175, 140, 255, 0.45);
  box-shadow: 0 16px 40px rgba(98, 72, 240, 0.18);
}

.command-doc-card:hover::after {
  opacity: 1;
}

/* Header inside card */
.command-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.command-code-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-slash-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(147, 98, 255, 0.15);
  border: 1px solid rgba(181, 153, 255, 0.3);
  color: #ebdfff;
  font: 700 14px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  direction: ltr;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.command-slash-badge:hover {
  background: rgba(157, 116, 255, 0.3);
  border-color: rgba(181, 153, 255, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
}

.command-slash-badge:active {
  transform: translateY(0);
}

.command-card-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  margin: 4px 0 0;
}

.command-badges-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Category Badge (عام vs إداري) */
.command-type-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.command-type-tag.is-public {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #34d399;
}

.command-type-tag.is-admin {
  background: rgba(244, 114, 182, 0.15);
  border: 1px solid rgba(244, 114, 182, 0.35);
  color: #f472b6;
}

/* Copy Action beside command */
.command-syntax-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  position: relative;
  width: 100%;
}

.command-copy-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  min-height: 40px;
  border-radius: 10px;
  background: rgba(147, 98, 255, 0.14);
  border: 1px solid rgba(181, 153, 255, 0.3);
  color: #ebdfff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  white-space: nowrap;
}

.command-copy-action:hover {
  background: rgba(157, 116, 255, 0.28);
  color: #ffffff;
  border-color: rgba(181, 153, 255, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.25);
}

.command-copy-action:active {
  transform: translateY(0);
}

.command-copy-action.copied {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.command-copy-action .copy-label {
  font-size: 13px;
  font-weight: 700;
}

/* Card Body Sections */
.command-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.command-desc-row {
  margin: 0;
}

.command-desc-row .command-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #a49fc4;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.command-desc-row .command-field-label svg {
  width: 14px;
  height: 14px;
  color: #9d74ff;
}

.command-desc-text {
  font-size: 13px;
  line-height: 1.75;
  color: #d8d4e9;
  margin: 0;
}

/* Who Can Use / Permissions Block */
.command-permission-box {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(14, 16, 32, 0.55);
  border: 1px solid rgba(184, 166, 231, 0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.command-perm-heading {
  font-size: 11px;
  font-weight: 800;
  color: #b9aee0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.command-perm-value {
  font-size: 12px;
  font-weight: 600;
  color: #eee9fc;
  line-height: 1.6;
}

.command-perm-value strong {
  color: #e5b3ff;
}

/* Syntax & Arguments Block */
.command-syntax-block {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(9, 11, 22, 0.75);
  border: 1px solid rgba(175, 140, 255, 0.18);
  font: 600 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #c9b9f7;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.command-syntax-block .param-req {
  color: #fca5a5;
  font-weight: 700;
}

.command-syntax-block .param-opt {
  color: #93c5fd;
  font-weight: 600;
}

/* Arguments Breakdown Pills */
.command-params-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.param-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.param-chip.is-required {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
}

.param-chip.is-optional {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}

.param-chip small {
  font-size: 9px;
  opacity: 0.85;
}



/* ─── Empty State ─── */
.commands-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  border-radius: 20px;
  background: var(--home-panel);
  border: 1px dashed var(--home-border);
}

.commands-empty-state svg {
  width: 48px;
  height: 48px;
  color: #8e68ff;
  margin-bottom: 16px;
  opacity: 0.6;
}

.commands-empty-state h3 {
  font-size: 18px;
  color: var(--home-ink);
  margin: 0 0 8px;
}

.commands-empty-state p {
  color: var(--home-muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.commands-reset-search-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid rgba(162, 113, 255, 0.4);
  background: rgba(162, 113, 255, 0.15);
  color: #ebdfff;
  font: 700 13px Tajawal, Arial, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.commands-reset-search-btn:hover {
  background: #8e68ff;
  color: #ffffff;
}

/* ─── Light Mode Theme Overrides ─── */
html[data-theme="light"] .commands-page-section {
  color: #30283f;
}


html[data-theme="light"] .commands-hero h1 {
  color: #171126;
}

html[data-theme="light"] .commands-hero p {
  color: #5c5470;
}

/* Toolbar in Light Mode */
html[data-theme="light"] .commands-toolbar {
  background: #ffffff;
  border-color: #e5ddf5;
  box-shadow: 0 10px 30px rgba(67, 45, 104, 0.06);
}

html[data-theme="light"] .commands-filter-group {
  background: #f7f4fc;
  border-color: #e8dff7;
}

html[data-theme="light"] .commands-filter-btn {
  color: #665b80;
}

html[data-theme="light"] .commands-filter-btn:hover {
  color: #1d152c;
  background: #ede6f9;
}

html[data-theme="light"] .commands-filter-btn.is-active {
  background: linear-gradient(135deg, #7853dd, #5b32bf);
  border-color: #7853dd;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(120, 83, 221, 0.35);
}

html[data-theme="light"] .commands-filter-btn .filter-count {
  background: rgba(0, 0, 0, 0.07);
  color: #493a65;
}

html[data-theme="light"] .commands-filter-btn.is-active .filter-count {
  background: #ffffff;
  color: #55339d;
}

html[data-theme="light"] .commands-search-box svg {
  stroke: #7853dd;
}

html[data-theme="light"] .commands-search-input {
  border-color: #dfd6f0;
  background: #faf8ff;
  color: #1b132a;
}

html[data-theme="light"] .commands-search-input::placeholder {
  color: #8c82a5;
}

html[data-theme="light"] .commands-search-input:focus {
  background: #ffffff;
  border-color: #7853dd;
  box-shadow: 0 0 0 3px rgba(120, 83, 221, 0.16);
}

html[data-theme="light"] .commands-search-shortcut {
  background: #ede6fd;
  border-color: #d6c5f7;
  color: #6a5a87;
}

html[data-theme="light"] .commands-clear-search {
  background: #ede7f8;
  color: #65587e;
}

html[data-theme="light"] .commands-clear-search:hover {
  background: #e0d5f5;
  color: #1b132a;
}

/* Command Cards in Light Mode */
html[data-theme="light"] .command-doc-card {
  background: #ffffff !important;
  border: 1px solid #e3daf5 !important;
  box-shadow: 0 8px 24px rgba(78, 48, 134, 0.06), 0 2px 6px rgba(0, 0, 0, 0.02) !important;
}

html[data-theme="light"] .command-doc-card::after {
  background: linear-gradient(90deg, transparent, rgba(120, 83, 221, 0.45), transparent);
}

html[data-theme="light"] .command-doc-card:hover {
  background: #ffffff !important;
  border-color: #926bf7 !important;
  box-shadow: 0 16px 36px rgba(120, 83, 221, 0.14), 0 4px 10px rgba(0, 0, 0, 0.03) !important;
  transform: translateY(-4px);
}

html[data-theme="light"] .command-card-title {
  color: #1b1429 !important;
}

html[data-theme="light"] .command-slash-badge {
  background: #f3edfd !important;
  border-color: #d7c5f8 !important;
  color: #5527be !important;
}

html[data-theme="light"] .command-slash-badge:hover {
  background: #e7dbfb !important;
  border-color: #bc9ef5 !important;
  color: #4014a0 !important;
}

html[data-theme="light"] .command-type-tag.is-public {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #047857 !important;
}

html[data-theme="light"] .command-type-tag.is-admin {
  background: rgba(236, 72, 153, 0.12) !important;
  border-color: rgba(236, 72, 153, 0.3) !important;
  color: #be185d !important;
}

html[data-theme="light"] .command-desc-row .command-field-label {
  color: #6a6182 !important;
}

html[data-theme="light"] .command-desc-row .command-field-label svg {
  stroke: #7853dd !important;
}

html[data-theme="light"] .command-desc-text {
  color: #38304c !important;
  line-height: 1.6;
}

/* Permission Box in Light Mode */
html[data-theme="light"] .command-permission-box {
  background: #f7f4fc !important;
  border: 1px solid #e7def7 !important;
}

html[data-theme="light"] .command-perm-heading {
  color: #693ecc !important;
}

html[data-theme="light"] .command-perm-value {
  color: #38304c !important;
}

html[data-theme="light"] .command-perm-value strong {
  color: #5325be !important;
}

/* Syntax Block in Light Mode */
html[data-theme="light"] .command-syntax-block {
  background: #f5f1fb !important;
  border: 1px solid #ded3f3 !important;
  color: #1c152d !important;
}

html[data-theme="light"] .command-syntax-block .param-req {
  color: #dc2626 !important;
}

html[data-theme="light"] .command-syntax-block .param-opt {
  color: #2563eb !important;
}

html[data-theme="light"] .param-chip.is-required {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
  color: #b91c1c !important;
}

html[data-theme="light"] .param-chip.is-optional {
  background: rgba(37, 99, 235, 0.08) !important;
  border-color: rgba(37, 99, 235, 0.28) !important;
  color: #1d4ed8 !important;
}

/* Copy Action Button in Light Mode */
html[data-theme="light"] .command-copy-action {
  background: #ede5fd !important;
  border-color: #d4c2f7 !important;
  color: #5527be !important;
}

html[data-theme="light"] .command-copy-action:hover {
  background: #7853dd !important;
  border-color: #7853dd !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(120, 83, 221, 0.3) !important;
}

html[data-theme="light"] .command-copy-action.copied {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

/* Empty State in Light Mode */
html[data-theme="light"] .commands-empty-state {
  background: #ffffff !important;
  border: 1px solid #e3daf5 !important;
  box-shadow: 0 8px 24px rgba(78, 48, 134, 0.06) !important;
}

html[data-theme="light"] .commands-empty-state h3 {
  color: #1b1429 !important;
}

html[data-theme="light"] .commands-empty-state p {
  color: #5c5470 !important;
}

html[data-theme="light"] .commands-reset-search-btn {
  background: #f1eafd !important;
  border: 1px solid #d4c2f5 !important;
  color: #5527be !important;
}

html[data-theme="light"] .commands-reset-search-btn:hover {
  background: #7853dd !important;
  border-color: #7853dd !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(120, 83, 221, 0.3) !important;
}

html[data-theme="light"] .login-button,
html[data-theme="light"] .login-button:hover,
html[data-theme="light"] .legal-topbar .login-button {
  text-decoration: none !important;
}

/* ─── Responsive Breakpoints ─── */
@media (max-width: 1080px) {
  .commands-grid-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 720px) {
  .commands-page-section {
    padding: 60px 0 70px;
  }

  .commands-dashboard-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
  }

  .commands-toolbar {
    padding: 14px 16px;
  }

  .commands-toolbar-top {
    flex-direction: column;
    align-items: stretch;
  }

  .commands-filter-group {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 4px;
  }

  .commands-filter-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .commands-search-box {
    max-width: 100%;
  }

  .commands-grid-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .command-syntax-row {
    flex-direction: row;
    gap: 8px;
  }

  .command-doc-card {
    padding: 18px;
  }
}
