/**
 * CPG Product Compare Styles
 */

/* ==========================================================================
   Compare Icon (on product cards)
   ========================================================================== */

.cpg-compare-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
    padding: 0;
}

.cpg-compare-icon svg {
    width: 18px;
    height: 18px;
    color: #666;
    transition: color 0.2s ease;
}

.cpg-compare-icon:hover {
    border-color: #E7E24C;
    background: #E7E24C;
}

.cpg-compare-icon:hover svg {
    color: #000;
}

.cpg-compare-icon.active {
    background: #E7E24C;
    border-color: #E7E24C;
}

.cpg-compare-icon.active svg {
    color: #000;
}

/* Single product variant */
.cpg-compare-single {
    position: relative;
    top: auto;
    right: auto;
}

/* ==========================================================================
   Compare Sticky Bar
   ========================================================================== */

.cpg-compare-bar {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    max-width: 400px;
    animation: cpgSlideUp 0.3s ease;
}

@keyframes cpgSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpg-compare-bar-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpg-compare-bar-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cpg-compare-icon-display {
    width: 32px;
    height: 32px;
    background: #E7E24C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cpg-compare-icon-display svg {
    width: 16px;
    height: 16px;
    color: #000;
}

.cpg-compare-bar-message {
    font-family: sanfran, sans-serif;
    font-size: 14px;
    color: #333;
}

.cpg-compare-bar-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cpg-compare-thumb {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.cpg-compare-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cpg-compare-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.cpg-compare-thumb:hover .cpg-compare-thumb-remove {
    opacity: 1;
}

.cpg-compare-bar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cpg-compare-view-btn {
    flex: 1;
    padding: 10px 16px;
    background: #E7E24C;
    color: #000;
    border: none;
    border-radius: 6px;
    font-family: sanfran, sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.cpg-compare-view-btn:hover {
    background: #d4d145;
}

.cpg-compare-clear-btn {
    width: 36px;
    height: 36px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cpg-compare-clear-btn:hover {
    background: #ff4444;
    color: white;
    border-color: #ff4444;
}

/* ==========================================================================
   Compare Modal
   ========================================================================== */

.cpg-compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.cpg-compare-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    animation: cpgFadeIn 0.3s ease;
}

@keyframes cpgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cpg-compare-modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: cpgScaleIn 0.3s ease;
    overflow: hidden;
}

@keyframes cpgScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cpg-compare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.cpg-compare-modal-header h2 {
    margin: 0;
    font-family: sanfran, sans-serif;
    font-size: 24px;
    color: #333;
}

.cpg-compare-modal-close {
    width: 40px;
    height: 40px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cpg-compare-modal-close:hover {
    background: #000;
    color: #fff;
}

.cpg-compare-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.cpg-compare-table-wrapper {
    overflow-x: auto;
}

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

/* Table Header - Product cards */
.cpg-compare-table thead th {
    padding: 20px;
    text-align: center;
    vertical-align: top;
    border-bottom: 2px solid #e0e0e0;
    min-width: 200px;
}

.cpg-compare-table thead th:first-child {
    min-width: 150px;
    background: #f9f9f9;
    position: sticky;
    left: 0;
    z-index: 2;
}

.cpg-compare-product-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.cpg-compare-product-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.cpg-compare-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cpg-compare-product-name {
    font-family: sanfran, sans-serif;
    font-size: 16px;
    color: #333;
    text-decoration: none;
    text-align: center;
}

.cpg-compare-product-name:hover {
    color: #E7E24C;
}

.cpg-compare-remove-btn {
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.cpg-compare-remove-btn:hover {
    background: #ff4444;
    color: white;
    border-color: #ff4444;
}

/* Table Body - Attribute rows */
.cpg-compare-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.cpg-compare-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.cpg-compare-table tbody tr:hover {
    background: #f5f5f5;
}

.cpg-compare-table tbody td {
    padding: 16px 20px;
    text-align: center;
    font-size: 14px;
    color: #333;
}

.cpg-compare-table tbody td:first-child {
    text-align: left;
    font-family: sanfran, sans-serif;
    font-weight: 600;
    background: #f9f9f9;
    position: sticky;
    left: 0;
    z-index: 1;
}

/* Empty state */
.cpg-compare-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cpg-compare-empty svg {
    width: 64px;
    height: 64px;
    color: #ddd;
    margin-bottom: 16px;
}

.cpg-compare-empty p {
    font-size: 16px;
    margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .cpg-compare-bar {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 10px;
    }
    
    .cpg-compare-modal {
        padding: 10px;
    }
    
    .cpg-compare-modal-container {
        max-height: 95vh;
    }
    
    .cpg-compare-modal-header {
        padding: 16px;
    }
    
    .cpg-compare-modal-header h2 {
        font-size: 18px;
    }
    
    .cpg-compare-table thead th {
        min-width: 150px;
        padding: 12px;
    }
    
    .cpg-compare-product-image {
        width: 80px;
        height: 80px;
    }
    
    .cpg-compare-product-name {
        font-size: 14px;
    }
}
