@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Inter:wght@400;500&display=swap');

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    /* Offset for sticky header */
}

:root {
    --primary-red: #ED1C24;
    --primary-red-hover: #C9181E;
    --bg-white: #FFFFFF;
    --bg-light: #F9FAFB;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.brand {
    font-family: 'Outfit', sans-serif;
}

/* --- Header & Navigation --- */
header {
    background: var(--bg-white);
    padding: 1rem 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary-red), #F87171);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand span {
    -webkit-text-fill-color: var(--text-dark);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        font-size: 0.9rem;
        gap: 0.5rem;
    }
}

/* --- Dropdown System --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 240px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    display: none;
    z-index: 1100;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
}

.dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
    border-radius: 8px;
}

.dropdown-menu a:hover {
    background: #FFF0F0;
    color: var(--primary-red);
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(135deg, var(--bg-white) 0%, #FFF5F5 100%);
    padding: 3rem 5% 2.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.hero h1 span {
    color: var(--primary-red);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

@media (max-width: 768px) {
    .hero {
        padding: 2rem 5% 1.5rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }
}


/* --- Search Bar --- */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 1rem 4rem 1rem 3.5rem;
    /* Added right padding for enter icon */
    border-radius: 50px;
    border: 2px solid var(--border-color);
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.search-enter-icon {
    position: absolute;
    right: 1.5rem;
    background: #F3F4F6;
    padding: 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    pointer-events: none;
    transition: var(--transition);
}

.search-input:focus~.search-enter-icon {
    border-color: var(--primary-red);
    color: var(--primary-red);
    background: #FFF0F0;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 4px rgba(237, 28, 36, 0.1);
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* --- Category Tabs --- */
/* --- Category Grouping --- */
.filter-container {
    background: var(--bg-white);
    padding: 1.25rem 5% 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-grid {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.all-group {
    flex-shrink: 0;
}


.filter-group {
    margin-bottom: 0;
}

.filter-group-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #F3F4F6;
}

.filter-group-header h3 {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.filter-group-header i {
    font-size: 0.75rem;
    color: var(--primary-red);
    background: #FFF0F0;
    padding: 0.35rem;
    border-radius: 6px;
}

.categories-nav {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}


@media (max-width: 768px) {
    .filter-container {
        padding: 1rem 0;
        overflow-x: hidden;
    }

    .filter-grid {
        display: flex;
        flex-direction: row;
        /* Force single row for ALL clusters */
        overflow-x: auto;
        padding: 0 1rem 1rem;
        gap: 1.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filter-grid::-webkit-scrollbar {
        display: none;
    }

    .filter-group {
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
    }

    .filter-group-header {
        padding: 0 0 0.5rem 0.25rem;
        margin-bottom: 0.5rem;
        white-space: nowrap;
    }

    .categories-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .cat-chip {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.4rem 0.9rem;
        font-size: 0.75rem;
    }
}




.cat-chip {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}



.cat-chip i {
    font-size: 0.9rem;
    opacity: 0.8;
}

.cat-chip.active i {
    opacity: 1;
}

.cat-chip:hover,
.cat-chip.active {
    background: var(--primary-red);
    color: white;
    border-color: var(--primary-red);
}

/* --- Content Grid --- */
.main-content {
    padding: 3rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-white);
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.card-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #FFF0F0;
    color: var(--primary-red);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Detail Page Layout --- */
.detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 5%;
    align-items: start;
    justify-content: start;
}

.sidebar {
    grid-column: 1;
    position: sticky;
    top: 100px;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 10px;
}

.toc-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 0.75rem;
}

.toc-list a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    display: block;
}

.toc-list a:hover {
    color: var(--primary-red);
    transform: translateX(5px);
}

.detail-main {
    grid-column: 2;
    width: 100%;
}

/* Responsive adjustment for Sidebar */
/* Mobile TOC Drawer Logic */
.toc-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 1.5rem;
    z-index: 1000;
    background: var(--primary-red);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    border: none;
    font-size: 1.2rem;
}

@media (max-width: 1100px) {
    .detail-layout {
        display: block;
        padding: 0 1rem;
        margin: 1rem auto;
        width: 100vw;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .detail-main {
        width: 100%;
        max-width: 100%;
        padding: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .toc-toggle {
        display: flex;
    }

    .sidebar {
        grid-column: auto;
        position: fixed;
        top: 0;
        left: -280px;
        /* Hidden by default */
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1001;
        border-radius: 0;
        transition: transform 0.3s ease;
        overflow-y: auto;
        border-right: 1px solid var(--border-color);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(280px);
        /* Slide in */
    }

    /* Reduce font sizes for mobile */
    .detail-main h1 {
        font-size: 1.85rem !important;
        line-height: 1.2 !important;
    }

    .rank-title {
        font-size: 1.4rem !important;
    }

    .rank-desc {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    .rank-item {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }

    .spec-grid {
        grid-template-columns: 1fr 1fr;
        /* 2 columns on mobile */
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .spec-value {
        font-size: 0.9rem;
    }

    /* Reset detail-main for mobile */
    .detail-main {
        grid-column: auto;
    }

    /* Overlay when sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

.rank-item {
    background: var(--bg-white);
    border-radius: 20px;
    padding: 1.5rem;
    /* Reduced from 2.5rem */
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.rank-number {
    position: absolute;
    top: -20px;
    left: 20px;
    background: var(--primary-red);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(237, 28, 36, 0.3);
}

.rank-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .rank-header {
        flex-direction: column;
        gap: 1rem;
    }
}

.rank-img {
    width: 350px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .rank-img {
        width: 100%;
        height: auto;
        /* Change to auto to avoid stretching/overflow issues */
        aspect-ratio: 4 / 3;
        margin-bottom: 1rem;
    }

    .spec-grid {
        grid-template-columns: 1fr;
        /* Single column on very small screens if needed, but 1:1 works too */
    }
}

.rank-info {
    flex: 1;
}

.rank-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.rank-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.btn-visit {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: var(--primary-red);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-visit:hover {
    background: var(--primary-red-hover);
    transform: scale(1.02);
}

.rank-desc {
    font-size: 1.05rem;
    color: #4B5563;
    line-height: 1.7;
    margin-top: 1.5rem;
}

/* --- Product Specs Grid --- */
.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    background: #F9FAFB;
    padding: 1rem;
    border-radius: 12px;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.spec-item {
    display: flex;
    flex-direction: column;
}

.spec-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.spec-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.spec-value.price {
    color: var(--primary-red);
    font-size: 1.1rem;
}

.spec-value.price small {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    vertical-align: baseline;
}

.feature-list {
    margin-top: 1rem;
    list-style: none;
}

.feature-list li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.95rem;
}

.feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10B981;
    font-weight: bold;
}

/* --- Footer --- */
footer {
    background: var(--text-dark);
    color: white;
    padding: 4rem 5%;
    text-align: center;
}

.footer-logo {
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
}

.footer-logo span {
    color: var(--primary-red);
}