/* ============================================================
   Sam's Mission SQF Manager — style.css
   Dark military theme, consistent with site design system
   ============================================================ */

/* ─── Custom Properties ─────────────────────────────────────── */
:root {
  --bg:          #0d0d0d;
  --surface:     #1a1a1a;
  --surface2:    #222222;
  --surface3:    #2a2a2a;
  --border:      #333333;
  --border2:     #444444;
  --accent:      #4e8a2e;
  --accent-h:    #5da033;
  --accent-dim:  rgba(78,138,46,0.18);
  --accent-glow: rgba(78,138,46,0.10);
  --text:        #e8e8e8;
  --text-dim:    #888888;
  --text-muted:  #555555;
  --danger:      #c0392b;
  --success:     #2ecc71;
  --radius:      8px;
  --shadow:      0 2px 12px rgba(0,0,0,0.5);
}

/* ============================================================
   LIGHT MODE OVERRIDES
   ============================================================ */
[data-theme="light"] {
  --bg:          #f5f5f4;
  --surface:     #ececea;
  --surface2:    #ffffff;
  --surface3:    #f0f0ee;
  --border:      #cccccc;
  --border2:     #bbbbbb;
  --accent:      #3d7020;
  --accent-h:    #2e5818;
  --accent-dim:  rgba(78,138,46,0.18);
  --text:        #222222;
  --text-dim:    #666666;
  --text-muted:  #888888;
  --shadow:      0 2px 12px rgba(0,0,0,.10);
}

