/**
 * Compare Panel & Tab Styling Fix
 * Version: 1.0.3 | Date: 2026-02-04
 * Changes: Panel uses flexbox column layout; .compare-wrap scrollable with max-height; Compare/Close buttons flex-shrink:0 with z-index:100; buttons fixed at bottom; Compare button brand red
 * 
 * Version: 1.0.2 | Date: 2026-02-04
 * Changes: Mobile - Panel width 90% max 320px; z-index 999999 (panel) and 1000000 (tab) above Search button; Close button pointer-events enabled
 * 
 * Version: 1.0.1 | Date: 2026-02-04
 * Ensures compare tab remains visible on right side with count badge
 */

/* Compare panel - ensure it's positioned correctly */
#compare-property-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 999999; /* Higher than Search button */
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#compare-property-panel.compare-property-panel-open {
    right: 0;
}

/* Panel title */
#compare-property-panel > p {
    margin: 0 0 15px 0;
    flex-shrink: 0;
}

/* Compare wrap - property thumbnails container */
.compare-wrap {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    max-height: calc(100vh - 180px); /* Leave room for buttons */
}

/* Individual property items in compare panel */
.compare-item {
    position: relative;
    margin-bottom: 10px;
}

.compare-item img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
}

/* Remove icon on property thumbnails */
.compare-item .remove-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

/* Buttons at bottom - fixed position */
a.compare-btn,
.close-compare-panel {
    flex-shrink: 0;
    position: relative;
    z-index: 100 !important; /* Above images */
}

/* Close button - ensure it's clickable */
.close-compare-panel {
    margin-top: 10px;
    cursor: pointer !important;
    pointer-events: auto !important;
    width: 100%;
    display: block;
}

/* Compare button inside panel */
a.compare-btn {
    cursor: pointer !important;
    pointer-events: auto !important;
    display: block !important;
    background: #8a0516 !important; /* Brand red */
    color: #fff !important;
    border: none !important;
    text-decoration: none !important;
}

a.compare-btn:hover {
    background: #6d0412 !important;
    color: #fff !important;
}

/* Compare tab/label - persistent on right side */
.compare-property-label {
    position: fixed !important;
    top: 50% !important;
    right: 0 !important;
    transform: translateY(-50%) !important;
    background-color: #8a0516 !important; /* Brand red */
    color: #fff !important;
    width: 50px !important;
    height: 50px !important;
    display: none !important; /* Hidden by default */
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    border-top-left-radius: 6px !important;
    border-bottom-left-radius: 6px !important;
    cursor: pointer !important;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2) !important;
    z-index: 1000000 !important; /* Higher than panel and search button */
    transition: all 0.3s ease !important;
}

/* Show when properties are added */
.compare-property-label[style*="display: block"],
.compare-property-label[style*="display:block"] {
    display: flex !important;
}

.compare-property-label:hover {
    width: 55px !important;
    background-color: #6d0412 !important;
}

/* Count badge - green circle with white text */
.compare-property-label .compare-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #1a6b1a !important; /* Green */
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    border: 2px solid #fff !important;
}

/* Icon in compare tab */
.compare-property-label .houzez-icon {
    font-size: 20px !important;
    color: #fff !important;
}

/* Mobile: ensure panel slides in properly */
@media (max-width: 767px) {
    #compare-property-panel {
        width: 90% !important;
        max-width: 320px !important;
        right: -100% !important;
    }
    
    #compare-property-panel.compare-property-panel-open {
        right: 0 !important;
    }
    
    .compare-property-label {
        width: 45px !important;
        height: 45px !important;
    }
}
