/* CSS Variables */
:root {
  --primary-color: #0f172a;
  /* Slate 900 */
  --primary-hover: #1e293b;
  /* Slate 800 */
  --accent-color: #3b82f6;
  /* Blue 500 */
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --bg-color: #ffffff;
  --text-color: #0f172a;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --header-height: 80px;
  --mono-font: 'JetBrains Mono', 'IBM Plex Mono', monospace;
}


/* Base styles */
html {
  overflow-y: scroll;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(#e5e7eb 0.5px, transparent 0.5px),
    radial-gradient(#e5e7eb 0.5px, transparent 0.5px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Header styles */
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-container {
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
}

.logo img {
  height: 36px;
  width: auto;
  display: block;
}

.main-nav {
  display: flex;
  gap: 24px;
}

.main-nav a {
  font-weight: 500;
  padding: 12px 16px;
  /* Increased for mobile touch targets (min 44px height) */
  border-radius: 6px;
  transition: background-color 0.2s;
  display: inline-block;
}

.main-nav a:hover {
  background: var(--bg-color);
  opacity: 1;
}

.main-nav a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Layout container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 16px;
  width: 100%;
}

.page-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

.page-container .card {
  max-width: 100%;
}

.section {
  margin-top: 2.5rem;
}

.card {
  max-width: 680px;
  margin: 40px auto;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 6px 18px var(--shadow-color);
  padding: 32px;
}

/* Headings and text */
h1,
h2,
h3 {
  font-family: var(--mono-font);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.tool-header h1 {
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 12px;
}

.tool-header p {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 48px;
}

h1,
h2,
h3 {
  margin-bottom: 16px;
  color: var(--text-color);
}

p {
  font-size: 1.1rem;
  margin-bottom: 24px;
}

label {
  font-weight: 600;
  margin-top: 20px;
  display: block;
}

/* Form elements */
input,
select,
button {
  font-size: 1rem;
  border-radius: 8px;
  font-family: inherit;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  margin-top: 8px;
  background: var(--card-bg);
  color: var(--text-color);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-top: 0;
}

input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Button styles */
button.primary {
  width: 100%;
  padding: 12px 14px;
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 24px;
  transition: background-color 0.2s;
}

button.primary:hover {
  background: var(--primary-hover);
}

button.primary:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button.secondary {
  width: 100%;
  padding: 12px 14px;
  background: #e5e7eb;
  color: var(--text-color);
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 24px;
  transition: background-color 0.2s;
}

button.secondary:hover {
  background: #d1d5db;
}

button.secondary:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button.btn-sm {
  width: auto !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
  margin-top: 0 !important;
}

.remove-btn {
  padding: 10px 16px;
  background: var(--danger-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.remove-btn:hover {
  background: var(--danger-hover);
}

/* Tool card list */
.tool-list {
  display: grid;
  gap: 16px;
}

a.tool {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  font-weight: 600;
  transition: box-shadow 0.2s;
}

a.tool:hover {
  box-shadow: 0 4px 14px var(--shadow-color);
}

/* Table styles and responsive scroll */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* smooth scrolling on iOS */
  margin-top: 32px;
  border-radius: 8px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
  /* Ensure table doesn't squish too much on mobile */
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

/* Compact table inputs */
.table input,
.table select {
  padding: 8px 10px;
  margin-top: 0;
  width: 100%;
}

.table select {
  padding: 8px 4px;
  /* Reduced horizontal padding for dropdowns */
  font-size: 0.9rem;
  /* Slightly smaller font to fit 3 chars + arrow */
}

/* Ensure columns have enough space to prevent input text cutoff */
.table .amount {
  min-width: 140px;
}

.table .crypto,
.table .fiat {
  min-width: 100px;
}

th {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

/* Skeleton Loading Animation */
.skeleton-loader {
  background: linear-gradient(-90deg, var(--border-color) 0%, var(--bg-color) 50%, var(--border-color) 100%);
  background-size: 400% 400%;
  animation: pulse 1.2s ease-in-out infinite;
  color: transparent !important;
  border-radius: 4px;
  min-height: 1.5em;
  /* Match line height */
  display: inline-block;
}

@keyframes pulse {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: -135% 0%;
  }
}

/* Flex rows */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.row select {
  flex: 1;
}

/* Footer styles */
footer {
  margin-top: auto;
  padding: 48px 0 24px;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-section h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text-color);
}

.footer-section a {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
  text-decoration: none;
}

.footer-section a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.footer-bottom p {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
  margin-bottom: 0;
}

/* Copy button styles */
.copy-btn {
  padding: 6px 12px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 8px;
}

.copy-btn:hover {
  background: var(--primary-hover);
}

.copied-msg {
  margin-left: 8px;
  color: var(--primary-color);
  font-size: 0.9rem;
}

/* Toggle Details Button */
.toggle-details-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-details-btn:hover {
  background: var(--bg-color);
  border-color: var(--primary-color);
}

.details-row {
  background: var(--bg-color);
}

.details-content {
  padding: 12px 24px 12px 12px;
  display: flex;
  gap: 24px;
  justify-content: flex-end;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--border-color);
}

.details-content strong {
  color: var(--text-color);
}

/* Media Queries */
@media (max-width: 768px) {
  .container {
    padding: 32px 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  p {
    font-size: 1rem;
  }

  .card {
    padding: 24px;
    margin: 24px auto;
  }

  .logo {
    max-width: 60%;
  }

  .header-content {
    flex-direction: column;
    gap: 16px;
  }

  .main-nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .main-nav a {
    font-size: 0.9rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .footer-section {
    align-items: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 24px 12px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .card {
    padding: 16px;
  }

  .logo {
    max-width: 80%;
  }
}

/* Print styles */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  a.tool {
    border: 1px solid #ddd;
  }

  button {
    display: none;
  }

  .site-header {
    border-bottom: 1px solid #ddd;
  }
}

/* Workshop Functional Status Bar */
.workshop-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  /* Slate 50 */
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 12px;
  margin-bottom: 12px;
  font-family: var(--mono-font);
  font-size: 11px;
  color: #64748b;
  /* Slate 500 */
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-group {
  display: flex;
  gap: 16px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-label {
  opacity: 0.7;
}

.status-value {
  font-weight: 700;
  color: var(--primary-color);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
}

.status-indicator.active {
  background: #10b981;
  /* Emerald 500 */
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.status-indicator.error {
  background: var(--danger-color);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.transformation-metrics {
  font-size: 10px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #e2e8f0;
}

/* Content Typography & Lists */
.page-content ul,
.seo-content ul,
.guide-body ul {
  padding-inline-start: 1.5rem;
  margin-bottom: 1.5rem;
  list-style-type: disc;
}

.page-content ol,
.seo-content ol,
.guide-body ol {
  padding-inline-start: 1.5rem;
  margin-bottom: 1.5rem;
  list-style-type: decimal;
}

.page-content li,
.seo-content li,
.guide-body li {
  margin-bottom: 0.5rem;
}

/* Global Fixes for Pre/Code Overflow */
pre {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  max-width: 100%;
  font-size: 0.9rem;
  line-height: 1.5;
}

pre code {
  white-space: pre;
  word-wrap: normal;
}

/* Tool Textarea Standards */
textarea {
  min-height: 200px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: 'Inter', monospace;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.page-content p,
.seo-content p,
.guide-body p {
  margin-bottom: 1rem;
}

.page-content h2,
.seo-content h2,
.guide-body h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Tool UI utility classes */
.tool-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.tool-label-row label {
  margin-top: 0;
  font-weight: 700;
}

.tool-textarea-lg {
  height: 300px;
  padding: 10px;
  margin-bottom: 20px;
  font-family: var(--mono-font);
}

.tool-textarea-fill {
  flex: 1;
  min-height: 300px;
  padding: 10px;
  font-family: var(--mono-font);
  resize: none;
}

.tool-textarea-output {
  background: #f9f9f9;
}

.tool-panel-column {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tool-column {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.tool-stack-20 {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-controls-side {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 15px;
  min-width: 200px;
}

.settings-group {
  background: #f4f6f8;
  padding: 15px;
  border-radius: 8px;
}

.btn-auto {
  width: auto !important;
  margin-top: 0 !important;
}

.btn-md-inline {
  width: auto !important;
  margin-top: 0 !important;
  padding: 8px 16px !important;
  font-size: 14px !important;
}

.tool-error-inline {
  margin-top: 15px;
  font-family: var(--mono-font);
  font-size: 13px;
}

.tool-error-danger {
  color: red;
  margin-top: 10px;
  font-family: var(--mono-font);
  font-size: 13px;
}

.json-output-pre {
  background: #f4f4f4;
  padding: 15px;
  min-height: 300px;
  margin-top: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.tool-layout-column {
  flex-direction: column;
}

.tool-flex-row-wrap {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.tool-min-w-300 {
  min-width: 300px;
}

.tool-output-narrow {
  max-width: 350px;
}

.tool-heading-sm {
  margin-top: 0;
  margin-bottom: 15px;
  padding-bottom: 10px;
  font-size: 18px;
  border-bottom: 1px solid #eee;
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.stat-card {
  background: #f4f6f8;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 5px;
  font-size: 24px;
  font-weight: 700;
  color: #111;
}

.stat-value-lg {
  font-size: 28px;
}

.stat-value-danger {
  color: #d32f2f;
}

.stat-value-success {
  color: #388e3c;
}

.analysis-section {
  margin-top: 25px;
}

.analysis-heading {
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
}

.analysis-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  color: #555;
}

.analysis-list-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.analysis-list-item:last-child {
  border-bottom: 0;
}

.diff-options {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  background: #f4f6f8;
}

.diff-options-title {
  font-size: 14px;
  font-weight: 700;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  font-size: 14px;
  cursor: pointer;
}

.option-row + .option-row {
  margin-top: 8px;
}

.option-row-compact {
  gap: 6px;
  margin: 0;
}

.option-row input {
  margin: 0;
}

.tool-divider {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 10px 0;
}

.tool-output-scroll {
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-family: var(--mono-font);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-output-placeholder {
  padding: 15px;
  color: #777;
  font-style: italic;
}

.tool-row {
  display: flex;
  gap: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

.tool-input-regex {
  flex: 1;
  padding: 10px;
  font-family: var(--mono-font);
}

.tool-input-flags {
  width: 100px;
  padding: 10px;
  font-family: var(--mono-font);
}

.tool-pre-output {
  min-height: 100px;
  padding: 15px;
  background: #f4f4f4;
  font-family: var(--mono-font);
}

.tool-subheading {
  margin: 0;
  font-size: 16px;
}

.tool-text-sm {
  font-size: 14px;
}

.tool-text-md {
  font-size: 15px;
}

.tool-text-lg {
  font-size: 16px;
}

.tool-help-text {
  margin: 4px 0 0 24px;
  font-size: 11px;
  color: #777;
}

.tool-select-sm {
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.tool-alert {
  display: none;
  padding: 10px;
  border-left: 3px solid #c62828;
  border-radius: 4px;
  background: #ffebee;
  color: #c62828;
  font-size: 13px;
}

.settings-title {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 14px;
}

.option-row-first {
  margin-top: 0;
}

.tool-mt-20 {
  margin-top: 20px;
}

.tool-textarea-code-nowrap {
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.tool-error-strong {
  padding: 15px;
  color: #c62828;
  font-weight: 700;
}

.diff-line {
  padding: 2px 10px;
}

.diff-line-added {
  background-color: #e6ffed;
  border-left: 4px solid #388e3c;
}

.diff-line-removed {
  background-color: #ffeef0;
  border-left: 4px solid #c62828;
}

.diff-line-unchanged {
  color: #555;
}

.diff-sign {
  margin-right: 10px;
  user-select: none;
}

.diff-sign-added {
  color: #388e3c;
}

.diff-sign-removed {
  color: #c62828;
}

.diff-sign-unchanged {
  color: #eee;
}

.compare-input-grid {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.compare-input-grid textarea {
  width: 50%;
}

.tool-output-break-anywhere {
  line-break: anywhere;
}

.tool-min-h-200 {
  min-height: 200px;
}

.tool-textarea-human {
  min-height: 400px;
  font-family: sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.word-counter-input {
  width: 100%;
  height: 300px;
  padding: 10px;
  margin-bottom: 20px;
  font-family: sans-serif;
}

.word-counter-stats {
  display: flex;
  gap: 20px;
  padding: 20px;
  border-radius: 8px;
  background: #f9f9f9;
  font-size: 1.2em;
}
