/* ============================================================
   DWE CMS - Public Site Styles
   Light, professional, responsive Bootstrap 5 theme
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --body-bg: #ffffff;
    --section-bg: #f8fafc;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-dark);
    background: var(--body-bg);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Top navbar */
.site-navbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.site-navbar .navbar-brand {
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-navbar .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.site-navbar .brand-text {
    line-height: 1.1;
}

.site-navbar .brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.site-navbar .brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.site-navbar .nav-link {
    font-weight: 500;
    color: var(--text-dark);
    padding: 8px 16px !important;
    border-radius: 6px;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    color: #fff;
    padding: 90px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08) 0, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.06) 0, transparent 40%);
    pointer-events: none;
}

.hero-section .hero-title {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
}

.hero-section .hero-subtitle {
    font-size: 1.15rem;
    opacity: 0.95;
    margin-bottom: 28px;
    max-width: 720px;
}

.hero-section .btn-cta {
    background: #fff;
    color: var(--primary-dark);
    border: none;
    padding: 12px 28px;
    font-weight: 600;
    border-radius: 6px;
    font-size: 15px;
}

.hero-section .btn-cta:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.hero-section .btn-outline-cta {
    border: 2px solid rgba(255,255,255,0.5);
    color: #fff;
    padding: 10px 26px;
    font-weight: 600;
    border-radius: 6px;
    background: transparent;
}

.hero-section .btn-outline-cta:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
}

