/* ============================================================
   CSS BẢN ĐỒ DÊ HƯƠNG SƠN (Đồng bộ nhận diện thương hiệu)
   Màu chủ đạo: Xanh Rừng (#1B4332) & Vàng Gold (#D4AF37)
   Cập nhật: Giao diện Modal Popup dạng Grid 2x2
   ============================================================ */

* {
    font-family: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

body {
    margin: 0;
    padding: 0;
}

/* --- HEADER BẢN ĐỒ --- */
#header {
    background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 100%);
    color: white;
    padding: 30px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#header h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    color: #D4AF37;
    margin-bottom: 10px !important;
}

#header p {
    font-size: 16px;
    opacity: 0.9;
}

/* --- THỐNG KÊ (STATS BAR) --- */
#stats-bar {
    background: white;
    padding: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: relative;
    z-index: 10;
}

.stat-card {
    text-align: center;
    padding: 20px 15px;
    border-radius: 12px;
    background: linear-gradient(135deg, #F8F9FA 0%, #E8F5E9 100%);
    margin: 0 10px;
    border: 1px solid rgba(27, 67, 50, 0.05);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(27, 67, 50, 0.08);
}

.stat-number {
    font-size: 2.5em;
    font-weight: 700;
    color: #1B4332;
    font-family: 'Playfair Display', serif;
}

.stat-label {
    color: #555;
    font-size: 0.95em;
    margin-top: 5px;
    font-weight: 600;
}

/* --- BẢN ĐỒ CHÍNH --- */
#map {
    height: 600px;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 2px solid #F0F4F2;
}

#map-wrapper {
    position: relative !important;
    margin-bottom: 20px;
}

/* --- TÌM KIẾM TRÊN BẢN ĐỒ --- */
#search-panel {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border: 1px solid #F0F4F2;
}

#search-panel h5 {
    color: #1B4332;
    font-weight: 700;
    margin-bottom: 16px;
}

.search-input {
    margin-bottom: 12px;
}

#search-panel .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
}

#search-panel .btn.btn-primary {
    background: #1B4332;
    border-color: #1B4332;
    color: white;
}
#search-panel .btn.btn-primary:hover {
    background: #2D6A4F;
}

#search-panel .btn.btn-secondary {
    background: transparent;
    border: 1px solid #D4AF37;
    color: #B5952F;
}
#search-panel .btn.btn-secondary:hover {
    background: #D4AF37;
    color: #fff;
}

/* --- POPUP TRÊN BẢN ĐỒ --- */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
    min-width: 280px;
    margin: 18px;
}

.popup-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.2em;
    margin-bottom: 12px;
    color: #1B4332;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.popup-info {
    display: flex;
    align-items: center;
    font-size: 0.95em;
    margin-bottom: 6px;
    color: #444;
}

.popup-info i {
    margin-right: 10px;
    color: #D4AF37;
    width: 16px;
    text-align: center;
}

.btn-view-detail, .btn-view-list {
    margin-top: 12px;
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #D4AF37 0%, #B5952F 100%);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95em;
    transition: opacity 0.3s;
}

.btn-view-detail:hover, .btn-view-list:hover {
    opacity: 0.9;
}

/* --- NÚT QUAY LẠI TRÊN BẢN ĐỒ --- */
#btn-zoom-back,
#map-wrapper #btn-zoom-back,
button#btn-zoom-back {
    all: unset !important;
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 9999 !important;
    background: #ffffff !important;
    color: #1B4332 !important;
    border: 1px solid #1B4332 !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    cursor: pointer !important;
    display: none !important;
    align-items: center !important;
    transition: all 0.3s ease !important;
}
#btn-zoom-back.is-visible,
#map-wrapper #btn-zoom-back.is-visible,
button#btn-zoom-back.is-visible {
    display: inline-flex !important;
}
#btn-zoom-back:hover {
    background: #1B4332 !important;
    color: #fff !important;
}

/* --- CHÚ THÍCH (LEGEND) --- */
.legend {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-top: 20px;
    border: 1px solid #F0F4F2;
}
.legend-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: #1B4332;
    font-size: 1.1em;
}
.legend-item {
    margin: 8px 0;
    display: flex;
    align-items: center;
    font-size: 0.95em;
    color: #444;
}
.legend-color {
    width: 30px;
    height: 20px;
    border: 1px solid #ccc;
    margin-right: 12px;
    border-radius: 4px;
}
.legend-item i {
    color: #28a745;
}

/* ============================================================
   MODAL CHI TIẾT CƠ SỞ (LAYOUT GRID 2x2 CAO CẤP)
   ============================================================ */
