/* Monochrome, modern, clean style for Serin */
:root {
  --background: #fff;
  --foreground: #111;
  --primary: #222;
  --secondary: #666;
  --accent: #000;
  --border: #e5e5e5;
  --button-bg: #222;
  --button-fg: #fff;
  --button-hover-bg: #444;
  --link: #222;
  --link-hover: #666;
}

body {
  font-family: 'Roboto', Arial, sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.container {
  flex: 1 0 auto;
}

.container {
  width: 90%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

footer {
  flex-shrink: 0;
}
header {
  background-color: var(--primary);
  color: #fff;
  padding: 1rem 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
header .container {
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 {
  margin: 0;
  font-size: 1.8rem;
}
header h1 a {
  color: #fff;
  text-decoration: none;
}
nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
nav li {
  margin-left: 1.5rem;
}
nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
}
nav a:hover {
  opacity: 0.8;
}
nav a.active {
  font-weight: 700;
  border-bottom: 2px solid #fff;
  padding-bottom: 2px;
}

main {
  padding: 2rem 0;
}

footer {
  background-color: #f1f1f1;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  border-top: 1px solid #ddd;
}

h1, h2, h3 {
  color: var(--primary);
}

a {
  color: var(--link);
}
a:hover {
  color: var(--link-hover);
}

.btn {
  display: inline-block;
  background-color: var(--button-bg);
  color: var(--button-fg);
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s;
}
.btn:hover {
  background-color: var(--button-hover-bg);
}

.page-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: var(--button-bg, #222);
  color: var(--button-fg, #fff);
  border: none;
  border-radius: 6px;
  padding: 0.6em 1.4em;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
}
.action-btn:hover, .action-btn:focus {
  background: var(--button-hover-bg, #444);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px) scale(1.03);
}
.action-btn:active {
  background: #111;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  transform: translateY(1px) scale(0.98);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}
th, td {
  border: 1px solid #ccc;
  padding: 0.5em 0.75em;
  text-align: left;
}
th {
  background: #f0f0f0;
  font-weight: bold;
}

.pin-mapping-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
.pin-mapping-table th, .pin-mapping-table td {
  border: 1px solid #ccc;
  padding: 0.5em 0.75em;
  text-align: center;
}
.pin-mapping-table th {
  background: #f0f0f0;
  font-weight: bold;
}
.pin-mapping-table tbody tr:nth-child(even) {
  background: #fafafa;
}
.pin-mapping-table tbody tr:nth-child(odd) {
  background: #f5f7fa;
}

/* Wire color rows - higher specificity to override alternating row colors */
.pin-mapping-table tbody tr.wire-black,
.pin-mapping-table tbody tr.wire-black td { background: #444; color: #fff; }
.pin-mapping-table tbody tr.wire-red,
.pin-mapping-table tbody tr.wire-red td { background: #e53935; color: #fff; }
.pin-mapping-table tbody tr.wire-white,
.pin-mapping-table tbody tr.wire-white td { background: #fff; color: #222; }
.pin-mapping-table tbody tr.wire-yellow,
.pin-mapping-table tbody tr.wire-yellow td { background: #ffe066; color: #222; }

/* Form styles */
.form-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75em 1.5em 1em 1.5em;
  background: #f3f3f3;
  margin-bottom: 1.5em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
legend {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.1em;
  font-weight: bold;
  padding: 0 0.5em;
}
input[type="radio"],
input[type="checkbox"] {
  margin-right: 0.5em;
}
input[type="radio"] + label,
input[type="checkbox"] + label {
  display: inline-block;
  margin-bottom: 0.3em;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  max-width: 400px;
  padding: 0.75em 1em;
  border: 1.5px solid #bfc9d1;
  border-radius: 7px;
  background: #f7fafd;
  font-size: 1.08em;
  color: #222;
  margin-bottom: 0.7em;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
  border-color: #2196F3;
  outline: none;
  background: #fff;
  box-shadow: 0 2px 8px rgba(33,150,243,0.08);
}
textarea#dynamic-yaml-output {
  background: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
  line-height: 1.4;
  white-space: pre;
  overflow: auto;
  width: 100%;
  font-family: monospace;
  font-size: 1em;
  box-sizing: border-box;
}

/* Toast notification */
#copy-toast {
  display: none;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #4CAF50;
  color: #fff;
  padding: 0.75em 1.5em;
  border-radius: 6px;
  font-size: 1.1em;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
}
#copy-toast.show {
  display: block;
  animation: fadeInOut 2s ease-in-out;
  opacity: 1;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* Action button group */
.action-btn-group {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 0.5em;
  margin-left: auto;
}
#yaml-action-bar {
  display: flex;
  align-items: center;
  margin-bottom: 0.5em;
  flex-wrap: wrap;
  gap: 0.5em;
}
#yaml-action-bar strong {
  margin-right: auto;
}

/* Error message */
.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 1em;
  border-radius: 6px;
  margin: 1em 0;
  border: 1px solid #ef9a9a;
}

/* Connector image */
.connector-image {
  max-width: 400px;
  max-height: 400px;
  display: block;
  margin: 1em auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  nav ul {
    justify-content: center;
    gap: 0.5rem;
  }

  nav li {
    margin-left: 0;
    margin: 0 0.5rem;
  }

  .container {
    width: 95%;
    padding: 0 10px;
  }

  main {
    padding: 1rem 0;
  }

  /* Responsive tables */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 100%;
  }

  /* Form adjustments */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"] {
    max-width: 100%;
  }

  .form-card {
    padding: 0.5em 1em;
  }

  /* Action buttons stack on mobile */
  #yaml-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-btn-group {
    margin-left: 0;
    justify-content: center;
  }

  .action-btn {
    padding: 0.5em 1em;
    font-size: 0.9em;
  }
}
