/* DevToolKit — Main Stylesheet */
:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --border: #30363d;
  --radius: 8px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --max-width: 960px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* === HEADER === */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--bg);
  font-weight: 900;
}

nav { display: flex; gap: 0.25rem; }

nav a {
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
}

nav a:hover, nav a.active {
  color: var(--text);
  background: var(--bg-tertiary);
  text-decoration: none;
}

/* === MAIN CONTENT === */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
  flex: 1;
}

/* === HERO (homepage) === */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* === TOOL GRID === */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.1);
  text-decoration: none;
}

.tool-card .icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.tool-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.tool-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* === TOOL PAGE LAYOUT === */
.tool-header {
  margin-bottom: 1.5rem;
}

.tool-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.tool-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group, .output-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

textarea, .output-area {
  width: 100%;
  min-height: 140px;
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.output-area {
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 140px;
  color: var(--green);
}

/* === BUTTONS === */
.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-success { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 600; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* === STATUS BAR === */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.status-bar .valid { color: var(--green); }
.status-bar .invalid { color: var(--red); }

/* === SECTIONS === */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.info-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  line-height: 1.7;
}

.info-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.info-section p, .info-section li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.info-section ul { padding-left: 1.25rem; }
.info-section code {
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* === FOOTER === */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
}

.footer-copy {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* === AD PLACEHOLDER === */
.ad-container {
  margin: 2rem 0;
  min-height: 0;
  display: none;
  /* Hidden until ad provider is configured. Set display:flex + min-height:90px when ready. */
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 0; }
  nav { flex-wrap: wrap; }
}

/* === CHEATSHEET TABLES === */
.cheat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.cheat-table th {
  background: var(--bg-tertiary);
  padding: 0.625rem 1rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}

.cheat-table td {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.cheat-table td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
}

.cheat-table tr:hover td {
  background: var(--bg-tertiary);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--green);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Regex-specific */
.regex-match-highlight { background: rgba(63, 185, 80, 0.25); border-radius: 2px; }
.regex-error { color: var(--red); font-size: 0.8125rem; margin-top: 0.5rem; }

/* Hash output grid */
.hash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.hash-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.hash-item .algo-name {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.hash-item .hash-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--green);
  word-break: break-all;
}
