:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.search-form {
    flex-grow: 1;
    max-width: 400px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1.25rem;
    padding-right: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #f1f5f9;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.logo::before {
    content: '';
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 6px;
    display: inline-block;
}

/* Sidebar & layout improvements */
.main-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    margin-top: 3rem;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 6rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--background);
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-item a:hover {
    background: #f8fafc;
    color: var(--primary);
    transform: translateX(4px);
}

.category-item a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.category-item a::before {
    content: '→';
    margin-right: 0.75rem;
    opacity: 0;
    transition: all 0.2s;
    font-size: 0.8rem;
}

.category-item a:hover::before,
.category-item a.active::before {
    opacity: 1;
}

/* Article Cards */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.article-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f8fafc;
}

.article-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8fafc;
    transition: transform 0.3s;
}

.article-card:hover .article-image {
    transform: scale(1.05);
}

.article-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-cat-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    width: fit-content;
    margin-bottom: 0.75rem;
}

.article-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    line-height: 1.3;
}

.article-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.btn {
    display: inline-block;
    padding: 0.7rem 1.25rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    transition: opacity 0.2s;
    text-align: center;
    font-size: 0.85rem;
}

.btn:hover {
    opacity: 0.9;
}

/* Article Detail */
.article-detail {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 850px;
    margin: 0 auto 4rem;
}

.article-detail h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2rem;
    text-align: center;
}

.detail-img-wrapper {
    width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.detail-img-wrapper img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.article-body {
    font-size: 1.125rem;
    color: #334155;
    line-height: 1.8;
}

.article-body h2 {
    margin: 2.5rem 0 1rem;
    font-size: 1.75rem;
    font-weight: 800;
}

.article-body p {
    margin-bottom: 1.5rem;
}

.affiliate-box {
    margin-top: 4rem;
    padding: 2.5rem;
    background: #eff6ff;
    border-radius: var(--radius);
    border: 1px solid #dbeafe;
    text-align: center;
}

.btn-amazon {
    background: var(--accent);
    color: #92400e;
    font-size: 1.25rem;
    padding: 1rem 3rem;
    font-weight: 700;
}

/* Response for Mobile */
@media (max-width: 900px) {
    .container {
        padding: 0 1.25rem;
    }

    header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .search-form {
        max-width: 100%;
        width: 100%;
        order: 3;
    }

    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 1.5rem;
    }

    .sidebar {
        position: relative;
        top: 0;
        background: transparent;
        padding: 0;
        border: none;
        box-shadow: none;
        margin-bottom: 0.5rem;
        width: 100%;
        overflow: hidden;
    }

    .sidebar-title {
        display: none;
        /* Hide title on mobile to save space */
    }

    .category-list {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 1rem;
        gap: 0.75rem;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
        -ms-overflow-style: none;
        /* Hide scrollbar Edge/IE */
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }

    .category-list::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .category-item {
        flex-shrink: 0;
    }

    .category-item a {
        padding: 0.5rem 1.25rem;
        background: white;
        border: 1px solid var(--border);
        white-space: nowrap;
        font-size: 0.85rem;
        border-radius: 20px;
    }

    .category-item a:hover {
        transform: none;
    }

    .category-item a::before {
        display: none;
    }

    .category-item a.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .article-grid {
        grid-template-columns: 1fr;
    }
}