/* ============================================================
   KC Product Compare v3.0.0 - Production
   Products page + comparison feature
============================================================ */

/* ============================================================
   PAGE LAYOUT - Top accordion, bottom two-column
============================================================ */
.products-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
    box-sizing: border-box;
}

.products-page * {
    box-sizing: border-box;
}

/* Bottom section: left category + right products */
.products-page .products-bottom {
    display: grid !important;
    grid-template-columns: 280px 1fr;
    gap: 48px;
    align-items: start;
    margin-top: 16px;
    width: 100%;
    clear: both;
    float: none;
}

/* ============================================================
   LEFT SIDEBAR - TWO-LEVEL CATEGORY
============================================================ */
.products-page .products-sidebar {
    position: sticky;
    top: 100px;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

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

.cat-parent {
    margin-bottom: 4px;
}

.cat-parent-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.cat-parent-link:hover {
    background: #f3f4f6;
}

.cat-parent-link.active {
    background: #f0f7fc;
    color: #006CB8;
}

.cat-parent-link .cat-arrow {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    color: #9ca3af;
    font-size: 10px;
}

.cat-parent.expanded .cat-arrow {
    transform: rotate(90deg);
}

.cat-parent-link .cat-count {
    font-size: 11px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.cat-parent-link.active .cat-count {
    background: #e6f2fa;
    color: #006CB8;
}

.cat-children {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 8px;
}

.cat-parent.expanded .cat-children {
    max-height: 500px;
}

.cat-child-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 28px;
    border-radius: 6px;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.cat-child-link::before {
    content: '';
    position: absolute;
    left: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.2s ease;
}

.cat-child-link:hover {
    background: #f9fafb;
    color: #374151;
}

.cat-child-link:hover::before {
    background: #9ca3af;
}

.cat-child-link.active {
    color: #006CB8;
    font-weight: 500;
}

.cat-child-link.active::before {
    background: #006CB8;
}

.cat-child-link .cat-count {
    font-size: 11px;
    color: #9ca3af;
}

.cat-compare-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #006CB8;
    background: #e6f2fa;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
}

/* ============================================================
   RIGHT CONTENT (products main)
============================================================ */
.products-page .products-main {
    min-width: 0;
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.page-header {
    margin-bottom: 48px;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
    margin-bottom: 16px;
}

.page-description {
    font-size: 17px;
    color: #6b7280;
    line-height: 1.7;
    max-width: 720px;
}

.page-description p {
    margin: 0;
}

.content-section {
    margin-bottom: 64px;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #006CB8;
    margin-bottom: 12px;
}

/* ============================================================
   COMPARE BAR WITH SEARCH
============================================================ */
.compare-bar {
    padding: 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 32px;
}

.compare-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.compare-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.compare-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #006CB8;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.compare-toggle:hover {
    background: #005a9e;
}

.compare-toggle.active {
    background: #374151;
}

.compare-series-hint {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compare-series-hint .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #006CB8;
}

.compare-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.compare-search {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.compare-search:focus {
    outline: none;
    border-color: #006CB8;
    box-shadow: 0 0 0 3px rgba(0,108,184,0.1);
}

.compare-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
}

.compare-selected-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.compare-selected-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    flex-shrink: 0;
}

.compare-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #e6f2fa;
    border: 1px solid #7ab8e0;
    border-radius: 14px;
    font-size: 12px;
    color: #006CB8;
    font-weight: 500;
}

.compare-chip .series-tag {
    font-size: 9px;
    text-transform: uppercase;
    background: rgba(0,108,184,0.15);
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.compare-chip .remove {
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #006CB8;
    color: white;
    font-size: 11px;
    line-height: 1;
}

.compare-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.compare-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: #006CB8;
    color: white;
    font-family: inherit;
    transition: all 0.2s ease;
}

.compare-btn:hover:not(:disabled) {
    background: #005a9e;
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9ca3af;
}

.clear-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    font-family: inherit;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* ============================================================
   PRODUCT GRID
============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.product-card {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    border-color: #d1d5db;
}

body.compare-active .product-card.compareable:has(.product-check:checked) {
    box-shadow: 0 0 0 2px #006CB8;
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 2px 6px;
    background: #006CB8;
    backdrop-filter: blur(4px);
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
}

.product-compareable-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    padding: 2px 5px;
    background: rgba(0,108,184,0.9);
    color: white;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.product-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.3;
}

.product-title a {
    color: inherit;
    text-decoration: none;
}

.product-title a:hover {
    color: #006CB8;
}

.product-desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-compare-wrap {
    display: none;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

body.compare-active .product-card.compareable .product-compare-wrap {
    display: block;
}

.product-compare-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 11px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.product-compare-label:hover {
    border-color: #006CB8;
    color: #006CB8;
    background: #f0f7fc;
}

.product-compare-label input {
    display: none;
}

.product-checkmark {
    width: 14px;
    height: 14px;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.product-compare-label input:checked + .product-checkmark {
    background: #006CB8;
    border-color: #006CB8;
}

.product-compare-label input:checked + .product-checkmark::after {
    content: '';
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.product-compare-label input:checked ~ span {
    color: #006CB8;
    font-weight: 600;
}

.product-no-compare {
    display: none;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    font-size: 10px;
    color: #9ca3af;
    font-style: italic;
}

body.compare-active .product-card:not(.compareable) .product-no-compare {
    display: block;
}

/* ============================================================
   KCONBOT FEATURE ACCORDION
============================================================ */
#kconbot-feature-section {
    width: 100%;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

#kconbot-feature-section .kconbot-layout {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 10px;
    align-items: stretch;
}

#kconbot-feature-section .kconbot-left {
    width: 100%;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

#kconbot-feature-section .kconbot-item {
    width: 100%;
    margin: 0;
    padding: 24px 0;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    background: transparent;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
}

#kconbot-feature-section .kconbot-item:last-child {
    border-bottom: 0;
}

