/* ============================================================
   LGD Compare - Frontend Styles
   ============================================================ */

/* ---------- Compare Icon Button ---------- */
.compare-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid #d5d5d5;
    background: #fff;
    color: #666;
    cursor: pointer;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    transition: all .2s ease;
    margin: 4px 2px;
    padding: 0;
}
.compare-btn i { pointer-events: none; }

.compare-btn.not-compare {
    border-color: #d5d5d5;
    background: #fff;
    color: #666;
}
.compare-btn.not-compare:hover {
    border-color: #0071a1;
    background: #f0f0f0;
    color: #0071a1;
}
.compare-btn.added-compare {
    border-color: #6a2c91;
    background: #f5f0ff;
    color: #6a2c91;
}
.compare-btn.added-compare:hover {
    border-color: #6a2c91;
    background: #e9e1ff;
}


/* ---------- Compare View Button (text + count) ---------- */
.compare-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 2px solid #0071a1;
    background: #0071a1;
    color: #fff;
    cursor: pointer;
    border-radius: 26px;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s ease;
}
.compare-view-btn:hover {
    background: #005a87;
    border-color: #005a87;
}
.compare-view-btn .compare-count-number {
    background: #fff;
    color: #0071a1;
    min-width: 24px;
    padding: 2px 8px;
    border-radius: 12px;
}

