:root {
  --primary: #0d7a3f;
  --primary-hover: #0a6333;
  --primary-light: #e8f5ed;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #0d7a3f;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  background: var(--primary);
  color: #ffffff;
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
header .wrap, main, footer .wrap {
  max-width: 1140px;
  margin: 0 auto;
}
header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
header p {
  margin: 6px 0 0;
  font-size: 14px;
  opacity: 0.92;
}

nav.tabs {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}
nav.tabs a {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-decoration: none;
  padding: 9px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease;
}
nav.tabs a:hover {
  background: rgba(255, 255, 255, 0.3);
}
nav.tabs a.active {
  background: var(--bg-page);
  color: var(--primary);
}

main { padding: 20px 16px 40px; }
.layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
}

.tool-card, .card, .seo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.tool-card h2, .seo-card h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.tool-card p.desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.5;
  background: #ffffff;
  color: #0f172a;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 122, 63, 0.15);
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
}
.options-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}
select, input[type="file"] {
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: var(--text-main);
  outline: none;
}
select:focus {
  border-color: var(--border-focus);
}

/* Meta Bar & Stats */
.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.stat-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.link-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
}
.link-btn:hover {
  background: var(--primary-light);
  text-decoration: none;
}

/* Modern Drag & Drop Zone */
.drop-zone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 4px;
}
.drop-icon svg {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drop-zone:hover .drop-icon svg, .drop-zone.dragover .drop-icon svg {
  transform: translateY(-3px) scale(1.05);
}
.btn-svg {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
  flex-shrink: 0;
}
.badge-detected {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
}
.drop-label {
  font-size: 14px;
  color: #334155;
}
.drop-label strong {
  color: var(--primary);
}
.drop-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.drop-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 16px 0 12px;
}
button {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }
button.secondary {
  background: var(--primary-light);
  color: var(--primary);
}
button.secondary:hover {
  background: #d6ede0;
}
button.outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
button.outline:hover {
  background: #f1f5f9;
  color: var(--text-main);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.status-msg {
  font-size: 13px;
  min-height: 20px;
  margin: 8px 0;
  font-weight: 500;
}
.status-msg.ok { color: #0d7a3f; }
.status-msg.error { color: #dc2626; }
.status-msg.muted { color: var(--text-muted); }

/* Sample Sponsor / Ad Units (Hidden in production, only visible on localhost) */
.ad-slot {
  display: none;
  margin: 18px 0;
  justify-content: center;
}
.is-localhost .ad-slot {
  display: flex;
}
.ad-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.ad-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.ad-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}
.ad-leaderboard {
  max-width: 728px;
  min-height: 90px;
  padding: 10px;
}
.ad-sidebar {
  width: 300px;
  min-height: 250px;
  padding: 16px;
}
.ad-incontent {
  min-height: 90px;
  padding: 12px;
}

/* File & Media section */
.media-card {
  background: var(--primary-light);
  border: 1px solid #cce7d6;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.media-card p {
  margin: 0 0 8px 0;
  color: var(--primary);
  font-size: 14px;
}
#filePreview {
  margin-top: 12px;
  max-height: 450px;
  overflow: auto;
}
#filePreview img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: block;
}
#fileDownload {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  margin: 8px 0;
}

/* SEO Content */
.seo-card h3 {
  font-size: 15px;
  margin: 18px 0 6px;
  color: #0f172a;
}
.seo-card p {
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
  margin: 0 0 12px;
}
code {
  background: #eef2f6;
  color: #0d7a3f;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

/* Sidebar Cards */
.card h3 {
  margin: 0 0 10px 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.tool-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tool-links li {
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.tool-links li:last-child { border-bottom: none; }
.tool-links a {
  display: flex;
  justify-content: space-between;
  color: #334155;
  font-weight: 500;
}
.tool-links a:hover {
  color: var(--primary);
  text-decoration: none;
}
.tool-links .badge {
  font-size: 10px;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
}

footer {
  background: #094624;
  color: #a7d8be;
  padding: 28px 16px;
  font-size: 13px;
  border-top: 1px solid #07351b;
}
footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
footer a { color: #dcfce7; }
footer a:hover { color: #ffffff; text-decoration: underline; }
footer .footer-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
footer .copyright {
  font-size: 12px;
  color: #7ab895;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .ad-sidebar {
    width: 100%;
    max-width: 300px;
  }
}
