/* ============================================================
   PropertyCompare Plugin — Styles
   Self-contained CSS. No global contamination.
   ============================================================ */

/* --- Compare Toggle Button (Card & Detail) --- */
.btn-compare-toggle {
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-compare-toggle i {
    transition: transform 0.2s ease;
}

.btn-compare-toggle.compare-active {
    color: #0056b3 !important;
    border-color: #0056b3 !important;
    background: rgba(0, 86, 179, 0.08) !important;
}

.btn-compare-toggle.compare-active i {
    transform: scale(1.15);
}

/* --- Compare Tray (Floating Bottom Bar) --- */
.compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 2px solid #0056b3;
}

.compare-tray.visible {
    transform: translateY(0);
}

.compare-tray-items {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow-x: auto;
    min-width: 0;
}

.compare-tray-item {
    position: relative;
    flex-shrink: 0;
    width: 70px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #334155;
    transition: border-color 0.2s ease;
    background: #1e293b;
}

.compare-tray-item:hover {
    border-color: #0056b3;
}

.compare-tray-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compare-tray-item .compare-tray-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    z-index: 2;
}

.compare-tray-item .compare-tray-remove:hover {
    transform: scale(1.2);
    background: #dc2626;
}

.compare-tray-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    color: #94a3b8;
}

.compare-tray-info .compare-count {
    background: #0056b3;
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.compare-tray-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.compare-tray-btn {
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.compare-tray-btn-primary {
    background: #0056b3;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3);
}

.compare-tray-btn-primary:hover {
    background: #004494;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.4);
    color: white;
    text-decoration: none;
}

.compare-tray-btn-primary:disabled,
.compare-tray-btn-primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.compare-tray-btn-clear {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 7px 14px;
}

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

/* --- Compare View (Side-by-Side Table) --- */
.compare-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
}

.compare-header {
    margin-bottom: 30px;
}

.compare-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
}

.compare-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.compare-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 15px;
}

.compare-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.compare-table th,
.compare-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    text-align: left;
}

.compare-table th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    white-space: nowrap;
    width: 140px;
    min-width: 140px;
    position: sticky;
    left: 0;
    z-index: 10;
    border-right: 2px solid #e2e8f0;
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}

.compare-table th i {
    margin-right: 6px;
    color: #0056b3;
}

.compare-table td {
    font-size: 0.95rem;
    color: #334155;
    min-width: 200px;
}

.compare-table .compare-col-header {
    text-align: center;
    padding: 0;
}

.compare-table .compare-col-header .compare-property-header {
    padding: 15px;
    text-align: center;
}

.compare-table .compare-col-header img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 0;
}

.compare-table .compare-property-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    margin: 10px 0 4px;
    padding: 0 10px;
}

.compare-table .compare-property-location {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
}

.compare-price-cell {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0056b3;
}

.compare-price-m2 {
    font-size: 0.78rem;
    font-weight: 500;
    color: #94a3b8;
    display: block;
    margin-top: 2px;
}

.compare-badge-ee {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
}

.compare-amenity-yes {
    color: #10b981;
    font-weight: 600;
}

.compare-amenity-no {
    color: #cbd5e1;
}

.compare-remove-btn {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #ef4444;
    cursor: pointer;
    border: none;
    background: none;
    font-weight: 600;
}

.compare-remove-btn:hover {
    text-decoration: underline;
}

.compare-link-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 16px;
    background: #0056b3;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.compare-link-btn:hover {
    background: #004494;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* --- Responsive: Mobile Stacked Cards --- */
@media (max-width: 768px) {
    .compare-tray {
        flex-wrap: wrap;
        padding: 10px 15px;
        gap: 10px;
    }

    .compare-tray-items {
        width: 100%;
        justify-content: flex-start;
    }

    .compare-tray-actions {
        width: 100%;
        justify-content: space-between;
    }

    .compare-table .compare-col-header img {
        height: 120px;
    }
}

/* --- Dark Mode --- */
body.dark-mode .compare-tray {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%);
    border-top-color: #1d4ed8;
}

body.dark-mode .compare-tray-item {
    border-color: #475569;
}

body.dark-mode .compare-tray-info {
    color: #cbd5e1;
}

body.dark-mode .compare-tray-btn-clear {
    color: #94a3b8;
    border-color: #475569;
}

body.dark-mode .compare-table {
    background: #1e293b;
}

body.dark-mode .compare-table th {
    background: #0f172a !important;
    color: #94a3b8;
    border-right: 2px solid #334155;
    box-shadow: 2px 0 8px rgba(0,0,0,0.3);
}

body.dark-mode .compare-table td {
    color: #e2e8f0;
    border-bottom-color: #334155;
}

body.dark-mode .compare-table .compare-property-title {
    color: #f1f5f9;
}

body.dark-mode .compare-table .compare-property-location {
    color: #94a3b8;
}

body.dark-mode .compare-table-wrapper {
    border-color: #334155;
}

body.dark-mode .compare-header h1 {
    color: #f1f5f9;
}

body.dark-mode .compare-empty {
    color: #94a3b8;
}

body.dark-mode .compare-empty i {
    color: #475569;
}