.detail-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 99999; backdrop-filter: blur(3px);
}
.detail-content {
    background: white; border-radius: 16px;
    max-width: 580px; width: 90%; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
/* Header */
.detail-header {
    padding: 20px 24px; border-bottom: 1px solid #f0f0f0;
    display: flex; justify-content: space-between; align-items: center;
}
.detail-title {
    font-family: 'Playfair Display', serif; font-weight: 700;
    font-size: 1.2em; color: #1B4332; order: 1; margin: 0;
}
.detail-close {
    cursor: pointer; font-size: 1.5em; color: #888; order: 2; line-height: 1;
}
.detail-close:hover { color: #e74c3c; }

/* Body */
.detail-body { padding: 0; overflow-y: auto; }

/* Trạng thái */
.modal-status-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 24px; background: #fafafa; border-bottom: 1px solid #f0f0f0;
}
.status-label { font-size: 0.95em; color: #666; }
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px; font-size: 0.85em; font-weight: 600;
}
.status-badge.success {
    background: rgba(212, 175, 55, 0.15); color: #1B4332; border: 1px solid #D4AF37;
}
.status-badge.pending {
    background: #f1f1f1; color: #666; border: 1px solid #ddd;
}

/* Thông tin liên hệ */
.modal-contact-info { padding: 24px; }
.contact-row { display: flex; align-items: flex-start; gap: 12px; }
.mt-3 { margin-top: 16px; }
.text-gold { color: #D4AF37; font-size: 1.1em; margin-top: 3px; }
.contact-text { color: #333; font-size: 1em; }
.address-line { font-weight: 500; }
.commune-line { color: #888; font-size: 0.9em; margin-top: 4px; }

/* Lưới Grid 2x2 */
.modal-stats-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    padding: 0 24px 24px 24px;
}
.stat-box {
    border: 1px solid #f0f0f0; border-radius: 12px;
    padding: 16px; text-align: center; background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.stat-box-title {
    font-size: 0.85em; font-weight: 600; color: #666;
    margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.stat-box-title i { color: #D4AF37; }
.stat-box-value { font-size: 1.1em; font-weight: 700; color: #1B4332; }

/* Giấy chứng nhận */
.modal-gcn-info { padding: 20px 24px; border-top: 1px dashed #ddd; }
.gcn-line {
    display: flex; gap: 8px; font-size: 0.95em;
    margin-bottom: 8px; color: #555;
}
.gcn-line:last-child { margin-bottom: 0; }
.gcn-label { font-weight: 500; }
.gcn-value { color: #222; font-weight: 600; }

/* Nút bấm Footer */
.detail-footer { padding: 20px 24px; background: #fff; border-top: 1px solid #f0f0f0; border-radius: 0 0 16px 16px; }
.btn-detail-page {
    display: flex; justify-content: center; align-items: center; gap: 8px;
    width: 100%; padding: 14px; border-radius: 10px;
    background: #1B4332; color: white !important;
    text-decoration: none; font-weight: 600; font-size: 1em;
    transition: background 0.3s;
}
.btn-detail-page:hover { background: #2D6A4F; }

/* ============================================================
   CSS TRA CỨU AJAX [ht_business_lookup]
   ============================================================ */
.htmb-lookup-wrapper {
    max-width: 960px;
    margin: 0 auto 40px;
}
.htmb-lookup-heading {
    text-align: center;
    font-size: 32px;
    margin-bottom: 24px;
    color: #1B4332;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}
.htmb-lookup-box {
    background: #fff;
    border-radius: 16px;
    padding: 24px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid #F0F4F2;
}
.htmb-lookup-form {
    display: flex;
    align-items: stretch;
    gap: 12px;
}
.htmb-lookup-label {
    font-weight: 600;
    padding-top: 10px;
    white-space: nowrap;
    color: #333;
}
.htmb-lookup-input {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 10px 15px;
}
.htmb-lookup-submit {
    white-space: nowrap;
    padding: 0 30px;
    border-radius: 8px;
    background: #1B4332;
    border-color: #1B4332;
    font-weight: 600;
    color: #fff;
}
.htmb-lookup-submit:hover {
    background: #2D6A4F;
    border-color: #2D6A4F;
    color: #fff;
}
.htmb-lookup-note {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #666;
}
.htmb-lookup-results {
    margin-top: 24px;
}
.htmb-lookup-result-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    border-radius: 16px;
    background: #F8F9FA;
    border: 1px solid #eee;
    margin-bottom: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.htmb-lookup-result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    background: #fff;
}
.htmb-lookup-logo {
    flex-shrink: 0;
}
.htmb-lookup-logo-img {
    max-width: 100px;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
}
.htmb-lookup-logo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    background: #fff;
    color: #1B4332;
    border: 2px solid rgba(27,67,50,0.1);
}
.htmb-lookup-info {
    flex: 1;
}
.htmb-lookup-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1B4332;
    font-family: 'Playfair Display', serif;
}
.htmb-lookup-line {
    font-size: 0.95rem;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.htmb-lookup-label-small {
    font-weight: 600;
    margin-right: 4px;
    color: #333;
}
.htmb-lookup-link {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
    font-size: 0.95rem;
    color: #D4AF37;
    text-decoration: none;
    font-weight: 600;
    gap: 5px;
}
.htmb-lookup-link::after {
    content: "→";
}
.htmb-lookup-link:hover {
    color: #B5952F;
}

/* Badge Tra cứu AJAX */
.htmb-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 12px;
    vertical-align: middle;
}
.htmb-badge--success {
    background: rgba(212, 175, 55, 0.15);
    color: #1B4332;
    border: 1px solid #D4AF37;
}
.htmb-badge--muted {
    background: #f1f1f1;
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Hint trên bản đồ */
.ht-map-hint {
    background: rgba(27, 67, 50, 0.85);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 500;
}
.ht-map-hint.ht-hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    #map { height: 450px; }
    .detail-content { width: 95%; }
    .htmb-lookup-form { flex-direction: column; align-items: stretch; }
    .htmb-lookup-submit { width: 100%; margin-top: 10px; }
    .htmb-lookup-result-card { flex-direction: column; align-items: center; text-align: center; }
    .htmb-lookup-line { justify-content: center; }
    .htmb-badge { margin-left: 0; margin-top: 8px; display: inline-block; }
    .modal-stats-grid { grid-template-columns: 1fr; } /* Chuyển lưới thành 1 cột trên Mobile */
}