/* ══════════════════════════════════════════════════════════════════════
   ThienHungLand – Frontend CSS
   Màu Luxury Black & Gold  |  CSS Variables driven
   ══════════════════════════════════════════════════════════════════════ */

/* ── Root Variables (override từ DB qua PHP inject) ─────────────────── */
:root {
    --thl-primary:       #B8860B;
    --thl-primary-light: #D4A017;
    --thl-secondary:     #1a1a1a;
    --thl-pin:           #B8860B;
    --thl-bg:            #0d0d0d;
    --thl-surface:       #1a1a1a;
    --thl-surface-2:     #242424;
    --thl-border:        #2e2e2e;
    --thl-text:          #f0ece4;
    --thl-text-muted:    #888;
    --thl-radius:        8px;
    --thl-shadow:        0 4px 20px rgba(0,0,0,.4);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Typography ──────────────────────────────────────────────────────── */
.thl-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--thl-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.thl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--thl-primary);
    color: #000;
    border: none;
    border-radius: var(--thl-radius);
    padding: 10px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-decoration: none;
}
.thl-btn:hover { background: var(--thl-primary-light); transform: translateY(-1px); }
.thl-btn:active { transform: translateY(0); }

.thl-btn-outline {
    background: transparent;
    border: 1.5px solid var(--thl-primary);
    color: var(--thl-primary);
}
.thl-btn-outline:hover { background: var(--thl-primary); color: #000; }

.thl-btn-phone {
    background: #16a34a;
    color: #fff;
}
.thl-btn-phone:hover { background: #15803d; color: #fff; }

.thl-btn-zalo {
    background: #0068ff;
    color: #fff;
}
.thl-btn-zalo:hover { background: #0055cc; color: #fff; }

/* ── Card BĐS ────────────────────────────────────────────────────────── */
.thl-card {
    background: var(--thl-surface);
    border: 1px solid var(--thl-border);
    border-radius: var(--thl-radius);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
    position: relative;
}
.thl-card:hover {
    box-shadow: var(--thl-shadow);
    transform: translateY(-3px);
}

/* Nhãn Đã bán / Đã thuê đè lên ảnh */
.thl-card .thl-sold-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.thl-card .thl-sold-badge {
    background: #dc2626;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    padding: 10px 24px;
    border-radius: 6px;
    letter-spacing: 1px;
    transform: rotate(-12deg);
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}

.thl-card__thumb {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #111;
}
.thl-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s;
}
.thl-card:hover .thl-card__thumb img { transform: scale(1.04); }

.thl-card__body { padding: 14px; }

.thl-card__price {
    font-size: 17px;
    font-weight: 800;
    color: var(--thl-primary);
    margin: 0 0 6px;
    line-height: 1.2;
}
.thl-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--thl-text);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.thl-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--thl-text-muted);
    margin-bottom: 12px;
}
.thl-card__meta span { display: flex; align-items: center; gap: 3px; }

.thl-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Ẩn contact khi đã bán/thuê */
.thl-card[data-sold="true"] .thl-card__actions { display: none; }

/* Badge VT */
.thl-vt-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--thl-primary);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 3;
    letter-spacing: .3px;
}

/* ── Grid Layout ─────────────────────────────────────────────────────── */
.thl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Search Bar ──────────────────────────────────────────────────────── */
.thl-search-bar {
    background: var(--thl-surface);
    border: 1px solid var(--thl-border);
    border-radius: var(--thl-radius);
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.thl-input {
    background: var(--thl-surface-2);
    border: 1px solid var(--thl-border);
    color: var(--thl-text);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color .2s;
    width: 100%;
}
.thl-input:focus {
    outline: none;
    border-color: var(--thl-primary);
}
.thl-input option { background: var(--thl-surface-2); }

/* ── Tra cứu kết quả ─────────────────────────────────────────────────── */
.thl-result-card {
    background: var(--thl-surface);
    border: 1px solid var(--thl-primary);
    border-radius: var(--thl-radius);
    overflow: hidden;
}
.thl-result-header {
    background: var(--thl-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--thl-border);
}
.thl-result-header h3 {
    margin: 0;
    color: var(--thl-primary);
    font-size: 15px;
}
.thl-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1px;
    background: var(--thl-border);
    padding: 1px;
}
.thl-result-item {
    background: var(--thl-surface);
    padding: 14px;
}
.thl-result-highlight { background: var(--thl-surface-2); }
.thl-result-label {
    font-size: 11px;
    color: var(--thl-text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
}
.thl-result-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--thl-primary);
}
.thl-result-highlight .thl-result-value { font-size: 22px; }

.thl-lock-bar {
    background: #1a1a1a;
    border-top: 1px solid var(--thl-border);
    padding: 12px 16px;
    color: var(--thl-text-muted);
    font-size: 13px;
}
.thl-lock-bar strong { color: var(--thl-primary); }

.thl-listings-table { padding: 0 16px 16px; }
.thl-listing-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--thl-border);
    font-size: 13px;
    color: var(--thl-text);
}
@media(max-width:600px) {
    .thl-listing-row { grid-template-columns: 1fr; }
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.thl-alert-error {
    background: rgba(220,38,38,.15);
    border: 1px solid #dc2626;
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

/* ── Video embed ─────────────────────────────────────────────────────── */
.thl-video-wrap {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--thl-radius);
    background: #000;
}
.thl-video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ── Map pin color ───────────────────────────────────────────────────── */
.thl-map-pin {
    width: 28px;
    height: 28px;
    background: var(--thl-pin);
    border: 2px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
    cursor: pointer;
    transition: transform .15s;
}
.thl-map-pin:hover { transform: rotate(-45deg) scale(1.2); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .thl-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .thl-search-bar { flex-direction: column; }
}
@media (max-width: 480px) {
    .thl-grid { grid-template-columns: 1fr; }
    .thl-card__actions { grid-template-columns: 1fr; }
}
