@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* ============================================
   TACTICAL DASHBOARD - AGENT ALPHA THEME
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #050505;
  --surface: #0f0f0f;
  --border: #222;
  --border-light: #333;
  --text: #e0e0e0;
  --muted: #666;
  --accent: #ff3b1d;
  --green: #4ade80;
}

body.light-mode {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #d0d5dd;
  --border-light: #e4e7ec;
  --text: #1a1a1a;
  --muted: #667085;
  --accent: #ff3b1d;
  --header-bg: rgba(240, 242, 245, 0.85);
}

:root {
  --header-bg: rgba(5, 5, 5, 0.85);
}

/* ---- BASE ---- */
body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  margin: 0;
}

/* Subtle dot grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* HUD Frame */
/* Removed fixed decorative border to allow clean page scrolling */

/* ---- LAYOUT ---- */
.page-header {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.page-header .logo {
  height: 22px;
  opacity: 0.9;
}

.nav-tabs {
  display: flex;
  gap: 32px;
  height: 100%;
  margin-left: 32px;
}

.nav-tab {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  padding: 18px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.main-layout {
  position: relative;
  height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 0;
  padding: 24px;
  z-index: 1;
  overflow: hidden;
}

/* ---- LEFT SECTION (Agent Details) ---- */
.left-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-right: 24px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  height: 100%;
}

/* Custom scrollbar for left section */
.left-section::-webkit-scrollbar {
  width: 4px;
}

.left-section::-webkit-scrollbar-track {
  background: transparent;
}

.left-section::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.left-section::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ---- CENTER (Viewer) + RIGHT (Ops) share .right-section ---- */
.right-section {
  display: contents;
}

.viewer-area {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100%;
}

/* Targeting grid overlay */
.viewer-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 10% 100%,
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 100% 10%;
  opacity: 0.15;
  pointer-events: none;
}

/* Targeting crosshair */
.viewer-area::after {
  content: "+";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  color: var(--accent);
  opacity: 0.2;
  font-weight: 300;
  pointer-events: none;
}

/* ---- RIGHT SECTION (Operations List) ---- */
.presets-section {
  display: flex;
  flex-direction: column;
  padding-left: 24px;
  border-left: 1px solid var(--border);
  height: 100%;
  overflow: hidden;
}

/* Custom scrollbar for presets section */
.presets-section::-webkit-scrollbar {
  display: none;
}

.library-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 0 !important;
}

/* ---- PANELS ---- */
.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  transition: border-color 0.3s;
}

.panel:hover {
  border-color: var(--border-light);
}

/* L-shaped corner markers */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.6;
}

.panel::before {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}

.panel::after {
  bottom: 0;
  right: 0;
  border-width: 0 1px 1px 0;
}

.panel-meta {
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 8px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.8;
  pointer-events: none;
}

/* Right-aligned meta for headers */
.panel-meta.right {
  left: auto;
  right: 20px;
  color: var(--muted);
  opacity: 0.6;
}

