/* UtilShed — Global Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-hover: #1a1a1a;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-muted: #888;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --radius: 12px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1rem 0 3rem;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.tool-card:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tool-icon {
    display: inline-block;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: var(--bg);
    border-radius: 10px;
}

.tool-card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tool Page Layout */
.tool-header {
    padding: 1.5rem 0;
}

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

.tool-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.tool-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .tool-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.75rem; }
}

.tool-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 600;
}

.panel-header .label {
    color: var(--text-muted);
    font-weight: 400;
}

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

textarea.tool-output {
    color: var(--green);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

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

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

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

.btn-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Single-panel tools */
.tool-single {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.tool-single input[type="text"],
.tool-single input[type="number"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.875rem;
    outline: none;
}

.tool-single input:focus {
    border-color: var(--accent);
}

.result-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.875rem;
    font-family: var(--mono);
    font-size: 0.875rem;
    word-break: break-all;
    min-height: 2.5rem;
    color: var(--green);
    margin-top: 0.75rem;
    cursor: pointer;
    position: relative;
}

.result-box:hover::after {
    content: 'Click to copy';
    position: absolute;
    top: -1.75rem;
    right: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Status messages */
.status {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
}

.status-ok { color: var(--green); }
.status-err { color: var(--red); }

/* Color preview */
.color-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 0.75rem 0;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

/* Diff styles */
.diff-add { background: rgba(34,197,94,0.15); color: var(--green); }
.diff-remove { background: rgba(239,68,68,0.15); color: var(--red); }
.diff-line { padding: 2px 8px; font-family: var(--mono); font-size: 0.8125rem; white-space: pre-wrap; }

/* Related Tools Section */
.related-tools {
    max-width: 900px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
}

.related-tools h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.related-tool-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
}

.related-tool-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.related-tool-card strong {
    font-size: 0.95rem;
}

.related-tool-card span {
    font-size: 0.8rem;
    color: var(--text-muted);
}
