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

:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent: #4a90d9;
    --accent-hover: #357abd;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

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

.logo-icon {
    font-size: 1.5rem;
}

.search-form {
    flex: 1;
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.search-btn {
    padding: 0.625rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
}

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

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.main {
    flex: 1;
    padding: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

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

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

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

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border-left: 4px solid var(--card-color, var(--accent));
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.category-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.category-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.tool-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
}

.tools-section {
    margin-top: 3rem;
}

.tools-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.tool-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    padding-top: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tool-card h3 {
    font-size: 1.125rem;
    margin: 0;
}

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

.badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    width: fit-content;
}

.badge.local {
    background: #dcfce7;
    color: #166534;
}

.badge.external {
    background: #dbeafe;
    color: #1e40af;
}

.category-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-secondary);
}

.category-header {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--category-color, var(--accent));
}

.category-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-header p {
    color: var(--text-secondary);
}

.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-container h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-block;
    width: fit-content;
}

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

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

.search-results {
    margin-bottom: 1.5rem;
}

.search-results h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.search-results p {
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state .btn {
    margin-top: 1rem;
}

.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-form {
        order: 3;
        max-width: 100%;
        width: 100%;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .categories-grid,
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

.subcategories-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.subcat-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.subcat-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.subcat-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tool-card-wrapper {
    position: relative;
    min-height: 120px;
    box-sizing: border-box;
}

.bookmark-star {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 100;
    font-size: 1.4rem;
    line-height: 1;
}

.bookmark-star a {
    text-decoration: none;
    opacity: 1 !important;
    color: #f59e0b !important;
}

.bookmark-star a:hover {
    color: #d97706 !important;
}

.bookmark-form {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
}

.bookmark-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s;
    padding: 0.25rem 0.4rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bookmark-btn:hover {
    background: #fff;
    transform: scale(1.1);
}
