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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #14141c;
    --bg-card-hover: #1a1a26;
    --border-color: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-bg: rgba(99, 102, 241, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
}

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

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo svg {
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

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

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 0%, #9ca3af 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-container input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.search-container input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

/* Categories */
.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.category-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

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

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

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

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

.tool-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.tool-icon svg {
    width: 20px;
    height: 20px;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

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

.tool-category-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* External link indicator */
.tool-card.external .tool-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.tool-card.external::after {
    content: '';
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.5;
}

.tool-card {
    position: relative;
}

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

.footer p {
    margin: 0.25rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .categories {
        justify-content: center;
    }
    
    .category-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Tool Page Styles */
.tool-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.tool-page-header {
    margin-bottom: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: color 0.2s;
}

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

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

.tool-page .subtitle {
    color: var(--text-secondary);
}

.tool-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.tool-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Form Elements */
.input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Result Box */
.result-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

.result-box:empty::before {
    content: 'Results will appear here...';
    color: var(--text-muted);
}

/* Copy Button */
.copy-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

/* Error/Success states */
.error {
    color: #ef4444;
}

.success {
    color: #22c55e;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
