/* ===== CSS Variables ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Header ===== */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.site-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.site-header .logo .icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.site-header nav {
    display: flex;
    gap: 8px;
}

.site-header nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.site-header nav a:hover {
    background: var(--bg);
    color: var(--primary);
}

.site-header nav a.active {
    background: var(--primary);
    color: white;
}

/* ===== Home Page ===== */
.hero {
    text-align: center;
    padding: 80px 24px 48px;
}

.hero h1 {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.hero p {
    font-size: 18px;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.tool-card .tool-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

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

.tool-card p {
    font-size: 14px;
    color: var(--text-light);
}

/* ===== Tool Page Layout ===== */
.tool-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

.tool-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.tool-page .back-link:hover {
    color: var(--primary);
}

.tool-page h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tool-page .subtitle {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 32px;
}

.tool-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

/* ===== Form Elements ===== */
textarea, input[type="text"], input[type="number"], input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    color: var(--text);
    background: var(--bg);
    transition: var(--transition);
    outline: none;
}

textarea:focus, input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    min-height: 200px;
    resize: vertical;
    line-height: 1.5;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== Result/Output ===== */
.output-box {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 14px;
    word-break: break-all;
    min-height: 48px;
}

.output-box.error {
    border-color: #ef4444;
    color: #dc2626;
    background: #fef2f2;
}

.output-box.success {
    border-color: #10b981;
    color: #059669;
    background: #ecfdf5;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-light);
    font-size: 14px;
    border-top: 1px solid var(--border);
}
.site-footer .icp {
    margin-top: 8px;
    font-size: 13px;
}
.site-footer a {
    color: var(--text-light);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 28px;
    }
    .hero p {
        font-size: 15px;
    }
    .tool-grid {
        grid-template-columns: 1fr;
    }
    .tool-page {
        padding: 24px 16px;
    }
    .tool-content {
        padding: 20px;
    }
    .site-header nav {
        display: none;
    }
}
