/* CM Compare - Public Styles */

/* Compare Table */
.cm-compare-wrapper {
    max-width: 100%;
    overflow-x: auto;
    margin: 30px 0;
}

.cm-compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.cm-compare-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.cm-compare-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

#cm-compare-search {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
}

.cm-btn-add-property {
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
}

.cm-btn-add-property:hover {
    background: #005177;
}

.cm-btn-add-property .dashicons {
    font-size: 18px;
}

/* Compare Table Container */
.cm-compare-table-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
}

.cm-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.cm-compare-table thead th {
    background: #f7f7f7;
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    text-align: center;
    vertical-align: top;
}

.cm-compare-table th.cm-field-label {
    background: #fff;
    text-align: left;
    font-weight: 600;
    width: 200px;
    position: sticky;
    left: 0;
    z-index: 10;
}

.cm-compare-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.cm-compare-table tbody tr:hover {
    background: #fafafa;
}

.cm-compare-table td {
    padding: 15px 20px;
    text-align: center;
    vertical-align: middle;
}

.cm-compare-table td.cm-field-label {
    background: #fff;
    text-align: left;
    font-weight: 500;
    color: #666;
    position: sticky;
    left: 0;
    border-right: 1px solid #f0f0f0;
}

.cm-property-header {
    position: relative;
    min-height: 40px;
}

.cm-remove-property {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-remove-property:hover {
    background: #c82333;
}

.cm-empty-column {
    background: #fafafa !important;
}

.cm-search-trigger {
    padding: 10px 20px;
    background: transparent;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    width: 100%;
}

.cm-search-trigger:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.cm-empty-value {
    color: #999;
}

.cm-no-image {
    padding: 40px;
    background: #f5f5f5;
    color: #999;
    border-radius: 4px;
}

.cm-compare-table img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.cm-btn {
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    font-size: 14px;
}

.cm-btn-primary {
    background: #2c3e50;
    color: white;
}

.cm-btn-primary:hover {
    background: #1a252f;
    color: white;
}

.cm-btn-secondary {
    background: #6c757d;
    color: white;
}

.cm-btn-secondary:hover {
    background: #5a6268;
}

/* Compare Button */
.cm-compare-btn {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.cm-compare-btn:hover {
    background: #218838;
}

.cm-compare-btn.added {
    background: #dc3545;
}

.cm-compare-btn.added .cm-compare-icon {
    transform: rotate(45deg);
}

.cm-compare-icon {
    font-size: 18px;
    font-weight: bold;
    transition: transform 0.3s;
}

/* Floating Compare List Widget */
.cm-compare-list-widget {
    position: fixed;
    width: 320px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
}

.cm-compare-list-widget.active {
    display: block;
}

.cm-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.cm-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.cm-position-top-right {
    top: 20px;
    right: 20px;
}

.cm-position-top-left {
    top: 20px;
    left: 20px;
}

.cm-compare-widget-header {
    padding: 15px 20px;
    background: #2c3e50;
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cm-compare-widget-header h4 {
    margin: 0;
    font-size: 16px;
}

.cm-compare-count {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
}

.cm-compare-widget-body {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.cm-compare-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-compare-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    position: relative;
}

.cm-remove-item {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.cm-remove-item:hover {
    background: #c82333;
}

.cm-item-thumbnail {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.cm-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.cm-item-title {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

.cm-compare-widget-footer {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.cm-compare-widget-footer .cm-btn {
    flex: 1;
    text-align: center;
}

/* Property Search Dialog */
.cm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cm-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.cm-dialog-content {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.cm-dialog-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cm-dialog-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.cm-dialog-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.cm-dialog-close:hover {
    color: #333;
}

.cm-dialog-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.cm-search-box {
    position: relative;
    margin-bottom: 20px;
}

.cm-search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
}

.cm-search-box input:focus {
    outline: none;
    border-color: #0073aa;
}

.cm-search-loading {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.cm-search-loading .dashicons {
    color: #0073aa;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

.cm-search-results {
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cm-search-placeholder,
.cm-no-results,
.cm-error {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cm-error {
    color: #dc3545;
}

.cm-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cm-result-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.cm-result-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cm-result-item.cm-disabled {
    opacity: 0.5;
    background: #f5f5f5;
}

.cm-result-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.cm-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cm-no-image-small {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
}

.cm-result-info {
    flex: 1;
}

.cm-result-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.cm-result-address,
.cm-result-price {
    margin: 4px 0;
    font-size: 13px;
    color: #666;
}

.cm-result-price {
    font-weight: 600;
    color: #0073aa;
}

.cm-result-action {
    display: flex;
    align-items: center;
}

.cm-already-added {
    font-size: 12px;
    color: #28a745;
    font-weight: 500;
}

.cm-btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.cm-selected-properties {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.cm-selected-properties h4 {
    margin: 0 0 15px 0;
    font-size: 15px;
    color: #333;
}

.cm-selected-count {
    color: #666;
    font-weight: normal;
}

.cm-no-selected {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}

.cm-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.cm-selected-title {
    font-size: 14px;
    color: #333;
}

.cm-remove-selected {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.cm-remove-selected:hover {
    background: #c82333;
}

.cm-dialog-footer {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .cm-compare-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cm-compare-search {
        width: 100%;
    }
    
    #cm-compare-search {
        flex: 1;
    }
    
    .cm-compare-list-widget {
        width: calc(100% - 40px);
        left: 20px !important;
        right: 20px !important;
    }
    
    .cm-compare-table th.cm-field-label,
    .cm-compare-table td.cm-field-label {
        position: static;
    }
    
    .cm-dialog-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .cm-result-item {
        flex-direction: column;
    }
    
    .cm-result-image {
        width: 100%;
        height: 150px;
    }
    
    .cm-result-action {
        justify-content: flex-end;
    }
}