[data-theme="light"] code { color: #2e6010; }

[data-theme="light"] .tool-header {
  background: #e8f2de;
  border-bottom-color: #b8d4a0;
}

[data-theme="light"] .btn-success {
  background: rgba(46,204,113,0.12);
  border-color: rgba(46,204,113,0.5);
  color: #1a7a40;
}
[data-theme="light"] .btn-success:hover:not(:disabled) { background: rgba(46,204,113,0.22); }

[data-theme="light"] .type-badge-object  { background: rgba(78,138,46,0.15);  color: #3d7020; }
[data-theme="light"] .type-badge-vehicle { background: rgba(52,152,219,0.15); color: #1060a0; }
[data-theme="light"] .type-badge-unit    { background: rgba(231,76,60,0.15);  color: #a03020; }

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  background: var(--surface3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #b0e080;
}

a { color: var(--accent); }
a:hover { color: var(--accent-h); }

/* ─── Site Nav ───────────────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05em;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.site-brand:hover { color: var(--text); }
.site-brand-icon { font-size: 1.2em; }
.site-brand-dim { color: var(--text-dim); font-weight: 400; }
.site-nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
}
.site-nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9em;
  padding: 6px 10px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}
.site-nav-links a:hover,
.site-nav-links a.active {
  color: var(--text);
  background: var(--accent-dim);
}
.site-nav-links a.active {
  color: var(--accent-h);
}

.tool-header {
  background: linear-gradient(160deg, #0e1a09 0%, #0d0d0d 60%);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
}
.tool-header-inner {
  max-width: min(960px, 96vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.tool-header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}
.tool-header-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px var(--accent));
}
.tool-header-title h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.tool-header-sub {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-top: 4px;
}
.tool-header-link {
  flex-shrink: 0;
  font-size: .85rem;
  font-weight: 600;
  color: #62ae3a;
  border: 1px solid #2e5018;
  border-radius: var(--radius);
  padding: .35rem .85rem;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.tool-header-link:hover { background: #2e5018; color: #eaeaea; border-color: #4e8a2e; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

/* ─── Privacy Card ───────────────────────────────────────────── */
.privacy-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(78,138,46,0.07);
  border-color: rgba(78,138,46,0.35);
  font-size: 0.9em;
  color: var(--text-dim);
}
.privacy-icon { font-size: 1.3em; flex-shrink: 0; margin-top: 1px; }
.privacy-card strong { color: var(--text); }

/* ─── About Card ─────────────────────────────────────────────── */
.about-card p { color: var(--text-dim); font-size: 0.9em; line-height: 1.7; }
.about-card p + p { margin-top: 10px; }
.about-title { font-size: 1em; font-weight: 700; margin-bottom: 10px; }

/* ─── Section Titles ─────────────────────────────────────────── */
.section-title {
  font-size: 1.05em;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-desc { font-size: 0.88em; color: var(--text-dim); margin-bottom: 14px; }
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.78em;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface3); color: var(--text); }
.btn-success { background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.4); color: #2ecc71; }
.btn-success:hover:not(:disabled) { background: rgba(46,204,113,0.25); }
.btn-sm { padding: 5px 12px; font-size: 0.83em; }

/* ─── Load Section ───────────────────────────────────────────── */
.load-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.load-or { font-size: 0.85em; color: var(--text-muted); }
.sqf-input {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  padding: 12px 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.sqf-input:focus { border-color: var(--accent); }
.sqf-input::placeholder { color: var(--text-muted); }
.sqf-input.drag-over {
  border-color: var(--accent);
  background: var(--surface3, color-mix(in srgb, var(--surface2) 80%, var(--accent) 20%));
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.load-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.parse-status {
  font-size: 0.85em;
  color: var(--text-dim);
  flex: 1;
  min-width: 0;
}

/* ─── Object Table ───────────────────────────────────────────── */
.object-count {
  margin-left: 4px;
  background: var(--accent-dim);
  color: var(--accent-h);
  font-size: 0.72em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.object-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
.object-table th {
  background: var(--surface3);
  color: var(--text-dim);
  font-size: 0.85em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.object-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
}
.object-table tr:last-child td { border-bottom: none; }
.object-table tr:hover td { background: var(--surface2); }
.type-badge {
  display: inline-block;
  font-size: 0.85em;
  padding: 1px 7px;
  border-radius: 100px;
  font-family: sans-serif;
  font-weight: 600;
}
.type-badge-object  { background: rgba(78,138,46,0.2);  color: #7ec850; }
.type-badge-vehicle { background: rgba(52,152,219,0.2); color: #5db8e8; }
.type-badge-unit    { background: rgba(231,76,60,0.2);  color: #e87070; }
.row-num { color: var(--text-muted); user-select: none; }
.init-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Options Section ────────────────────────────────────────── */
.options-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.options-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.opt-label {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 120px;
  padding-top: 8px;
  flex-shrink: 0;
}
.opt-text, .opt-select {
  flex: 1;
  min-width: 200px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.opt-select { font-family: 'Segoe UI', system-ui, sans-serif; cursor: pointer; }
.opt-text:focus, .opt-select:focus { border-color: var(--accent); }
.opt-number {
  width: 80px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9em;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
}
.opt-number:focus { border-color: var(--accent); }
.opt-hint {
  font-size: 0.78em;
  color: var(--text-muted);
  width: 100%;
  margin-top: -8px;
  padding-left: 130px;
}
.opt-tag {
  font-size: 0.82em;
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Cascadia Code', monospace;
  color: var(--text-dim);
}

/* ─── Toggle Grid ────────────────────────────────────────────── */
.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-bottom: 14px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.toggle-row:hover { border-color: var(--border2); background: var(--surface3); }
.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.toggle-label { font-size: 0.88em; color: var(--text-dim); }

/* ─── Relative position row ──────────────────────────────────── */
.relative-pos-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
}
.relative-pos-row .opt-label { padding-top: 0; }

/* ─── Output Section ─────────────────────────────────────────── */
.output-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.87em;
  transition: background 0.15s, color 0.15s;
}
.tab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-h);
}
.tab-btn:hover:not(.active) { background: var(--surface3); color: var(--text); }
.output-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.output-stats { font-size: 0.82em; color: var(--text-dim); flex: 1; }
.output-area {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #b0e080;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  padding: 14px 16px;
  line-height: 1.5;
  outline: none;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tool-header-inner { flex-direction: column; }
  .tool-header-link { align-self: flex-start; }
  .tool-header-title { gap: 12px; }
  .tool-header-icon { font-size: 2em; }
  .tool-header-title h1 { font-size: 1.35em; }
  .options-row-2col { grid-template-columns: 1fr; }
  .toggle-grid { grid-template-columns: 1fr; }
  .opt-label { min-width: 100px; }
  .opt-hint { padding-left: 0; margin-top: 2px; }
}