#kconbot-feature-section .kconbot-item-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

#kconbot-feature-section .kconbot-item h3 {
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
    color: #6b7280;
    transition: color .3s ease;
}

#kconbot-feature-section .kconbot-item.active h3 {
    color: #111827;
}

#kconbot-feature-section .kconbot-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: #f0f7fc;
    color: #006CB8;
    margin-right: 12px;
    vertical-align: middle;
    transition: all .3s ease;
}

#kconbot-feature-section .kconbot-feature-icon svg {
    width: 18px;
    height: 18px;
}

#kconbot-feature-section .kconbot-item.active .kconbot-feature-icon {
    background: #006CB8;
    color: white;
}

#kconbot-feature-section .kconbot-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    color: #6b7280;
    transition: transform .35s ease, color .35s ease, border-color .35s ease;
}

#kconbot-feature-section .kconbot-icon svg {
    width: 16px;
    height: 16px;
}

#kconbot-feature-section .kconbot-item.active .kconbot-icon {
    color: #111827;
    border-color: #111827;
    transform: rotate(90deg);
}

#kconbot-feature-section .kconbot-content {
    max-width: 620px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .5s ease, opacity .4s ease, margin-top .4s ease;
}

#kconbot-feature-section .kconbot-content p {
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.8;
    font-weight: 400;
    color: #6b7280;
}

#kconbot-feature-section .kconbot-item.active .kconbot-content {
    max-height: 300px;
    margin-top: 16px;
    opacity: 1;
}

#kconbot-feature-section .kconbot-right {
    width: 100%;
    min-width: 0;
}

#kconbot-feature-section .kconbot-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    overflow: hidden;
    border-radius: 12px;
    background: #f3f4f6;
}

#kconbot-feature-section .kconbot-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(1.025);
    transition: opacity .6s ease, transform .8s cubic-bezier(.22,.61,.36,1);
    pointer-events: none;
}

#kconbot-feature-section .kconbot-image.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    z-index: 2;
}

#kconbot-feature-section .kconbot-real-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================================
   COMPARE MODAL
============================================================ */
.compare-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.compare-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-series-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #006CB8;
    background: #e6f2fa;
    padding: 3px 8px;
    border-radius: 4px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #ef4444;
    color: white;
    transform: rotate(90deg);
}

.modal-add-bar {
    padding: 16px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-add-bar label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.modal-select {
    padding: 10px 36px 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    appearance: none;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 14px center;
    min-width: 260px;
    font-family: inherit;
}

.modal-selected-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.modal-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.compare-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.compare-table th {
    background: white;
    padding: 16px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
}

.compare-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    text-align: left;
    min-width: 200px;
    width: 200px;
    background: white;
}

.compare-table .cat-row td {
    background: #f0f7fc;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 13px;
    color: #006CB8;
    border-bottom: 1px solid #e5e7eb;
}

.compare-table .cat-row td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #f0f7fc;
}

.compare-table td {
    padding: 12px 20px;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    text-align: center;
    background: white;
}

.compare-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background: white;
    text-align: left;
    font-weight: 500;
    color: #6b7280;
    min-width: 200px;
    width: 200px;
}

.compare-table .val-check {
    color: #006CB8;
    font-weight: 600;
    font-size: 18px;
}

.compare-table .val-cross {
    color: #d1d5db;
}

.compare-table .val-optional {
    color: #f59e0b;
    font-size: 13px;
}

.modal-empty {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}

.modal-empty h3 {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 8px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.modal-footer-info {
    font-size: 14px;
    color: #6b7280;
}

.modal-footer-info strong {
    color: #006CB8;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1400px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .products-page .products-bottom {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .products-page .products-sidebar {
        position: static;
    }
    .category-tree {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    .cat-parent {
        margin-bottom: 0;
    }
    .cat-children {
        display: none;
    }
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    #kconbot-feature-section .kconbot-layout {
        grid-template-columns: 1fr;
    }
    #kconbot-feature-section .kconbot-image-wrapper {
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .products-page {
        padding: 24px 16px;
    }
    .page-title {
        font-size: 28px;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .product-info {
        padding: 8px;
    }
    .product-title {
        font-size: 12px;
    }
    .product-desc {
        font-size: 10px;
    }
    .compare-bar-top {
        flex-direction: column;
        align-items: stretch;
    }
    .compare-search-wrap {
        max-width: none;
    }
    .compare-selected-row {
        flex-direction: column;
        align-items: stretch;
    }
    .compare-actions {
        justify-content: flex-end;
    }
    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}
