/* DevSyntax Premium Design */
:root {
    /* Colors - Blue & Grey Theme (No Purple) */
    --primary-hue: 210;
    /* Blue */
    --primary-color: hsl(var(--primary-hue), 100%, 50%);
    /* #007bff */
    --primary-dark: hsl(var(--primary-hue), 100%, 40%);
    --primary-light: hsl(var(--primary-hue), 100%, 96%);

    --secondary-color: #2c3e50;
    /* Dark Slate */

    --text-main: #1a1f2c;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;

    --border-subtle: #e2e8f0;
    --border-focus: rgba(0, 123, 255, 0.4);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Header */
header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    color: var(--primary-color);
}

/* Search Bar */
.search-nav form {
    position: relative;
    width: 320px;
    transition: width 0.3s ease;
}

.search-input {
    width: 100%;
    padding: 10px 16px;
    padding-right: 40px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background-color: var(--bg-surface-alt);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--border-focus);
}

.search-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

/* Main Layout */
.main-content {
    display: flex;
    margin-top: 2.5rem;
    gap: 2.5rem;
    min-height: 80vh;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
}

.content-area {
    flex: 1;
    min-width: 0;
    /* Fix flexbox text overflow */
}

/* Sidebar Styling */
.sidebar h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-weight: 700;
}

.cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cat-list li {
    margin-bottom: 4px;
}

.cat-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.cat-list a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    transform: translateX(2px);
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::before {
    opacity: 1;
}

.card h3 {
    margin: 0.75rem 0;
    font-size: 1.15rem;
    line-height: 1.4;
}

.card h3 a {
    color: var(--text-main);
    text-decoration: none;
}

.card h3 a:hover {
    color: var(--primary-color);
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.lang-tag {
    display: inline-block;
    background-color: var(--bg-surface-alt);
    color: var(--secondary-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--border-subtle);
}

/* Snippet View Details */
.snippet-view {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.snippet-header {
    padding: 2.5rem;
    background: linear-gradient(to bottom right, var(--bg-surface), var(--primary-light));
    border-bottom: 1px solid var(--border-subtle);
}

.snippet-header h1 {
    margin: 1rem 0;
    font-size: 2rem;
    letter-spacing: -1px;
    color: var(--secondary-color);
}

.snippet-description {
    padding: 2rem 2.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.7;
    border-bottom: 1px solid var(--border-subtle);
}

.snippet-code {
    padding: 0;
    background-color: #282c34;
    /* Atom One Dark-ish */
    position: relative;
}

.snippet-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.btn:hover {
    background-color: var(--bg-surface-alt);
    border-color: var(--text-light);
    transform: translateY(-1px);
}

pre {
    margin: 0 !important;
    padding: 2.5rem !important;
    border-radius: 0 !important;
    font-family: var(--font-mono) !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
}

/* Helper Headings */
h1,
h2,
h3,
h4 {
    color: var(--secondary-color);
    margin-top: 0;
}

/* Footer */
footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 3rem 0;
    margin-top: 5rem;
    text-align: center;
    color: var(--text-muted);
}

footer a {
    color: var(--text-muted);
    margin: 0 10px;
}

footer a:hover {
    color: var(--primary-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 3rem;
}

.pagination .btn {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .sidebar {
        width: 100%;
        overflow-x: auto;
    }

    .cat-list {
        display: flex;
        gap: 10px;
        padding-bottom: 10px;
    }

    .cat-list li {
        margin: 0;
        flex-shrink: 0;
    }

    .cat-list a {
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
    }
}

@media (max-width: 600px) {
    .nav-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .search-nav form {
        width: 100%;
    }

    .snippet-header {
        padding: 1.5rem;
    }

    .snippet-description {
        padding: 1.5rem;
    }

    pre {
        padding: 1.5rem !important;
    }
}