/*
 * Phase 2-5 visual polish — additive layer on top of style.css.
 *
 * Conforms to docs/ROADMAP.md §0 design tokens. NO new colors, fonts,
 * or icon libraries — only depth, hierarchy, and motion.
 */

/* ─────────────────────────────────────────────
 * COMPOUND LIST PAGE
 * ───────────────────────────────────────────── */

.compound-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 3.5rem 1.5rem 4.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.compound-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08), transparent 50%);
    pointer-events: none;
}

.compound-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.compound-hero p {
    font-size: 1.05rem;
    opacity: 0.92;
    max-width: 640px;
    margin: 0 auto 1.5rem;
}

.compound-hero-search {
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    max-width: 720px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Compound card — taller cover, gradient overlay, pin badges */
.compound-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.compound-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.18);
}

.compound-card-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    overflow: hidden;
}

.compound-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.compound-card:hover .compound-card-cover img {
    transform: scale(1.06);
}

.compound-card-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 45%);
    pointer-events: none;
}

.compound-card-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 4rem;
}

.compound-card-overlay {
    position: absolute;
    inset-block-end: 0.85rem;
    inset-inline-start: 1rem;
    inset-inline-end: 1rem;
    z-index: 1;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: end;
    pointer-events: none;
}

.compound-card-overlay-pill {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.compound-card-overlay-availability {
    background: rgba(34, 197, 94, 0.95);
    color: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.compound-card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.compound-card-title {
    font-weight: 700;
    color: var(--text-color, #1f2937);
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.compound-card-developer {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.compound-card-location {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.compound-card-footer {
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.compound-card-price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.compound-card-price-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-inline-end: 0.25rem;
}


/* ─────────────────────────────────────────────
 * COMPOUND DETAIL PAGE
 * ───────────────────────────────────────────── */

.compound-detail-hero {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    margin-bottom: 2rem;
    aspect-ratio: 21 / 9;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.compound-detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compound-detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.25) 50%, transparent 100%);
    display: flex;
    align-items: flex-end;
    padding: 2rem 2.5rem;
    color: #fff;
}

.compound-detail-hero-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.compound-detail-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.compound-detail-hero-subtitle {
    font-size: 1rem;
    opacity: 0.92;
    margin-bottom: 0.25rem;
}

.compound-detail-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.95rem;
    opacity: 0.95;
}

.compound-detail-hero-meta-item i {
    margin-inline-end: 0.35rem;
}

.compound-detail-hero-price {
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    padding: 1rem 1.5rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.compound-detail-hero-price-label {
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.compound-detail-hero-price-value {
    font-size: 1.85rem;
    font-weight: 800;
}

@media (max-width: 575.98px) {
    .compound-detail-hero {
        aspect-ratio: 4 / 3;
    }
    .compound-detail-hero-overlay {
        padding: 1.25rem 1.25rem;
    }
    .compound-detail-hero h1 {
        font-size: 1.75rem;
    }
}

/* Sticky tab nav */
.compound-detail-tabs {
    position: sticky;
    top: 70px; /* below sticky navbar */
    background: #fff;
    z-index: 10;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.compound-detail-tabs .nav-tabs {
    border-bottom: 0;
    gap: 0.25rem;
}

.compound-detail-tabs .nav-link {
    border: 0;
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.compound-detail-tabs .nav-link:hover {
    background: rgba(37, 99, 235, 0.06);
    color: var(--primary-color);
}

.compound-detail-tabs .nav-link.active {
    background: var(--primary-color);
    color: #fff;
}

/* Unit grid card */
.unit-grid-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.1rem;
    border: 1px solid var(--border-color);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.unit-grid-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.15);
}

.unit-grid-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.unit-grid-card-number {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.05rem;
}

.unit-grid-card-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.unit-grid-card-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.unit-grid-card-price {
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.15rem;
}

/* ─────────────────────────────────────────────
 * UNIT DETAIL PAGE — sidebar cards polish
 * ───────────────────────────────────────────── */

.unit-price-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.25);
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.unit-price-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 60%);
    pointer-events: none;
}

.unit-price-card-label {
    font-size: 0.85rem;
    opacity: 0.92;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    position: relative;
}

.unit-price-card-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
    position: relative;
}

.unit-price-card-secondary {
    font-size: 0.95rem;
    opacity: 0.85;
    position: relative;
}

.unit-info-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.unit-info-card-header {
    background: linear-gradient(to bottom, #fafbfd, #fff);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.unit-info-card-header i {
    color: var(--primary-color);
}

.unit-info-card-body {
    padding: 1.25rem;
}

.unit-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.92rem;
}

.unit-info-row:last-child {
    border-bottom: 0;
}

.unit-info-row-label {
    color: var(--text-muted);
}

.unit-info-row-value {
    font-weight: 600;
    color: var(--text-color);
}

/* Mortgage calc result tile */
.mortgage-result {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    margin-top: 1rem;
}

.mortgage-result-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mortgage-result-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--primary-color);
}

.unit-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.unit-stat {
    background: #fafbfd;
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.unit-stat-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.unit-stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.unit-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────
 * Lead scoring polish (CRM)
 * ───────────────────────────────────────────── */

.heat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.82rem;
}

.heat-pill-hot {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08));
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.heat-pill-warm {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(37, 99, 235, 0.06));
    color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.heat-pill-cold {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid var(--border-color);
}

/* ─────────────────────────────────────────────
 * Audit log polish
 * ───────────────────────────────────────────── */

.audit-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.audit-action-property_approved { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.audit-action-property_rejected { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.audit-action-customer_status_changed { background: rgba(37, 99, 235, 0.12); color: var(--primary-color); }
.audit-action-dispatch_sent { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.audit-action-dispatch_failed { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.audit-action-default { background: #f1f5f9; color: #475569; }

/* ─────────────────────────────────────────────
 * Valuation result chart
 * ───────────────────────────────────────────── */

.valuation-result {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.0));
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 1.5rem;
}

.valuation-bar-container {
    position: relative;
    height: 14px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 1.5rem 0 0.75rem;
}

.valuation-bar-fill {
    position: absolute;
    inset-block: 0;
    background: linear-gradient(to right, #fbbf24, #22c55e, #fbbf24);
    border-radius: 999px;
}

.valuation-bar-marker {
    position: absolute;
    top: -8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transform: translateX(50%);
}

.valuation-range {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.valuation-mid {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: 1rem;
}

.valuation-mid-label {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ─────────────────────────────────────────────
 * Generic dashboard KPI tile polish
 * ───────────────────────────────────────────── */

.kpi-tile-pro {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.kpi-tile-pro:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.kpi-tile-pro::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    width: 5px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.25s;
}

.kpi-tile-pro:hover::before {
    opacity: 1;
}

.kpi-tile-pro-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04));
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 0.85rem;
}

.kpi-tile-pro-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.kpi-tile-pro-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.kpi-tile-pro-delta {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-tile-pro-delta.positive { color: #15803d; }
.kpi-tile-pro-delta.negative { color: #b91c1c; }
