/* ========================
   Dark / Minimal Color Palette
   ======================== */

:root {
  --bg: #111111;           /* Page background */
  --text: #ffffff;         /* Main text color */
  --muted: #aaaaaa;        /* Secondary / muted text */
  --line: #333333;         /* Borders, lines */
  --hover-bg: #222222;     /* Slightly lighter for input hover/focus */
  --button-hover: #222222; /* Button hover background */
  --button-active: #333333;/* Button active background */
}

/* ========================
   Global Reset
   ======================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.7;
}

/* ========================
   Layout Wrapper
   ======================== */

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 24px;
}

.site-header {
  padding-bottom: 24px;
}

.site-header + .wrap {
  padding-top: 0;
}

/* ========================
   Site Navigation
   ======================== */

.site-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 20px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.site-breadcrumb a {
  color: var(--muted);
}

.breadcrumb-separator {
  color: var(--line);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.site-nav a {
  color: var(--muted);
}

.site-nav a.is-active,
.site-nav a:hover {
  color: var(--text);
}

/* ========================
   Headings
   ======================== */

h1 {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 24px 0;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 60px 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

/* ========================
   Text & Links
   ======================== */

p {
  margin: 0 0 16px 0;
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover { 
  text-decoration: underline; 
  color: var(--text);
}

/* ========================
   Inputs & Selects
   ======================== */

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom: 1px solid var(--text);
  background: var(--hover-bg); /* dark/minimal fix for focus */
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ========================
   Buttons
   ======================== */

button {
  margin-top: 10px;
  margin-right: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: none;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

button:hover {
  border-color: var(--text);
  background: var(--button-hover);
}

button:active {
  background: var(--button-active);
}

/* Optional stop button */
button.stop-btn {
  border-color: #cc3333;
  color: #cc3333;
}

button.stop-btn:hover {
  background: #330000;
}

/* ========================
   Lists
   ======================== */

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

/* ========================
   Money / Result Display
   ======================== */

.money {
  font-size: 32px;
  margin-top: 20px;
  color: var(--text);
}

/* ========================
   Stats / Small Text
   ======================== */

.stats {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

.status-ok {
  color: #7ddf99;
}

.status-error {
  color: #ff8a8a;
}

/* ========================
   Footer
   ======================== */

footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.related-links {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.related-links h2 {
  margin-top: 0;
}

.related-links p {
  margin-bottom: 18px;
}

.faq-list {
  margin-top: 20px;
}

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.faq-item:first-child {
  padding-top: 0;
}

.faq-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

/* ========================
   Tables (All Tools Page)
   ======================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  color: var(--text);
}

th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

/* ========================
   Side-by-side layout (Counter Page)
   ======================== */

.flex-row {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.flex-row > div {
  flex: 1 1 250px;
}

/* ========================
   Tool Layout
   ======================== */

.tool-grid {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.tool-grid > div {
  flex: 1 1 320px;
}

.panel {
  margin-top: 24px;
}

.panel label {
  display: block;
  margin-top: 16px;
  color: var(--muted);
}

.result-box,
.code-output,
.preview-box,
.swatch,
.qr-frame {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.result-box,
.preview-box {
  color: var(--text);
  white-space: pre-wrap;
}

.code-output {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-box {
  min-height: 220px;
}

.preview-box h1,
.preview-box h2,
.preview-box h3 {
  margin-top: 0;
}

.preview-box ul {
  list-style: none;
  padding: 0;
}

.preview-box li {
  border-bottom: 1px solid var(--line);
}

.inline-fields {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.inline-fields > div {
  flex: 1 1 200px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.large-number {
  font-size: 72px;
  line-height: 1;
  margin-top: 10px;
}

.large-number.small {
  font-size: 52px;
}

.meter {
  width: 100%;
  height: 14px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--hover-bg);
}

.meter-fill {
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width 0.15s ease-in-out;
}

.subscription-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.subscription-item:first-child {
  padding-top: 0;
}

.subscription-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.subscription-meta {
  color: var(--muted);
  font-size: 14px;
}

.subscription-remove-btn {
  margin-top: 0;
  margin-right: 0;
}

.option-list {
  margin-top: 20px;
}

.option-list input {
  width: auto;
  margin-right: 10px;
}

.swatch {
  min-height: 120px;
}

.qr-frame {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-frame img {
  display: block;
  max-width: 100%;
}

/* ========================
   Mobile Responsive
   ======================== */

@media (max-width: 480px) {
  .wrap {
    width: 95%;
    padding: 25px;
  }

  .site-header {
    padding-bottom: 18px;
  }

  .site-header + .wrap {
    padding-top: 0;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 14px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 14px;
  }

  .flex-row {
    flex-direction: column;
  }

  .tool-grid,
  .inline-fields {
    flex-direction: column;
  }

  .subscription-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================
   Map Display
   ======================== */

#map-display {
  width: 100%;
  height: 520px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

/* Fix Leaflet tiles on dark backgrounds */
.leaflet-container {
  background: #000;
  font-family: inherit;
}

/* ========================
   Map Legend
   ======================== */

.legend {
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

.legend ul {
  margin-top: 10px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Colored indicator squares */

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.legend-red { background: #ff4444; }
.legend-blue { background: #4488ff; }
.legend-green { background: #33cc66; }
.legend-yellow { background: #ffcc33; }

.leaflet-control-attribution {
  font-family: inherit;
}

/* ========================
   Leaflet Popup Styling
   ======================== */

.leaflet-popup-content-wrapper {
  background: #111;
  color: #fff;
  border: 1px solid var(--line);
}

.leaflet-popup-tip {
  background: #111;
}

/* ========================
   Mobile Map Adjustment
   ======================== */

@media (max-width: 480px) {

  #map-display {
    height: 420px;
  }

}
