/* TowerCoverage ClientUI dark theme (tc-layout-v2, home/home dark mode) */
:root {
  --tc-accent: #247fba;
  --tc-accent-light: #3b9fd4;
  --tc-accent-dark: #1d6299;
  --tc-bg-fallback: #003b6f;
  --tc-glass-bg: rgba(10, 18, 30, 0.52);
  --tc-glass-border: rgba(255, 255, 255, 0.1);
  --tc-glass-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
  --tc-glass-blur: 10px;
  --tc-text: rgba(240, 246, 255, 0.94);
  --tc-muted: rgba(210, 225, 245, 0.72);
  --tc-success: #22c55e;
  --tc-error: #ef4444;
  --tc-warn: #f59e0b;
  --tc-mono: Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Calibri, "Segoe UI", system-ui, sans-serif;
  color: var(--tc-text);
  line-height: 1.5;
  background-color: var(--tc-bg-fallback);
  background-image: url("/images/login-bg.svg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.site-header {
  background: rgb(36, 127, 181);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.site-header-inner {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: inline-block;
  opacity: 0.9;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
}

.brand-api {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.brand-tagline {
  flex: 1 1 220px;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(229, 242, 255, 0.82);
  min-width: 0;
}

.brand-tagline strong {
  font-weight: 600;
  color: rgba(229, 242, 255, 0.95);
}

.layout {
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.layout-sidebar {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.panel {
  background: var(--tc-glass-bg);
  border: 1px solid var(--tc-glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--tc-glass-shadow);
  backdrop-filter: blur(var(--tc-glass-blur)) saturate(125%);
  -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(125%);
  min-width: 0;
  overflow: hidden;
}

.panel h2 {
  margin: -1.25rem -1.25rem 1rem;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tc-text);
  background: rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel h3 {
  font-size: 0.9rem;
  color: var(--tc-muted);
  margin: 0 0 0.5rem;
}

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--tc-muted);
}

input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: var(--tc-text);
  font-size: 0.95rem;
}

input:focus,
select:focus {
  outline: 2px solid rgba(36, 127, 186, 0.45);
  border-color: var(--tc-accent);
}

select,
select.endpoint-select {
  color-scheme: dark;
  appearance: none;
  background-color: rgba(0, 0, 0, 0.28);
  background-image:
    linear-gradient(45deg, transparent 50%, #93c5fd 50%),
    linear-gradient(135deg, #93c5fd 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

select option {
  background: #071f3e;
  color: var(--tc-text);
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.endpoint-grid .endpoint-grid-full {
  grid-column: 1 / -1;
}

.legacy-warning {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(180, 83, 9, 0.55);
  border-left: 4px solid #d97706;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  color: #7c2d12;
  font-size: 0.9rem;
  line-height: 1.4;
}

.legacy-warning code {
  background: rgba(120, 53, 15, 0.12);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
}

@media (max-width: 720px) {
  .endpoint-grid {
    grid-template-columns: 1fr;
  }
}

input:invalid {
  border-color: rgba(239, 68, 68, 0.65);
}

.account-error {
  color: #fca5a5;
  font-size: 0.82rem;
  margin: -0.35rem 0 0.75rem;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.param-field label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.param-help {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--tc-muted);
}

.param-docs {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--tc-glass-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.param-docs h3 {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.param-docs ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--tc-muted);
  font-size: 0.8rem;
}

.param-docs li {
  margin-bottom: 0.35rem;
}

.param-docs code {
  color: #93c5fd;
  font-family: var(--tc-mono);
  font-size: 0.78rem;
}

.param-docs .param-req {
  color: #fbbf24;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.param-docs .param-opt {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.hint {
  color: var(--tc-muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
}

.hint li {
  margin-bottom: 0.25rem;
}

.hint code {
  color: #93c5fd;
  font-family: var(--tc-mono);
  font-size: 0.82rem;
  word-break: break-all;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background 150ms ease;
}

.btn.primary {
  background: var(--tc-accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--tc-accent-light);
}

.badge {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge.idle { background: rgba(51, 65, 85, 0.8); color: var(--tc-muted); }
.badge.loading { background: rgba(66, 32, 6, 0.8); color: var(--tc-warn); }
.badge.ok { background: rgba(20, 83, 45, 0.8); color: #86efac; }
.badge.fail { background: rgba(69, 10, 10, 0.8); color: #fca5a5; }

.response {
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid var(--tc-glass-border);
  border-radius: 8px;
  padding: 1rem;
  min-height: 160px;
  max-height: 420px;
  overflow: auto;
  font-family: var(--tc-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.response.ok { border-color: rgba(34, 197, 94, 0.45); }
.response.fail { border-color: rgba(239, 68, 68, 0.45); }

.examples-wrap {
  margin: 0;
  padding: 0;
  border-top: none;
}

.panel.examples .examples-wrap h3:first-child {
  margin-top: 0;
}

.examples-wrap h3 {
  font-size: 0.9rem;
  color: var(--tc-muted);
  margin: 0 0 0.5rem;
}

.examples-wrap h3:not(:first-child) {
  margin-top: 1rem;
}

.response.example {
  min-height: 120px;
  max-height: none;
  color: #cbd5e1;
}

.panel.examples .response.example {
  max-height: 36vh;
}

/* API catalog */
.catalog-group {
  margin-bottom: 1.25rem;
}

.catalog-group:last-child {
  margin-bottom: 0;
}

.catalog-group h3 {
  color: var(--tc-accent-light);
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.catalog-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.catalog-item:last-child {
  border-bottom: none;
}

.catalog-route {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.6rem;
  margin-bottom: 0.3rem;
}

.catalog-method {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(36, 127, 186, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(36, 127, 186, 0.35);
}

.catalog-path {
  flex: 1 1 100%;
  color: #93c5fd;
  font-family: var(--tc-mono);
  font-size: 0.8rem;
  line-height: 1.35;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.catalog-desc {
  display: block;
  color: var(--tc-muted);
  font-size: 0.84rem;
  line-height: 1.4;
  padding-left: 0;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--tc-muted);
  font-size: 0.85rem;
}

.area51-alien {
  position: fixed;
  bottom: 18%;
  left: -8rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  animation: area51-alien-run 4.2s linear forwards;
}

.area51-alien-body {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(120, 255, 160, 0.95));
  animation: area51-alien-bob 0.45s ease-in-out infinite alternate;
}

.area51-alien-trail {
  font-size: 1.1rem;
  letter-spacing: 0.15rem;
  color: rgba(170, 255, 200, 0.9);
  text-shadow: 0 0 8px rgba(120, 255, 160, 0.8);
}

@keyframes area51-alien-run {
  0% { left: -8rem; }
  100% { left: calc(100vw + 8rem); }
}

@keyframes area51-alien-bob {
  from { transform: translateY(0) rotate(-10deg); }
  to { transform: translateY(-14px) rotate(10deg); }
}

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) minmax(280px, 360px);
    grid-template-areas: "sidebar tester examples";
    align-items: start;
  }

  .layout-sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
  }

  .layout-sidebar .credentials {
    flex: 0 0 auto;
  }

  .layout-sidebar .catalog {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .layout-sidebar .catalog #catalog {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.15rem;
  }

  .tester {
    grid-area: tester;
  }

  .examples {
    grid-area: examples;
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .catalog-path {
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (min-width: 720px) and (max-width: 1099px) {
  .layout {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    grid-template-areas:
      "sidebar tester"
      "examples examples";
    align-items: start;
  }

  .layout-sidebar {
    grid-area: sidebar;
  }

  .tester { grid-area: tester; }
  .examples { grid-area: examples; }
}

@media (max-width: 719px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
