/* KodeMed Downloads – style.css */

:root {
  --bg: #0F1117;
  --bg2: #161822;
  --card: #1C1F2E;
  --card2: #262A3A;
  --orange: #E97132;
  --orangeLight: #F29560;
  --green: #4EA72E;
  --greenLight: #5dbe38;
  --blue: #0F9ED5;
  --blueLight: #12b5f0;
  --white: #F0F2F5;
  --gray: #9DA3B0;
  --grayDark: #5C6270;
  --grayLight: #CDD1DA;
  --border: #2A2E3E;
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 3rem; }

body {
  background: var(--bg);
  color: var(--grayLight);
  font-family: 'Segoe UI', -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */

header {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--card) 100%);
  border-bottom: 3px solid var(--blue);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
}

.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}

.header-logo svg { flex-shrink: 0; }

header h1 {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 2.4rem;
  color: var(--white);
  letter-spacing: 0.02em;
}

header h1 span { color: var(--orange); }

.header-tagline {
  color: var(--gray);
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.header-version {
  color: var(--grayDark);
  font-size: 0.82rem;
}

/* ── Container ── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Sections ── */

section { margin-bottom: 2.5rem; }

.section-title {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 1.25rem;
  color: var(--white);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.4rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  user-select: none;
}

.tab:hover {
  background: var(--card2);
  color: var(--grayLight);
}

.tab.active {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 0.8rem;
  transition: border-color 0.15s ease;
}

.card:hover { border-left-color: var(--orangeLight); }
.card.green { border-left-color: var(--green); }
.card.green:hover { border-left-color: var(--greenLight); }
.card.blue { border-left-color: var(--blue); }
.card.blue:hover { border-left-color: var(--blueLight); }

.card h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.card-muted {
  color: var(--gray);
  font-size: 0.85rem;
}

.card-muted-spaced {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.card-spaced h3 { margin-top: 1rem; }
.card-spaced h3:first-child { margin-top: 0; }

.card-section { margin-top: 1rem; }

/* ── Installer CTA ── */

.installer-card {
  border-left-width: 4px;
  text-align: center;
  padding: 1.5rem 1.4rem;
}

.installer-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.installer-desc {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.installer-btn {
  display: inline-block;
  background: var(--green);
  color: var(--white);
  padding: 0.7rem 2.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.installer-btn:hover {
  background: var(--greenLight);
  text-decoration: none;
  transform: translateY(-1px);
}

.installer-steps {
  color: var(--grayDark);
  font-size: 0.82rem;
  margin-top: 1rem;
}

.installer-note {
  color: var(--grayDark);
  font-size: 0.78rem;
  margin-top: 0.8rem;
  font-style: italic;
}

/* ── File lists ── */

.file-list { list-style: none; }

.file-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.file-list li:last-child { border-bottom: none; }
.file-list .name { flex: 1; color: var(--grayLight); }

.dl-btn {
  background: var(--orange);
  color: var(--white);
  padding: 0.3rem 0.9rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
}

.dl-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.dl-btn.orange:hover { background: var(--orangeLight); }
.dl-btn.green { background: var(--green); }
.dl-btn.green:hover { background: var(--greenLight); }
.dl-btn.blue { background: var(--blue); }
.dl-btn.blue:hover { background: var(--blueLight); }
.dl-btn-error { background: var(--grayDark); }

/* ── Command blocks ── */

.install-cmd {
  background: #0C0E14;
  padding: 1rem 1.2rem;
  border-radius: 6px;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  color: var(--green);
  overflow-x: auto;
  margin-top: 0.8rem;
  border: 1px solid var(--border);
  line-height: 1.7;
}

.install-cmd.muted { color: var(--gray); }

/* ── System requirements ── */

.sys-req {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.sys-req-item {
  background: var(--card2);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--gray);
}

/* ── Markdown viewer ── */

.md-render {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  padding: 1.5rem;
  margin-bottom: 0.8rem;
  border-radius: var(--radius);
  line-height: 1.7;
}

.md-render h1,
.md-render h2,
.md-render h3 { color: var(--white); margin: 1rem 0 0.5rem; }

.md-render h1:first-child,
.md-render h2:first-child { margin-top: 0; }

.md-render code {
  background: #0C0E14;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, 'Courier New', monospace;
  font-size: 0.85em;
}

.md-render pre {
  background: #0C0E14;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  margin: 0.8rem 0;
  border: 1px solid var(--border);
  font-family: 'Cascadia Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  tab-size: 4;
  white-space: pre;
  letter-spacing: 0;
  font-variant-ligatures: none;
}

.md-render pre code { background: none; padding: 0; font-size: inherit; }

.md-render table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8rem 0;
}

.md-render th,
.md-render td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  text-align: left;
}

.md-render th { background: var(--card2); color: var(--white); }

.md-render blockquote {
  border-left: 3px solid var(--orange);
  padding-left: 1rem;
  color: var(--gray);
  margin: 0.8rem 0;
}

.md-render ul,
.md-render ol { padding-left: 1.5rem; margin: 0.5rem 0; }

.md-render a { color: var(--blue); text-decoration: underline; cursor: pointer; }
.md-render a:hover { color: var(--orange); }

/* ── Details/Summary ── */

details { margin-bottom: 0.8rem; }

details summary {
  color: var(--gray);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.6rem 0;
  transition: color 0.15s;
  user-select: none;
}

details summary:hover { color: var(--grayLight); }
details[open] summary { color: var(--white); }

/* ── Badge ── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.badge-blue { background: rgba(15, 158, 213, 0.15); color: var(--blue); }
.badge-green { background: rgba(78, 167, 46, 0.15); color: var(--green); }
.badge-orange { background: rgba(233, 113, 50, 0.15); color: var(--orange); }

/* ── Footer ── */

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--grayDark);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

footer a { color: var(--grayDark); }
footer a:hover { color: var(--gray); }

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* ── Portal Navigation ── */

.portal-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  padding: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.portal-nav a {
  color: var(--gray);
  padding: 0.6rem 1.2rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-bottom: 2px solid transparent;
}

.portal-nav a:hover {
  color: var(--white);
  text-decoration: none;
  background: var(--card);
}

.portal-nav a:active,
.portal-nav a.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* ── Overview Grid ── */

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.overview-card {
  text-align: center;
  padding: 1.2rem 1rem;
}

.overview-card .card-muted {
  margin-bottom: 0.6rem;
}

.overview-icon {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  line-height: 1;
}

/* ── Security Grid ── */

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.security-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.security-list li {
  padding: 0.3rem 0;
  color: var(--grayLight);
  font-size: 0.85rem;
  padding-left: 1.2rem;
  position: relative;
}

.security-list li::before {
  content: "\2713";
  color: var(--green);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* ── FAQ Table ── */

.faq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}

.faq-table th,
.faq-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  text-align: left;
}

