/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #242835;
    --border: #2a2e3a;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --accent: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 12px;
    --max-width: 1200px;
}

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

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 4rem 2rem 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

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

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

.search-box input {
    width: 100%;
    max-width: 500px;
    padding: 0.85rem 1.25rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--primary); }
.search-box input::placeholder { color: var(--text-muted); }

/* ===== TOOLS CONTAINER ===== */
.tools-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
}

.tools-container section { margin-bottom: 3rem; }
.tools-container h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* ===== TOOL CARD ===== */
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tool-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}
.tool-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.tool-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.tool-card button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
}
.tool-card button:hover { background: var(--primary-hover); }
.tool-card .tool-link {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
    text-decoration: none;
}
.tool-card .tool-link:hover { background: var(--primary-hover); }

.tool-card.hidden { display: none; }

/* ===== AD SLOTS ===== */
.ad-slot {
    max-width: var(--max-width);
    margin: 1rem auto;
    padding: 0 2rem;
}
.ad-placeholder {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.3rem; }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}
.close-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ===== TOOL UI ELEMENTS ===== */
.tool-area textarea, .tool-area input[type="text"], .tool-area select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
}
.tool-area textarea:focus, .tool-area input[type="text"]:focus {
    border-color: var(--primary);
}

.tool-area label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.tool-area .row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.tool-area .row > * { flex: 1; }

.tool-area .btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.tool-area .btn:hover { background: var(--primary-hover); }
.tool-area .btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}
.tool-area .btn-secondary:hover { background: var(--border); }

.tool-area .output-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 60px;
    margin-top: 0.5rem;
}

.tool-area .stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.tool-area .stat {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    text-align: center;
}
.tool-area .stat .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}
.tool-area .stat .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tool-area .btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

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

.tool-area .checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.75rem 0;
}
.tool-area .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: normal;
    cursor: pointer;
}

.tool-area .slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
}
.tool-area .slider-group input[type="range"] { flex: 1; }
.tool-area .slider-group .val {
    font-weight: 700;
    min-width: 3ch;
    text-align: center;
    color: var(--primary);
}

.tool-area .copy-btn {
    background: var(--surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.tool-area .copy-btn:hover { color: var(--text); border-color: var(--primary); }

.diff-add { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.diff-del { background: rgba(248, 113, 113, 0.15); color: var(--danger); text-decoration: line-through; }

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
footer a { color: var(--primary); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.75rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .tool-area .row { flex-direction: column; }
    .nav-links { display: none; }
    .modal-content { padding: 1.25rem; }
}