.panel h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2 .count {
  color: var(--accent);
  font-weight: 400;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- SERIES TABS ---- */
.series-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.series-tabs button {
  flex: 1;
  padding: 10px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.series-tabs button:not(:last-child) {
  border-right: 1px solid var(--border);
}

.series-tabs button:hover {
  color: var(--text);
  background: var(--surface);
}

.series-tabs button.active {
  color: var(--accent);
  background: rgba(255, 59, 29, 0.08);
}

.series-params {
  display: none;
}

.series-params.active {
  display: block;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.btn-primary:hover {
  background: rgba(255, 59, 29, 0.1);
  border-color: #ff5e47;
  color: #ff5e47;
}

.btn-export {
  flex: 1;
}

.btn-export:hover {
  border-color: var(--green);
  color: var(--green);
}

.export-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ---- VIEW SWITCHES ---- */
.view-mode-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
}

.view-mode-switch button {
  padding: 8px 14px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.view-mode-switch button:hover {
  color: var(--text);
}

.view-mode-switch button.active {
  color: var(--accent);
  background: rgba(255, 59, 29, 0.1);
}

.view-3d-mode-switch {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.6);
}

.view-3d-mode-switch.hidden {
  display: none;
}

.view-3d-mode-switch button {
  padding: 6px 12px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.view-3d-mode-switch button:hover {
  color: var(--text);
}

.view-3d-mode-switch button.active {
  color: var(--accent);
  background: rgba(255, 59, 29, 0.1);
}

.view-2d-wrap,
.view-3d-wrap {
  position: absolute;
  inset: 0;
}

.view-2d-wrap.hidden,
.view-3d-wrap.hidden {
  display: none;
}

#previewCanvas,
#view3dCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

#svgExport {
  display: none;
}

/* ---- PRESETS / OPERATIONS LIST ---- */
.presets-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent !important;
  border: none !important;
}

.presets-panel h2 {
  flex-shrink: 0;
}

.presets {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-right: 8px;
  overflow-y: auto;
  margin-top: 16px;
  padding-bottom: 16px;
}

@media (max-width: 1400px) {
  .presets {
    grid-template-columns: 1fr;
  }
}

/* Custom scrollbar */
.presets::-webkit-scrollbar {
  width: 4px;
}

.presets::-webkit-scrollbar-track {
  background: transparent;
}

.presets::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.presets::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.preset-group {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.preset-group:first-child {
  margin-top: 0;
}

.preset-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.preset-btns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (max-width: 1600px) {
  .preset-btns {
    grid-template-columns: 1fr;
  }
}

.preset-item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

/* Left accent bar on hover */
.preset-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: transparent;
  transition: background 0.2s;
}

.preset-item:hover {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.preset-item:hover::before {
  background: var(--accent);
}

.preset-preview-svg {
  display: block;
  width: 100%;
  height: 80px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  pointer-events: none;
}

.preset-preview-svg svg {
  width: 100%;
  height: 100%;
}

.preset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}

.preset-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.preset-info .code {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.preset-info .desc {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.join-btn {
  padding: 6px 12px;
  font-size: 9px;
  font-family: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.preset-item:hover .join-btn {
  border-color: var(--accent);
  color: var(--accent);
}

.preset-name {
  display: none;
}

/* ---- MISC ---- */
.hint {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.points-row {
  margin-top: 16px;
}

.slider-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.slider-input-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.points-num {
  width: 60px;
  text-align: center;
}

.dat-format-row {
  margin-bottom: 12px;
}

.dat-format-row select {
  margin-top: 4px;
}

/* ---- FOOTER ---- */
.site-footer {
  flex-shrink: 0;
  width: 100%;
  height: auto;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 24px;
  z-index: 100;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  height: 18px;
  opacity: 0.7;
}

.footer-text {
  font-size: 11px;
  color: var(--muted);
}

.footer-text span {
  color: var(--accent);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent);
}

.footer-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.footer-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.footer-copyright {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
}

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

body.light-mode .sun-icon {
  display: none;
}

body:not(.light-mode) .moon-icon {
  display: none;
}

.theme-label {
  display: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1400px) {
  .main-layout {
    grid-template-columns: 300px 1fr 300px;
  }
}

@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 280px 1fr;
  }

  .presets-section {
    display: none;
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .main-layout {
    position: relative;
    grid-template-columns: 1fr;
    height: auto;
    padding: 24px 16px;
    overflow: visible;
  }

  .left-section {
    border-right: none;
    padding-right: 0;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    height: auto;
    overflow: visible;
  }

  .viewer-area {
    height: 400px;
    min-height: 300px;
  }

  .presets-section {
    display: flex;
    border-left: none;
    padding-left: 0;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    max-height: 400px;
  }
}

@media (max-width: 600px) {
  .page-header {
    padding: 0 16px;
  }

  .nav-tabs {
    display: none;
  }

  .site-footer {
    height: auto;
    min-height: auto;
    padding: 16px 20px;
  }

  .footer-content {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .footer-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

  .footer-divider {
    display: none;
  }

  .footer-copyright {
    width: 100%;
    text-align: center;
    margin-top: 4px;
    order: 3;
  }
}

/* ---- SEO CONTENT SECTION ---- */
.seo-info-section {
  max-width: 1200px;
  margin: 48px auto;
  padding: 0 24px 64px;
  color: var(--muted);
  line-height: 1.6;
}

.seo-info-section h2 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.seo-info-section h3 {
  font-size: 14px;
  color: var(--text);
  margin: 24px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.seo-info-section p {
  font-size: 13px;
  margin-bottom: 16px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}