/* Stats strip */
.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.hero-stats .stat-item .num {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.hero-stats .stat-item .lbl {
    font-size: 0.85rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 4px;
}

/* Sections */
.section {
    padding: 70px 0;
}

.section-light { background: var(--body-bg); }
.section-muted { background: var(--section-bg); }

.section-title {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 720px;
    margin: 0 auto 50px;
    text-align: center;
}

.text-center.section-subtitle { margin-left: auto; margin-right: auto; }

/* Project card */
.project-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.project-card .card-header-strip {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    padding: 14px 18px;
    color: #fff;
}

.project-card .card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card .project-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.project-card .project-client {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.project-card .project-scope {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 14px;
    flex: 1;
}

.project-card .project-meta {
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-nature {
    font-size: 11px;
    padding: 3px 7px;
    border-radius: 4px;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    margin-right: 4px;
}

/* Service/feature cards */
.feature-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 28px 22px;
    height: 100%;
    transition: all 0.25s;
}

.feature-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.feature-card .icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 18px;
}

.feature-card h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

/* Filter bar */
.filter-bar {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary);
    border-color: var(--border-color);
    padding: 9px 16px;
    border-radius: 6px !important;
    margin: 0 3px;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link { color: #9ca3af; }

/* Footer */
.site-footer {
    background: #111827;
    color: #d1d5db;
    padding: 50px 0 25px;
    margin-top: 60px;
}

.site-footer h5 {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.site-footer p, .site-footer li { font-size: 14px; }

.site-footer a { color: #9ca3af; }
.site-footer a:hover { color: #fff; }

.site-footer ul {
    list-style: none;
    padding: 0;
}

.site-footer ul li { margin-bottom: 8px; }

.site-footer .footer-bottom {
    border-top: 1px solid #374151;
    margin-top: 30px;
    padding-top: 20px;
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}

/* Detail page */
.project-detail-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    padding: 50px 0 40px;
}

.project-detail-header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.project-detail-header .meta {
    font-size: 14px;
    opacity: 0.95;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.project-detail-header .meta i { margin-right: 6px; }

.detail-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
}

.detail-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

.detail-info-table {
    width: 100%;
    font-size: 14px;
}

.detail-info-table tr td {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: top;
}

.detail-info-table tr td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 35%;
}

.flag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flag-list .flag-item {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 600;
}

.flag-list .flag-item.eng {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.flag-list .flag-item.pm {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    color: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section { padding: 60px 0 50px; }
    .hero-section .hero-title { font-size: 1.9rem; }
    .hero-section .hero-subtitle { font-size: 1rem; }
    .hero-stats { gap: 24px; }
    .hero-stats .stat-item .num { font-size: 1.6rem; }
    .section { padding: 50px 0; }
    .section-title { font-size: 1.5rem; }
    .project-detail-header h1 { font-size: 1.4rem; }
    .map-container { height: 400px !important; }
}

/* ============================================================
   WebGIS Map Section
   ============================================================ */

.map-section {
    padding: 70px 0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.map-container {
    height: 580px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    border: 1px solid #d1d5db;
    background: #f1f5f9;
    position: relative;
    z-index: 1;
}

#projectMap {
    width: 100%;
    height: 100%;
}

.map-controls {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.map-filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.map-filter-btn {
    padding: 8px 16px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-filter-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.map-filter-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.map-filter-btn .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.map-filter-btn .dot.history          { background: #2563eb; }
.map-filter-btn .dot.history_detailed { background: #7c3aed; }
.map-filter-btn .dot.ongoing          { background: #f59e0b; }
.map-filter-btn.active .dot.history,
.map-filter-btn.active .dot.history_detailed,
.map-filter-btn.active .dot.ongoing {
    background: #fff;
}

.map-stats {
    display: flex;
    gap: 24px;
    font-size: 13px;
    color: #6b7280;
    align-items: center;
    flex-wrap: wrap;
}

.map-stats .stat strong {
    color: #1f2937;
    font-size: 18px;
    font-weight: 700;
}

/* Map legend */
.map-legend {
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 12px;
    line-height: 1.7;
    max-width: 220px;
}

.map-legend h6 {
    font-size: 12px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: #374151;
}

.map-legend .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

/* Custom Leaflet marker styling */
.custom-marker {
    background: transparent;
    border: none;
}

.custom-marker .marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    background: var(--marker-color, #2563eb);
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    position: relative;
}

.custom-marker .marker-pin::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    transform: rotate(45deg);
}

.custom-marker.featured .marker-pin {
    width: 32px;
    height: 32px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), 0 0 0 4px rgba(245, 158, 11, 0.3);
}

.custom-marker.featured .marker-pin::after {
    top: 7px;
    left: 7px;
    width: 14px;
    height: 14px;
}

/* Marker cluster custom style */
.marker-cluster-custom {
    background: rgba(37, 99, 235, 0.7);
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.marker-cluster-custom.ongoing {
    background: rgba(245, 158, 11, 0.8);
}

.marker-cluster-custom.detailed {
    background: rgba(124, 58, 237, 0.7);
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 280px !important;
    max-width: 280px;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.popup-card {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: #1f2937;
}

.popup-header {
    padding: 12px 16px;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header.history          { background: #2563eb; }
.popup-header.history_detailed { background: #7c3aed; }
.popup-header.ongoing          { background: #f59e0b; }

.popup-body {
    padding: 14px 16px;
}

.popup-body h5 {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.3;
}

.popup-body .popup-client {
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.popup-body .popup-meta {
    color: #6b7280;
    font-size: 11.5px;
    margin-bottom: 10px;
}

.popup-body .popup-meta i {
    margin-right: 4px;
    color: #9ca3af;
}

.popup-body .popup-badges {
    margin-bottom: 10px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.popup-body .popup-badges .badge {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 600;
}

.popup-body .popup-badges .badge.facility {
    background: #dcfce7;
    color: #166534;
}

.popup-body .popup-link {
    display: inline-block;
    padding: 6px 14px;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    text-align: center;
    transition: background 0.15s;
}

.popup-body .popup-link:hover {
    background: #1d4ed8;
    color: #fff;
}

/* Loading indicator on map */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.map-loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Region stats card next to map */
.map-side-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 20px;
    height: 100%;
}

.map-side-panel h5 {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.region-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 460px;
    overflow-y: auto;
}

.region-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.region-list li:hover {
    background: #f9fafb;
}

.region-list li:last-child {
    border-bottom: none;
}

.region-list .region-name {
    color: #1f2937;
    font-weight: 500;
}

.region-list .region-count {
    background: #eff6ff;
    color: #2563eb;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