/* ---------- Compare View Modal ---------- */
.compare-view-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}
.compare-view-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .55);
}
.compare-view-modal-content {
    position: relative;
    width: 92%;
    max-width: 960px;
    max-height: 85vh;
    margin: 4vh auto;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 44px rgba(0, 0, 0, .25);
}
.compare-view-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 22px;
    border: none;
    background: none;
    cursor: pointer;
    color: #666;
    z-index: 10;
    line-height: 1;
}
.compare-view-modal-close i { pointer-events: none; }
.compare-view-modal-close:hover { color: #c00; transform: rotate(90deg); }

.compare-view-modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.compare-view-modal-header h3 { margin: 0; font-size: 18px; }
.compare-view-count {
    background: #0071a1;
    color: #fff;
    border-radius: 14px;
    padding: 2px 10px;
    font-weight: 700;
}
.compare-view-toggle { display: flex; gap: 6px; }
.compare-view-toggle button {
    width: 38px;
    height: 38px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.compare-view-toggle button.active {
    background: #0071a1;
    color: #fff;
    border-color: #0071a1;
}

.compare-view-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.compare-view-modal-body.mode-grid .compare-view-grid { display: grid; }
.compare-view-modal-body.mode-grid .compare-view-list { display: none; }
.compare-view-modal-body.mode-list .compare-view-grid { display: none; }
.compare-view-modal-body.mode-list .compare-view-list { display: block; }

/* Grid view items */
.compare-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.compare-view-item {
    border: 1px solid #e0e0e0;
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    position: relative;
}
.compare-view-item .compare-view-remove {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    font-size: 16px;
    line-height: 1;
}
.compare-view-item .compare-view-remove i { pointer-events: none; }
.compare-view-item .compare-view-remove:hover i {
    color: #c00;
    transform: rotate(180deg);
    transition: transform .3s ease;
}
.compare-view-item img { max-width: 100%; height: auto; margin-bottom: 8px; display: block; margin-left: auto; margin-right: auto; }
.compare-view-item-title { font-weight: 600; margin-bottom: 6px; }
.compare-view-item-price { color: #0071a1; font-weight: 600; margin-bottom: 10px; }
.compare-view-item-actions { display: flex; gap: 8px; justify-content: center; }

/* List view items */
.compare-view-list-item {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}
.compare-view-list-item .compare-view-remove {
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    font-size: 18px;
}
.compare-view-list-item .compare-view-remove i { pointer-events: none; }
.compare-view-list-item .compare-view-remove:hover i {
    color: #c00;
    transform: rotate(180deg);
    transition: transform .3s ease;
}
.compare-view-list-image { flex: 0 0 80px; }
.compare-view-list-image img { max-width: 100%; height: auto; }
.compare-view-list-info { flex: 1; }
.compare-view-list-title { font-weight: 600; }
.compare-view-list-price { color: #0071a1; font-weight: 600; }
.compare-view-list-actions { display: flex; gap: 8px; margin-top: 6px; }

.compare-view-modal-footer {
    padding: 14px 22px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}
.compare-view-full-link { display: inline-block; }

/* ---------- Added / Removed message modals ---------- */
.compare-message-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999998;
    pointer-events: none;
}
.compare-message-content {
    background: #fff;
    border: 2px solid #2e7d32;
    border-radius: 14px;
    padding: 22px 34px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    font-weight: 700;
    font-size: 17px;
}
.compare-message-content i { font-size: 34px; display: block; margin-bottom: 8px; }
.compare-message-content.added i { color: #2e7d32; }
.compare-message-content.removed { border-color: #c62828; }
.compare-message-content.removed i { color: #c62828; }

/* ---------- Compare Page: static panel + carousel ---------- */
.lgd-compare-page-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 0;
}
.lgd-compare-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.lgd-compare-page-title { margin: 0; font-size: 22px; }
.lgd-compare-empty-state {
    text-align: center;
    padding: 50px;
    background: #f9f9f9;
    border-radius: 8px;
}
.lgd-compare-empty-state i { font-size: 40px; color: #bbb; display: block; margin-bottom: 12px; }

.lgd-compare-area {
    display: flex;
    gap: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

/* 300px static data panel */
.lgd-compare-static-panel {
    flex: 0 0 300px;
    background: #f5f6f8;
    border-right: 1px solid #e0e0e0;
}
.lgd-compare-panel-head {
    padding: 14px 16px;
    font-weight: 700;
    background: #0071a1;
    color: #fff;
    text-align: center;
}
.lgd-compare-panel-row {
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
}
.lgd-compare-panel-row-image { min-height: 150px; }
.lgd-compare-panel-row-title { min-height: 44px; }
.lgd-compare-panel-row-price { min-height: 44px; }
.lgd-compare-panel-row-view { min-height: 44px; }

/* Compare items container */
.lgd-compare-items-container {
    flex: 1;
    min-width: 0;
    position: relative;
}
.lgd-compare-swiper {
    width: 100%;
    height: 100%;
}
.lgd-compare-item {
    background: #fff;
    border-right: 1px solid #e0e0e0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.lgd-compare-item-remove {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    font-size: 15px;
}
.lgd-compare-item-remove i { pointer-events: none; }
.lgd-compare-item-remove:hover i {
    color: #c00;
    transform: rotate(180deg);
    transition: transform .3s ease;
}

.lgd-compare-item-cell {
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
}
.lgd-compare-item-cell-image { min-height: 150px; }
.lgd-compare-item-cell-image img { max-width: 100%; height: auto; }
.lgd-compare-item-cell-title { min-height: 44px; }
.lgd-compare-item-cell-price { min-height: 44px; font-weight: 700; }
.lgd-compare-item-cell-view { min-height: 44px; }
.lgd-compare-item-cell-view .button { padding: 6px 12px; font-size: 13px; }

/* Swiper navigation */
.lgd-compare-swiper .swiper-button-prev,
.lgd-compare-swiper .swiper-button-next {
    color: #0071a1;
}
.lgd-compare-swiper .swiper-pagination {
    position: static;
    margin-top: 10px;
    text-align: center;
}

/* ---------- Charts section ---------- */
.lgd-compare-charts-section {
    margin-top: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}
.lgd-compare-charts-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.lgd-compare-charts-head h3 { margin: 0; }
.lgd-compare-chart-type-toggle { display: flex; gap: 8px; }
.lgd-compare-chart-type-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}
.lgd-compare-chart-type-btn.active {
    border-color: #0071a1;
    background: #0071a1;
    color: #fff;
}
.lgd-compare-chart-wrapper { background: #fff; border-radius: 8px; }

/* ---------- Matching products table ---------- */
.lgd-compare-matching-section {
    margin-top: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}
.lgd-compare-matching-title { margin: 0 0 14px; }
.lgd-compare-matching-scroll { overflow-x: auto; }
.lgd-compare-matching-table {
    width: 100%;
    border-collapse: collapse;
}
.lgd-compare-matching-table th,
.lgd-compare-matching-table td {
    border: 1px solid #e0e0e0;
    padding: 10px 12px;
    text-align: left;
}
.lgd-compare-matching-table th { background: #f5f6f8; }
.lgd-compare-matching-image img { max-width: 60px; height: auto; }

/* ---------- Single product wrapper ---------- */
.lgd-compare-single-wrapper { margin-top: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
    .lgd-compare-static-panel { flex: 0 0 260px; }
}
@media (max-width: 991px) {
    .lgd-compare-static-panel { flex: 0 0 200px; }
    .lgd-compare-item-cell-image { min-height: 110px; }
}
@media (max-width: 767px) {
    .lgd-compare-area { flex-direction: column; }
    .lgd-compare-static-panel {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    .lgd-compare-items-container { width: 100%; }
    .compare-view-modal-content { width: 95%; margin: 3vh auto; }
    .compare-view-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .lgd-compare-matching-table th, .lgd-compare-matching-table td { font-size: 13px; }
}
@media (max-width: 480px) {
    .lgd-compare-page-header { flex-direction: column; gap: 10px; }
    .compare-view-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}