:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

a {
  color: #0a6b4b;
}

.site-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  border-bottom: 1px solid #dbe5ee;
  background: #ffffff;
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 12px 16px;
  font-weight: 600;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.site-footer {
  border-top: 1px solid #dbe5ee;
  background: #ffffff;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #475569;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.tool-directory {
  margin-top: 14px;
}

.tool-search-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-search-input {
  width: 100%;
  border: 1px solid #c1d1de;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  background: #ffffff;
  margin-bottom: 14px;
}

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.tool-card {
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  padding: 12px;
}

.tool-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tool-card-title {
  margin: 0;
  font-size: 1.1rem;
}

.favorite-button {
  border: 1px solid #0a6b4b;
  background: #e6f6ee;
  color: #064e3b;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.favorite-button[aria-pressed="true"] {
  background: #0a6b4b;
  color: #ffffff;
}

.favorite-icon {
  width: 15px;
  height: 15px;
}

.tool-card-description {
  margin: 8px 0 4px;
}

.tool-card-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
  color: #475569;
}

.tool-empty {
  margin-top: 12px;
}

.tool-search-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.content-page {
  max-width: 70ch;
}

.content-page h1 {
  margin-bottom: 0.65rem;
}

.content-page p {
  line-height: 1.65;
}

/* MD-to-PDF preview styles */
.md-preview-content {
  line-height: 1.6;
  color: var(--md-text-color);
}

.md-preview-content h1,
.md-preview-content h2,
.md-preview-content h3,
.md-preview-content h4,
.md-preview-content h5,
.md-preview-content h6 {
  line-height: 1.25;
  margin: 1.2em 0 0.6em;
}

.md-preview-content h1 {
  margin-top: 0;
}

.md-preview-content p,
.md-preview-content ul,
.md-preview-content ol,
.md-preview-content pre,
.md-preview-content blockquote {
  margin: 0 0 1em;
}

.md-preview-content ul,
.md-preview-content ol {
  padding-left: 1.4em;
}

.md-preview-content li + li {
  margin-top: 0.25em;
}

.md-preview-content blockquote {
  border-left: 4px solid var(--md-border-color);
  color: var(--md-muted-color);
  padding-left: 0.8em;
  margin-left: 0;
}

.md-preview-content pre {
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-border-color);
  border-radius: 6px;
  overflow-x: auto;
  padding: 0.8em;
}

.md-preview-content code {
  background: var(--md-code-bg-color);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}

.md-preview-content pre > code {
  background: transparent;
  padding: 0;
}

.md-preview-content a {
  color: var(--md-link-color);
  text-decoration: underline;
}

.md-preview-content hr {
  border: none;
  border-top: 1px solid var(--md-border-color);
  margin: 1.2em 0;
}

/* Feedback form */
.feedback-page {
  max-width: 600px;
  margin: 0 auto;
}

.feedback-form {
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  padding: 20px;
}

.feedback-form .form-group {
  margin-bottom: 16px;
}

.feedback-form label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.feedback-form input[type="text"],
.feedback-form input[type="email"],
.feedback-form select,
.feedback-form textarea {
  width: 100%;
  border: 1px solid #c1d1de;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  color: #0f172a;
}

.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: #0a6b4b;
  box-shadow: 0 0 0 3px rgba(10, 107, 75, 0.12);
}

.feedback-form textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-form button[type="submit"] {
  background: #0a6b4b;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.feedback-form button[type="submit"]:hover {
  background: #085d41;
}

.feedback-errors {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #991b1b;
  font-size: 0.9rem;
}

.feedback-errors ul {
  margin: 0;
  padding-left: 1.2em;
}

.feedback-errors li + li {
  margin-top: 4px;
}

.feedback-success {
  background: #e6f6ee;
  border: 1px solid #0a6b4b;
  border-radius: 12px;
  padding: 20px;
}

.feedback-success p {
  margin: 0 0 12px;
  font-weight: 600;
  color: #064e3b;
}

.feedback-success button {
  background: none;
  border: 1px solid #0a6b4b;
  color: #0a6b4b;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.feedback-success button:hover {
  background: #0a6b4b;
  color: #ffffff;
}

/* Admin area */
.admin-login {
  max-width: 360px;
  margin: 0 auto;
}

.admin-login form {
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  padding: 20px;
}

.admin-login label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.admin-login input[type="text"],
.admin-login input[type="email"],
.admin-login input[type="password"] {
  width: 100%;
  border: 1px solid #c1d1de;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 16px;
}

.admin-login input[type="text"]:focus,
.admin-login input[type="email"]:focus,
.admin-login input[type="password"]:focus {
  outline: none;
  border-color: #0a6b4b;
  box-shadow: 0 0 0 3px rgba(10, 107, 75, 0.12);
}

.admin-reveal {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 16px;
  cursor: pointer;
}

.admin-reveal input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.admin-login button,
.admin-header button {
  background: #0a6b4b;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-login button:hover,
.admin-header button:hover {
  background: #085d41;
}

.admin-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #991b1b;
  font-size: 0.9rem;
}

.admin-notice {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #065f46;
  font-size: 0.9rem;
}

.admin-delete {
  background: #ffffff;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-delete:hover {
  background: #fef2f2;
}

.admin-actions {
  margin-top: 20px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.admin-header h1 {
  margin: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e7eef5;
  vertical-align: top;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table small {
  color: #5b6b7c;
}

.admin-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.admin-meta dt {
  font-weight: 700;
}

.admin-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-message {
  background: #ffffff;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  padding: 20px;
  line-height: 1.6;
}

@media (min-width: 760px) {
  .site-nav {
    padding-left: 20px;
    padding-right: 20px;
  }

  .site-main {
    padding: 20px;
  }

  .tool-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
