/* ==================== New E-commerce Layout (Sidebar + Grid) ==================== */
.layout-container {
    display: flex;
    gap: 2rem;
    padding: 2rem 0;
    max-width: 1400px;
    /* Biraz daha geniş, ürünler ferah görünsün */
    margin: 0 auto;
}

/* Sidebar Styles */
.sidebar {
    width: 290px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    animation: sidebarSlideIn 0.5s ease-out;
}

@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Sidebar Search */
.sidebar-search {
    margin-bottom: 1rem;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.5rem;
    border: 2px solid var(--gray-200);
    background-color: white;
    color: var(--gray-800);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sidebar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 111, 175, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    outline: none;
}

.search-icon-sidebar {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

/* Vertical Category Tree */
.category-tree-container {
    background: linear-gradient(135deg, #ffffff 0%, #f0f7fc 100%);
    border-radius: 16px;
    padding: 1.25rem;
    border: 2px solid rgba(13, 111, 175, 0.12);
    box-shadow: 0 4px 16px rgba(13, 111, 175, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.category-tree-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary, #0891B2));
    border-radius: 16px 16px 0 0;
}

.sidebar-header {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--gray-900) !important;
    padding-bottom: 0.85rem !important;
    border-bottom: 2px solid rgba(13, 111, 175, 0.1) !important;
    margin-bottom: 0.75rem !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-item {
    margin-bottom: 3px;
    position: relative;
}

/* Main Category Link */
.tree-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.85rem;
    color: var(--gray-700);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.tree-link:hover {
    background-color: rgba(13, 111, 175, 0.06);
    color: var(--primary);
    padding-left: 1.1rem;
}

/* Active State (Open Accordion) */
.tree-item.active>.tree-link {
    background-color: white;
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
    box-shadow: 0 2px 8px rgba(13, 111, 175, 0.1);
}

.tree-item.active>.tree-link.selected {
    background: linear-gradient(135deg, #E6F4FB 0%, #d4edfc 100%);
    color: var(--primary);
    border-left-color: var(--primary);
    box-shadow: 0 2px 8px rgba(13, 111, 175, 0.12);
    font-weight: 800;
}

.tree-link.selected {
    background: linear-gradient(135deg, #E6F4FB 0%, #d4edfc 100%);
    color: var(--primary);
    border-left-color: var(--primary);
    box-shadow: 0 2px 8px rgba(13, 111, 175, 0.12);
    font-weight: 800;
}

/* Sub-categories (Accordion Body) */
.tree-children {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
    background-color: transparent;
}

.tree-item.active>.tree-children {
    max-height: 2000px;
    opacity: 1;
    margin-top: 0.25rem;
    padding-bottom: 0.5rem;
}

/* Sub-category Links */
.tree-children .tree-item {
    margin: 0;
}

.tree-children .tree-link {
    padding: 0.55rem 0.85rem 0.55rem 1.75rem;
    font-size: 0.88rem;
    color: var(--gray-600);
    border-left: 3px solid transparent;
    font-weight: 400;
}

.tree-children .tree-link:hover {
    color: var(--primary);
    background-color: rgba(13, 111, 175, 0.04);
    padding-left: 1.75rem;
}

.tree-children .tree-link.selected {
    color: var(--primary);
    font-weight: 700;
    background: linear-gradient(135deg, #E6F4FB 0%, #d4edfc 100%);
    border-left: 3px solid var(--primary);
}

/* Counts */
.category-count {
    font-size: 0.7rem;
    color: var(--gray-500);
    background: rgba(13, 111, 175, 0.08);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: auto;
    font-weight: 600;
    transition: all 0.25s ease;
    min-width: 24px;
    text-align: center;
}

.tree-link:hover .category-count,
.tree-link.selected .category-count,
.tree-item.active>.tree-link .category-count {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(13, 111, 175, 0.3);
}

/* Arrow Icon */
.tree-icon {
    margin-right: 8px;
    transition: transform 0.3s ease;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.tree-item.active>.tree-link .tree-icon {
    transform: rotate(90deg);
    color: var(--primary);
}

/* Main Content Styles */
.main-content {
    flex: 1;
}

.results-info {
    margin-bottom: 1.5rem;
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* New Product Card Design */
.product-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.product-card-new {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    cursor: pointer;
    /* Clickable */
}

.product-card-new:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px);
    border-color: var(--primary-light);
}

.product-image-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.product-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.5s;
}

.product-card-new:hover .product-image-container img {
    transform: scale(1.1);
}

.product-info-new {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-code-new {
    color: var(--gray-500);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-title-new {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.btn-inspect {
    background-color: #f59e0b;
    /* Görseldeki gibi sarı/turuncu tonu */
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    /* Yuvarlak buton */
    font-weight: 600;
    text-transform: capitalize;
    transition: all 0.2s;
    display: inline-block;
    margin-top: auto;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.btn-inspect:hover {
    background-color: var(--primary);
    /* Hover olunca site ana rengine dön */
    box-shadow: 0 4px 10px rgba(13, 111, 175, 0.4);
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .layout-container {
        flex-direction: column;
        padding: 1rem;
    }

    .sidebar {
        width: 100%;
        position: static;
        max-height: none;
        animation: none;
        margin-top: 0 !important;
    }

    .category-tree-container {
        padding: 1rem;
    }

    /* Mobile Accordion Logic */
    .category-tree-container .category-list {
        display: none;
        padding-top: 0.5rem;
    }

    .category-tree-container.active .category-list {
        display: block;
        animation: fadeInDown 0.3s ease-out;
    }

    .sidebar-toggle-icon {
        display: flex !important;
        transform: rotate(0deg);
        transition: transform 0.3s ease;
    }

    .category-tree-container.active .sidebar-toggle-icon {
        transform: rotate(180deg) !important;
    }

    /* Titles Above Categories on Mobile */
    #products-page-header {
        margin-top: 0.5rem !important;
        padding: 0 1rem;
        margin-bottom: 1rem !important;
    }

    #products-page-header .section-title {
        font-size: 1.6rem !important;
        line-height: 1.2 !important;
    }

    #products-page-header .section-subtitle {
        font-size: 0.85rem !important;
        color: var(--gray-600) !important;
    }

    .sidebar-search {
        margin-bottom: 0.75rem !important;
    }
}

/* Base styles for sidebar toggle icon visibility */
.sidebar-toggle-icon {
    display: none;
    /* Hidden on desktop by default */
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}