/* ==========================================================================
   Can I Use SQL? — shared stylesheet
   Linked from all pages; page-specific overrides live in per-page <style> blocks.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS custom properties (light mode defaults)
   -------------------------------------------------------------------------- */

:root {
  --color-bg:              #f5f7fa;
  --color-surface:         #ffffff;
  --color-surface-alt:     #f8f9fa;
  --color-header-bg:       #f5f7fa;
  --color-primary:         #3498db;
  --color-primary-dark:    #2980b9;
  --color-text:            #333333;
  --color-text-heading:    #2c3e50;
  --color-text-muted:      #7f8c8d;
  --color-text-desc:       #555555;
  --color-border:          #dddddd;
  --color-border-light:    #f0f0f0;
  --color-row-hover:       #f5f5f5;
  --color-search-hover:    #f0f7ff;
  --color-badge-bg:        #eaf3fb;
  --color-badge-bg-hover:  #d6eaf8;
  --color-badge-text:      #2980b9;
  --color-badge-border:    #aed6f1;
  --color-focus-ring:      rgba(52, 152, 219, 0.2);
  --shadow-sm:             0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-md:             0 2px 5px rgba(0, 0, 0, 0.10);
  --shadow-lg:             0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-hover:          0 3px 10px rgba(0, 0, 0, 0.12);
  --shadow-header:         0 2px 6px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:              #0d1117;
    --color-surface:         #161b22;
    --color-surface-alt:     #1c2128;
    --color-header-bg:       #161b22;
    --color-primary:         #58a6ff;
    --color-primary-dark:    #388bfd;
    --color-text:            #e6edf3;
    --color-text-heading:    #c9d1d9;
    --color-text-muted:      #8b949e;
    --color-text-desc:       #b1bac4;
    --color-border:          #30363d;
    --color-border-light:    #21262d;
    --color-row-hover:       #1c2128;
    --color-search-hover:    #1c2128;
    --color-badge-bg:        #0d2a4d;
    --color-badge-bg-hover:  #132f4c;
    --color-badge-text:      #58a6ff;
    --color-badge-border:    #1f4e8c;
    --color-focus-ring:      rgba(88, 166, 255, 0.25);
    --shadow-sm:             0 1px 4px rgba(0, 0, 0, 0.4);
    --shadow-md:             0 2px 5px rgba(0, 0, 0, 0.5);
    --shadow-lg:             0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-hover:          0 3px 10px rgba(0, 0, 0, 0.5);
    --shadow-header:         0 2px 6px rgba(0, 0, 0, 0.4);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
               Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--color-bg);
}

a { color: var(--color-primary); }

h2 { color: var(--color-text-heading); margin-top: 32px; }
h4 { color: var(--color-text-heading); margin: 16px 0 4px; }

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  background-color: var(--color-header-bg);
  box-shadow: var(--shadow-header);
}

.home-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--color-primary);
  flex-shrink: 0;
}

.home-link:hover { color: var(--color-primary-dark); }
.home-link svg   { display: block; }

.command-heading {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.command-heading h1 {
  color: var(--color-text-heading);
  margin: 0;
  font-size: 1.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  border: 1px solid var(--color-badge-border);
  border-radius: 12px;
  font-size: 13px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Search widget
   -------------------------------------------------------------------------- */

.search-widget {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}

.site-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  background: var(--color-surface);
  color: var(--color-text);
}

.site-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
}

.search-results li {
  border-bottom: 1px solid var(--color-border-light);
}

.search-results li:last-child {
  border-bottom: none;
}

.search-results a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--color-text-heading);
  font-size: 14px;
}

.search-results a:hover {
  background-color: var(--color-search-hover);
  color: var(--color-primary);
}

.search-results small {
  color: var(--color-text-muted);
  font-weight: normal;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Site title (shown in header on homepage)
   -------------------------------------------------------------------------- */

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-heading);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Homepage — category groups + command cards
   -------------------------------------------------------------------------- */

.category-group { margin-top: 40px; }

.category-heading {
  color: var(--color-text-heading);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--color-primary);
}

