/* ==========================================================
   GIAO DIỆN HỆ THỐNG BẢN ĐỒ ĐỊA CHÍNH DGN & VỆ TINH LỊCH SỬ
   Design: Modern GIS Luxury Glassmorphism & High Contrast
   ========================================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-surface: rgba(16, 24, 40, 0.85);
    --bg-surface-elevated: rgba(26, 38, 64, 0.95);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-highlight: rgba(0, 210, 255, 0.4);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #00d2ff;
    --accent-cyan: #3a7bd5;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-purple: #8b5cf6;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 210, 255, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Layout chính */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

/* Header / Top Navigation Bar */
.top-nav {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    height: 60px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

.brand-text h1 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #ffffff, #00d2ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Nút bấm Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-highlight);
    color: var(--accent-blue);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar quản lý danh sách bản đồ */
.sidebar {
    position: absolute;
    top: 88px;
    left: 16px;
    bottom: 24px;
    width: 360px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    z-index: 990;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    transform: translateX(0);
}

.sidebar.collapsed {
    transform: translateX(-390px);
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 15px;
    font-weight: 600;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Thẻ bản đồ trong danh sách */
.map-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.map-card:hover, .map-card.active {
    background: rgba(0, 210, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.15);
}

.map-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.map-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.badge-blue { background: rgba(0, 210, 255, 0.15); color: var(--accent-blue); }
.badge-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-orange { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }

.map-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
}

/* Map Canvas */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0b0f19;
    z-index: 1;
}

/* Floating Tools / Layer Switcher & Measurements */
.floating-tools {
    position: absolute;
    top: 88px;
    right: 16px;
    z-index: 990;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Timeline Slider Bar (Dưới đáy màn hình) */
.timeline-container {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: min(900px, 90vw);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    z-index: 990;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.timeline-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-blue);
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-slider-wrap {
    position: relative;
    padding: 8px 4px;
}

.timeline-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 0 12px var(--accent-blue);
    border: 2px solid #ffffff;
    transition: var(--transition);
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.tick-year {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.tick-year.active {
    color: var(--accent-blue);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.5);
}

/* Info Panel Thửa Đất (Góc phải dưới hoặc popup) */
.parcel-info-panel {
    position: absolute;
    top: 88px;
    right: 70px;
    width: 340px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 990;
    display: none;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
}

.parcel-info-panel.active {
    display: flex;
}

.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-rose);
}

.panel-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Coordinates HUD (Thanh hiển thị tọa độ góc trái dưới) */
.coord-hud {
    position: absolute;
    bottom: 24px;
    left: 390px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 980;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.coord-hud span b {
    color: var(--accent-blue);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: min(520px, 92vw);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 0.25s ease;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-blue);
    background: rgba(0, 210, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

/* Drag and Drop Zone */
.dropzone {
    border: 2px dashed var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(0, 210, 255, 0.03);
    transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
    background: rgba(0, 210, 255, 0.08);
    border-color: var(--accent-blue);
    transform: scale(1.01);
}

.dropzone-icon {
    font-size: 36px;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

/* Animations */
@keyframes slideInRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Custom Parcel Badge Tooltip */
.custom-parcel-badge {
    background: rgba(16, 24, 40, 0.85) !important;
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent-blue) !important;
    border-radius: var(--radius-sm) !important;
    color: #ffffff !important;
    font-size: 11px !important;
    padding: 3px 6px !important;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3) !important;
    pointer-events: none;
}
.custom-parcel-badge:before {
    display: none !important;
}