.faq-table th {
  background: var(--card2);
  color: var(--white);
  font-weight: 600;
}

.faq-table td {
  color: var(--grayLight);
}

/* ── Config Reference Tables ── */

.config-filter {
  width: 100%;
  margin-bottom: 1.2rem;
}

.config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

.config-table th,
.config-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.config-table th {
  background: var(--card2);
  color: var(--white);
  font-weight: 600;
  position: sticky;
  top: 2.4rem;
  z-index: 10;
}

.config-table td {
  color: var(--grayLight);
}

.config-table td:first-child {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--orange);
  white-space: nowrap;
}

.config-table td:nth-child(2) {
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--green);
}

.config-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-subheader td {
  background: var(--card) !important;
  color: var(--blue) !important;
  font-weight: 600;
  font-family: 'Segoe UI', -apple-system, sans-serif !important;
  font-size: 0.82rem !important;
  white-space: normal !important;
  padding: 0.6rem 0.7rem;
  border-top: 2px solid var(--border);
}

/* ── Scroll to Top ── */

.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card2);
  color: var(--grayLight);
  border: 1px solid var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.scroll-top:hover {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

.scroll-top.visible {
  display: flex;
}

/* ── Utilities ── */

.u-hidden { display: none; }
.user-authenticated { color: var(--green); }

/* ── Noscript ── */

.noscript-msg {
  background: var(--card);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--orangeLight);
  text-align: center;
}

/* ── Wizard ── */

.wizard-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

.wizard-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--gray);
  font-size: 0.82rem;
}

.wizard-label-inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.wizard-hint {
  color: var(--grayDark);
  font-size: 0.75rem;
}

.wizard-input {
  background: #0C0E14;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.45rem 0.7rem;
  color: var(--grayLight);
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.wizard-input:focus {
  border-color: var(--blue);
}

.wizard-input::placeholder {
  color: var(--grayDark);
}

select.wizard-input {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239DA3B0' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2rem;
}

.wizard-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.wizard-btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
}

.wizard-preview-file {
  margin-top: 1rem;
}

.wizard-preview-file h4 {
  color: var(--white);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.wizard-preview-file pre {
  background: #0C0E14;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--grayLight);
  white-space: pre;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  header { padding: 1.5rem 1rem; }
  header h1 { font-size: 1.8rem; }
  .header-logo { gap: 0.5rem; }
  .header-logo svg { width: 36px; height: 36px; }
  .container { padding: 1.2rem 1rem; }
  .section-title { font-size: 1.1rem; }
  .card { padding: 1rem; }
  .installer-card { padding: 1.2rem 1rem; }
  .installer-btn { padding: 0.6rem 1.5rem; font-size: 0.9rem; }
  .file-list li { flex-wrap: wrap; gap: 0.3rem; }
  .file-list .name { min-width: 100%; }
  .install-cmd { font-size: 0.75rem; padding: 0.8rem; }
  .sys-req { flex-direction: column; }
  .footer-links { flex-direction: column; gap: 0.5rem; }
  .overview-grid { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
  .portal-nav a { padding: 0.5rem 0.8rem; font-size: 0.75rem; }
}