.command-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.command-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-surface);
  border-radius: 6px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--color-text-heading);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  min-width: 160px;
  flex: 1;
  max-width: 260px;
  transition: box-shadow 0.15s, transform 0.1s;
}

.command-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.card-name {
  font-weight: bold;
  font-size: 13px;
}

.card-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.card-support-badge {
  font-size: 11px;
  font-weight: bold;
  margin-top: 4px;
  align-self: flex-start;
}

/* Support/status colors — intentionally same in both light and dark */
.support-5   { border-left-color: #27ae60; }
.support-5   .card-support-badge { color: #27ae60; }
.support-mid { border-left-color: #f39c12; }
.support-mid .card-support-badge { color: #f39c12; }
.support-low { border-left-color: #e74c3c; }
.support-low .card-support-badge { color: #e74c3c; }
.support-none { border-left-color: #95a5a6; }
.support-none .card-support-badge { color: #95a5a6; }

/* --------------------------------------------------------------------------
   Compare filter bar (command pages)
   -------------------------------------------------------------------------- */

.compare-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--color-surface);
  border-radius: 6px;
  border: 1px solid var(--color-border);
  font-size: 13px;
}

.compare-label {
  font-weight: 600;
  color: var(--color-text-heading);
  white-space: nowrap;
}

.compare-bar label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--color-text);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Compatibility table
   -------------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-md);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 12px 15px;
  border-bottom: 1px solid var(--color-border);
}

th { background-color: var(--color-primary); color: #ffffff; }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: var(--color-row-hover); }

.supported     { color: #27ae60; font-weight: bold; }
.not-supported { color: #e74c3c; }
.notes         { font-size: 14px; color: var(--color-text-muted); }

/* --------------------------------------------------------------------------
   Syntax blocks + copy button
   -------------------------------------------------------------------------- */

.syntax {
  background-color: var(--color-surface-alt);
  padding: 15px;
  border-radius: 4px;
  border-left: 4px solid var(--color-primary);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  white-space: pre-wrap;
  margin: 8px 0 16px;
  overflow-x: auto;
  color: var(--color-text);
}

.syntax-wrapper {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 14px;
  right: 8px;
  padding: 3px 8px;
  font-size: 11px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  line-height: 1.4;
}

.syntax-wrapper:hover .copy-btn,
.copy-btn:focus {
  opacity: 1;
}

.copy-btn.copied {
  color: #27ae60;
  border-color: #27ae60;
}

/* --------------------------------------------------------------------------
   Version badges
   -------------------------------------------------------------------------- */

.version-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 14px;
  margin: 0 4px 6px 0;
}

.version-supported {
  background-color: #e6f7ee;
  color: #27ae60;
  border: 1px solid #27ae60;
}

.version-not-supported {
  background-color: #fde8e8;
  color: #e74c3c;
  border: 1px solid #e74c3c;
}

/* --------------------------------------------------------------------------
   Homepage — popular commands
   -------------------------------------------------------------------------- */

.examples {
  background-color: var(--color-surface);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  margin-top: 24px;
}

.examples h2 {
  margin-top: 0;
  color: var(--color-text-heading);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.example {
  display: inline-block;
  margin: 4px 6px 4px 0;
  padding: 4px 10px;
  background: var(--color-badge-bg);
  color: var(--color-badge-text);
  border: 1px solid var(--color-badge-border);
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.example:hover { background: var(--color-badge-bg-hover); }

/* --------------------------------------------------------------------------
   Command page sections
   -------------------------------------------------------------------------- */

.command-desc {
  font-size: 1.05rem;
  color: var(--color-text-desc);
  margin-bottom: 8px;
}

.command-overview {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
  border-left: 3px solid var(--color-border);
  padding-left: 12px;
}

.per-db-section {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
  margin-top: 8px;
}

.detail-block {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 20px 24px;
  margin-top: 8px;
  color: var(--color-text);
}

.detail-block p { margin: 0; }

.version-list { margin-top: 8px; }

.bmc-link img {
  display: block;
  height: 36px;
  width: auto;
}