/* Analysis Results Grid */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-height: 40px;
    overflow: hidden;
}

.analysis-item .label {
    font-weight: 600;
    color: var(--hku-dark-green);
    font-size: 0.8em;
    flex-shrink: 0;
    margin-right: 8px;
}

.analysis-item .value {
    font-weight: 700;
    color: var(--hku-green);
    font-size: 0.75em;
    word-break: break-all;
    text-align: right;
    flex: 1;
    min-width: 0;
}

.total-percentage {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background-color: var(--hku-green);
    color: white;
    border-radius: 6px;
    font-size: 1.1em;
}

.error {
    color: #dc3545;
    font-weight: 600;
    margin-top: 10px;
    padding: 8px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Analysis results header */
.analysis-results-header {
    margin-bottom: 20px;
}

.analysis-results-header h4 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

.segmentation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.legend-sky { background: #0000ff; }
.legend-greenery { background: #00ff00; }
.legend-water { background: #601986; }
.legend-building { background: #ffff00; }
.legend-road { background: #aaaaaa; }

/* Analysis card */
.analysis-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-width: 0; /* 允许收缩 */
}

.analysis-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-card-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-card-heading-row .analysis-card-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.analysis-card-heading-row .analysis-card-title {
    margin: 0;
    padding: 0;
    border: 0;
}

.result-source-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    background: #edf2f7;
    flex-shrink: 0;
}

.result-source-option {
    border: 0;
    border-radius: 5px;
    padding: 7px 12px;
    background: transparent;
    color: #4a5568;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.result-source-option:hover {
    color: #2d3748;
}

.result-source-option.active {
    background: #006341;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.global-result-view[hidden] {
    display: none !important;
}

.analysis-content {
    display: flex;
    gap: 20px;
    align-items: stretch; /* 让图片区域和数据区域高度对齐 */
}

.analysis-images-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 15px;
    flex: 1;
    min-width: 0;
    align-items: flex-start; /* 图片区域顶部对齐 */
    max-width: 100%; /* 防止溢出 */
}

.analysis-image-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.analysis-image-label {
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 500;
    flex-shrink: 0;
}

.analysis-image-box {
    width: 100%;
    aspect-ratio: 1; /* 保持正方形，以宽度为基准 */
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.analysis-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.emoji.emojia9 {
    display: inline;
    width: auto;
    height: auto;
    margin-right: 0;
    vertical-align: baseline;
    background: none;
    font-size: inherit;
    line-height: inherit;
}

.emoji.emojia9::before {
    content: '©';
}

.leaflet-control-attribution .emoji.emojia9::before {
    font-size: inherit;
}

.map-image-attribution {
    position: absolute;
    right: 4px;
    bottom: 4px;
    z-index: 2;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.3;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    color: #333;
}

.osm-image-attribution a,
.google-image-attribution a {
    color: #1a73e8;
    text-decoration: none;
}

.osm-image-attribution a {
    color: #333;
}

.osm-image-attribution a:hover,
.google-image-attribution a:hover {
    text-decoration: underline;
}

.leaflet-control-attribution .emoji.emojia9 {
    width: auto;
    height: auto;
}

.analysis-image-box:hover {
    transform: scale(1.02);
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.25);
}

.analysis-image-box.enhancement-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.analysis-image-box.enhancement-placeholder:hover {
    transform: none;
    border-color: #e2e8f0;
    box-shadow: none;
}

.analysis-image-empty-slot {
    visibility: hidden;
    pointer-events: none;
}

.google-visualization-notice {
    width: 280px;
    min-width: 280px;
    border: 1px solid #f1d58a;
    background: #fffaf0;
    color: #4a5568;
    line-height: 1.55;
}

.google-visualization-notice .analysis-data-header {
    color: #744210;
    font-size: 14px;
}

.google-visualization-notice p {
    margin: 0 0 12px;
    font-size: 12px;
}

.google-visualization-notice a {
    margin-top: auto;
    color: #006341;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ai-enhancement-btn {
    border: none;
    border-radius: 8px;
    background: #007bff;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 18px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ai-enhancement-btn:hover {
    background: #0056b3;
}

.image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: #a0aec0;
    font-size: 13px;
    text-align: center;
    padding: 10px;
}

.analysis-data-column {
    min-width: 200px;
    width: 200px; /* 固定宽度，给图片区域更多空间 */
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    flex-shrink: 0; /* 防止收缩 */
    display: flex;
    flex-direction: column;
}

.analysis-data-header {
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 12px;
    font-weight: 600;
    text-align: center;
}

.analysis-data-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1; /* 填充剩余空间 */
}

.analysis-data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.data-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #4a5568;
    font-weight: 500;
}

.class-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.data-value {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.openness-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.25;
}

.openness-value .openness-level {
    font-size: 16px;
    font-weight: 700;
}

.openness-value .openness-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}

/* Global Styles - HKU Academic Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --hku-green: #006341;
    --hku-dark-green: #004d32;
    --hku-light-green: #007b4f;
    --hku-gold: #D4AF37;
    --hku-grey: #5a5a5a;
    --hku-light-grey: #f5f5f5;
    --hku-border: #d0d0d0;
}

body {
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* HKU Header */
.hku-header {
    background: var(--hku-green);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.hku-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.lang-switcher-header {
    margin-left: auto;
    flex-shrink: 0;
    color: #fff;
}

.lang-switcher-header .lang-switcher-label {
    color: #fff;
}

.hku-logo {
    height: 60px;
    width: auto;
}

.hku-title-block {
    flex: 1;
}

.hku-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
}

.hku-subtitle {
    font-size: 14px;
    opacity: 0.9;
    color: white;
}

/* Footer */
.hku-footer {
    background: var(--hku-grey);
    color: white;
    padding: 30px 0;
    margin-top: 50px;
}

.hku-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.hku-footer h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: var(--hku-gold);
}

.hku-footer p {
    margin: 5px 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Container */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 40px 20px;
    background: var(--hku-light-grey);
}

/* Auth Box (Login/Register) */
.auth-box {
    background: white;
    padding: 40px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--hku-border);
    width: 100%;
    max-width: 450px;
}

.auth-box h1 {
    text-align: center;
    color: var(--hku-green);
    margin-bottom: 10px;
    font-size: 26px;
    font-weight: bold;
}

.auth-box h2 {
    text-align: center;
    color: var(--hku-grey);
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: normal;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--hku-green);
    box-shadow: 0 0 0 2px rgba(0, 99, 65, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

.form-group input[type="checkbox"] {
    margin-right: 5px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--hku-green);
    color: white;
    width: 100%;
}

.btn-inline-compact {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--hku-dark-green);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 99, 65, 0.3);
}

#submitBtn.btn-success {
    background: #28a745;
    color: #fff;
}

#submitBtn.btn-success:disabled {
    opacity: 0.5;
    background: #28a745;
    color: #fff;
    transform: none;
    box-shadow: none;
}

#submitBtn.btn-success.is-ready {
    opacity: 1;
    background: #28a745;
    color: #fff;
}

#submitBtn.btn-success.is-ready:disabled {
    opacity: 1;
}

#submitBtn.btn-success.is-ready:not(:disabled):hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.35);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-upload {
    background: var(--hku-green);
    color: white;
    font-size: 16px;
    padding: 15px 30px;
}

.btn-upload:hover {
    background: var(--hku-dark-green);
}

.btn .icon {
    font-size: 18px;
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: 20px;
}

.form-footer p {
    color: #666;
    font-size: 14px;
}

.form-footer a {
    color: var(--hku-green);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
    color: var(--hku-dark-green);
}

/* Message Box */
.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 5px;
    font-size: 14px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid var(--hku-green);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    color: var(--hku-green);
    font-size: 20px;
    font-weight: bold;
}

.nav-links {
    display: flex;
    gap: 5px;
}

.nav-links a {
    color: var(--hku-grey);
    text-decoration: none;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 3px;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--hku-green);
    color: white;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 3px;
    color: var(--hku-grey);
    font-size: 14px;
}

.lang-switcher select {
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    padding: 6px 8px;
    background: #fff;
    color: #2d3748;
    font-size: 13px;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    background: white;
    min-height: calc(100vh - 250px);
}

/* Welcome Section */
.welcome-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.welcome-title-block h2 {
    color: #333;
    margin-bottom: 10px;
}

.welcome-title-block p {
    color: #666;
    margin: 0;
}

.welcome-quota-block {
    display: flex;
    gap: 28px;
    flex-shrink: 0;
    text-align: right;
}

.welcome-quota-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.welcome-quota-label {
    font-size: 12px;
    color: #718096;
    line-height: 1.3;
}

.welcome-quota-value {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
}

.welcome-section h2 {
    color: #333;
    margin-bottom: 10px;
}

.welcome-section p {
    color: #666;
}

.membership-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    vertical-align: middle;
}

.membership-badge.vip {
    color: #7a4b00;
    background: #ffe7a3;
}

.membership-badge.free {
    color: #2d3748;
    background: #e2e8f0;
}

/* Upload Section */
.upload-section,
.submit-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.map-scope-prompt {
    margin: 0 0 20px;
    padding: 14px 16px;
    background: #fffaf0;
    border: 1px solid #f6ad55;
    border-radius: 8px;
    color: #c05621;
    font-size: 14px;
}

.section-title {
    margin-bottom: 18px;
    color: #2d3748;
}

.mode-selector {
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.map-selection-container {
    margin-top: 20px;
}

.map-controls-hint {
    margin: 12px 0;
    padding: 12px 14px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #4a5568;
    font-size: 13px;
    line-height: 1.5;
}

.map-controls-hint strong {
    color: #2d3748;
}

.map-controls-hint ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.map-controls-hint li {
    margin: 2px 0;
}

.map-controls-hint-inline {
    flex-shrink: 0;
    margin: 0 0 10px;
    padding: 0;
    background: transparent;
    border: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 11px;
    color: #718096;
    line-height: 1.45;
}

.map-controls-hint-inline ul {
    margin: 0;
    padding-left: 16px;
}

.map-controls-hint-inline strong {
    color: #4a5568;
    font-family: inherit;
    font-weight: 600;
}

.map-records-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.cesium-selection-layout {
    display: flex;
    gap: 15px;
}

.cesium-map-frame {
    flex: 2;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.cesium-records-panel {
    flex: 1;
    max-height: 600px;
}

.map-selection-header,
.map-selection-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background: #edf2f7;
    border-radius: 8px;
}

.map-selection-header h3,
.map-selection-header p,
.map-selection-records h4 {
    margin: 0;
}

.map-selection-header p {
    margin-top: 6px;
    color: #4a5568;
}

.map-floor-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.map-floor-label {
    color: #e53e3e;
    font-weight: 700;
}

.map-floor-field input {
    width: 80px;
    padding: 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
}

.map-selection-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 15px;
    margin: 15px 0;
}

.map-search-panel {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.map-scope-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.map-scope-label {
    color: #4a5568;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.map-scope-field select {
    min-width: 140px;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: #fff;
    color: #2d3748;
}

.map-search-panel input {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
}

.map-search-panel .btn {
    width: auto;
}

.map-search-results {
    display: none;
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-top: 0;
    border-radius: 0 0 6px 6px;
    background: white;
}

.map-search-result {
    width: 100%;
    padding: 10px;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    text-align: left;
    cursor: pointer;
}

.map-search-result:hover {
    background: #edf2f7;
}

.map-search-result strong,
.map-search-result span {
    display: block;
}

.map-search-result span {
    margin-top: 2px;
    color: #718096;
    font-size: 11px;
}

.main-map-2d {
    height: 560px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    z-index: 0;
}

.map-selection-records {
    display: flex;
    flex-direction: column;
    max-height: 560px;
    overflow: hidden;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.map-records-bottom-action {
    margin-top: 12px;
    display: flex;
    justify-content: flex-start;
    flex-shrink: 0;
}

.map-selection-records h4 {
    flex-shrink: 0;
    margin-bottom: 8px;
    color: #2d3748;
}

.map-record-card {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
}

.map-record-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.map-record-actions {
    display: flex;
    gap: 6px;
}

.map-record-edit {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    color: #2f855a;
    background: #c6f6d5;
    cursor: pointer;
    font-size: 12px;
}

.map-record-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.map-record-meta {
    color: #4a5568;
    font-size: 12px;
    line-height: 1.4;
}

.map-record-footer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.map-record-copy {
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    color: #4a5568;
    background: #edf2f7;
    cursor: pointer;
    font-size: 12px;
}

.map-popup-action {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    color: #2b6cb0;
    background: #bee3f8;
    cursor: pointer;
    font-size: 12px;
}

.map-record-locate {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    color: #2b6cb0;
    background: #bee3f8;
    cursor: pointer;
    font-size: 12px;
}

.map-record-detail {
    color: #4a5568;
    font-size: 12px;
    line-height: 1.5;
}

.map-record-delete {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    color: #c53030;
    background: #fed7d7;
    cursor: pointer;
    font-size: 12px;
}

.map-record-detail-btn {
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    color: #2d3748;
    background: #e2e8f0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.map-record-status {
    font-size: 12px;
    margin-bottom: 8px;
}

.map-record-status-pending {
    color: #2b6cb0;
}

.map-record-status-failed {
    color: #c53030;
}

.cesium-record-detail-grid {
    display: grid;
    gap: 10px;
}

.cesium-record-detail-grid > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
    color: #4a5568;
}

.cesium-record-detail-grid strong {
    color: #2d3748;
    text-align: right;
}

.map-empty-records {
    margin-top: 50px;
    color: #a0aec0;
    text-align: center;
}

.map-selection-footer {
    color: #718096;
}

@media (max-width: 900px) {
    .map-selection-layout {
        grid-template-columns: 1fr;
    }

    .cesium-selection-layout {
        flex-direction: column;
    }

    .main-map-2d,
    .map-selection-records,
    .cesium-records-panel {
        height: 440px;
        max-height: 440px;
    }
}

.mode-option:last-child {
    margin-bottom: 0;
}

.mode-option input {
    width: 18px;
    height: 18px;
}

.mode-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.mode-content strong {
    color: #2d3748;
    font-size: 15px;
}

.mode-title-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.mode-title-row .mode-limit {
    margin: 0 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    color: #2d3748;
    background: #e2e8f0;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.mode-content span {
    color: #718096;
    font-size: 13px;
    margin-top: 2px;
}

.mode-guide {
    display: none;
    padding: 6px 12px;
    background: #edf2f7;
    color: #2d3748;
    border-radius: 5px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.guide-viewer-container {
    padding-bottom: 40px;
}

.guide-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.guide-nav-btn {
    width: auto;
    min-width: 110px;
}

.guide-page-info {
    min-width: 120px;
    text-align: center;
    font-weight: 600;
    color: #2d3748;
}

.guide-viewer-stage {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 480px;
    padding: 20px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    position: relative;
}

#guideCanvas {
    display: none;
    max-width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.guide-viewer-loading,
.guide-viewer-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4a5568;
    font-size: 16px;
}

.guide-viewer-error {
    color: #c53030;
}

.mode-guide.user-guide {
    display: inline-flex;
    align-items: center;
}

.mode-guide:hover {
    background: #e2e8f0;
}

.mode-warning {
    padding: 4px 9px;
    background: #fff3cd;
    color: #856404 !important;
    border: 1px solid #ffeeba;
    border-radius: 999px;
    font-size: 11px !important;
    font-weight: 700;
    line-height: 1;
    margin-top: 0 !important;
}

.mode-scope-select {
    padding: 4px 10px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
    cursor: pointer;
}

.mode-scope-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #edf2f7;
    color: #a0aec0;
    border-color: #e2e8f0;
}

.disclaimer-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
}

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

.disclaimer-content {
    width: 680px;
    max-width: 92vw;
    max-height: 82vh;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    padding: 16px;
}

.disclaimer-content h3 {
    margin-bottom: 10px;
    color: #2d3748;
}

.disclaimer-content h4 {
    margin: 14px 0 8px 0;
    color: #2d3748;
}

.disclaimer-scroll {
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid #cbd5e0;
    padding: 12px;
    font-size: 13px;
    line-height: 1.55;
    color: #2d3748;
    background: #fff;
}

.disclaimer-scroll p {
    margin-bottom: 12px;
}

.disclaimer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.disclaimer-actions .btn {
    width: auto;
    padding: 8px 18px;
}

.upload-box {
    text-align: center;
    padding: 40px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    margin-bottom: 20px;
}

.upload-hint {
    margin-top: 15px;
    color: #999;
    font-size: 14px;
}

/* File List */
.file-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.file-list-toolbar {
    margin: 20px 0 10px 0;
    padding: 12px 15px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #4a5568;
    font-size: 14px;
}

.file-list-toolbar .btn {
    width: auto;
    padding: 7px 14px;
    font-size: 13px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.file-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

/* File thumbnail preview */
.file-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-thumbnail:hover {
    transform: scale(1.05);
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image preview modal */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.image-preview-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.image-preview-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.image-preview-content img {
    display: block;
    width: min(90vw, 800px);
    max-height: 85vh;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: bold;
}

.image-preview-close:hover {
    background: #dc3545;
    color: white;
    transform: rotate(90deg);
}

.image-preview-info {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 14px;
    padding: 10px;
}

/* Result thumbnails */
.result-thumbnail:hover {
    transform: scale(1.02);
    border-color: #007bff !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* File icon container for CSV files */
.file-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 15px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 24px;
}

.file-name {
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.remove-file {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.remove-file:hover {
    background: #c82333;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    align-items: center;
    margin-top: 20px;
}

.submit-section .action-buttons {
    margin-top: 0;
}

#submitBtn {
    width: auto;
}

#cancelBtn {
    margin-left: auto;
}

input[type="number"] {
    appearance: auto;
    -moz-appearance: auto;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    display: block;
}

.analysis-image-label-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ai-enhancement-title-btn {
    border: 0;
    border-radius: 6px;
    background: #007bff;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
}

.ai-enhancement-title-btn:hover {
    background: #0056b3;
}

.enhancement-placeholder-text {
    color: #718096;
    font-size: 13px;
    text-align: center;
    padding: 0 16px;
}

.enhancement-generating-text {
    color: #c53030;
    font-weight: 600;
}

/* Status Section */
.status-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.status-section h3,
.status-section-heading {
    margin-bottom: 20px;
    color: #333;
}

.status-section-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 8px;
}

.input-source-label {
    color: #3182ce;
    font-size: 14px;
    font-weight: 600;
}

.processing-global-notice {
    color: #c53030;
    font-size: 14px;
    font-weight: 600;
    margin: -8px 0 16px;
}

.analysis-card-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-card-title-row .analysis-card-title {
    margin: 0;
    padding: 0;
    border: 0;
}

.status-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.status-bar-fill {
    height: 100%;
    background: var(--hku-green);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.status-info p {
    color: #666;
    margin-bottom: 5px;
}

/* Results Section */
.results-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.results-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.download-controls {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.download-controls .btn {
    width: auto;
}

#resultsContainer {
    max-height: 1200px; /* 增加高度限制，允许显示更大的分析结果 */
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 15px;
}

.result-item h4 {
    color: var(--hku-green);
    margin-bottom: 10px;
    font-weight: bold;
}

.result-item p {
    color: #666;
    margin-bottom: 5px;
}

.result-empty-state {
    padding: 28px;
    text-align: center;
    color: #718096;
    background: #f7fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 8px;
}

/* Profile Section */
.profile-header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.profile-info {
    margin-top: 20px;
}

.profile-info p {
    margin-bottom: 10px;
    color: #666;
}

.profile-info strong {
    color: #333;
    margin-right: 10px;
}

/* Statistics Section */
.statistics-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.statistics-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--hku-green);
    padding: 30px;
    border-radius: 5px;
    text-align: center;
    color: white;
    border: 1px solid var(--hku-dark-green);
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* History Section */
.history-section,
.activity-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-section h3,
.activity-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.table-container {
    overflow-x: auto;
}

.history-table,
.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td,
.activity-table th,
.activity-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.history-table th,
.activity-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
}

.history-table td,
.activity-table td {
    color: #666;
}

.no-data {
    text-align: center !important;
    color: #999 !important;
    padding: 40px !important;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.pending {
    background: #ffc107;
    color: #000;
}

.status-badge.processing {
    background: #17a2b8;
    color: white;
}

.status-badge.completed {
    background: #28a745;
    color: white;
}

.status-badge.failed {
    background: #dc3545;
    color: white;
}

.action-link {
    color: var(--hku-green);
    text-decoration: none;
    font-size: 12px;
    margin-right: 10px;
}

.action-link:hover {
    text-decoration: underline;
    color: var(--hku-dark-green);
}

/* Admin Dashboard */
.admin-header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.admin-header h2 {
    color: #333;
    margin-bottom: 10px;
}

.admin-header p {
    color: #666;
}

.filter-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.filter-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.filter-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-controls input,
.filter-controls select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.filter-controls input[type="text"] {
    flex: 1;
    min-width: 200px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    position: relative;
}

/* Guide Pages */
.guide-page {
    background: #f5f5f5;
}

.guide-page .main-container {
    max-width: 980px;
}

.guide-card {
    border-top: 6px solid #222;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.guide-card h2 {
    font-size: 30px;
    color: #111;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.guide-pdf-button {
    float: right;
    width: auto;
    margin-left: 15px;
}

@media print {
    .guide-page {
        background: white;
    }

    .guide-page .main-container {
        max-width: none;
        padding: 0;
    }

    .guide-card {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .guide-pdf-button,
    .guide-image-preview {
        display: none !important;
    }

    .guide-card li,
    .guide-screenshot,
    .guide-screenshot-grid {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

.guide-card h3 {
    margin-top: 28px !important;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: #f2f2f2;
    color: #111;
    border-left: 5px solid #333;
    border-radius: 6px;
    font-size: 19px;
}

.guide-card h4 {
    margin-top: 22px;
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 16px;
}

.guide-card p {
    color: #4a5568;
    font-size: 15px;
    line-height: 1.7;
    margin: 8px 0;
}

.guide-card ul,
.guide-card ol {
    background: #fbfcfd;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px 16px 34px !important;
    margin-top: 12px;
}

.guide-card li {
    color: #4a5568;
    line-height: 1.7;
    margin-bottom: 8px;
}

.guide-card strong {
    color: #111;
}

.guide-card p:has(> strong:first-child) {
    background: #fafafa;
    border: 1px solid #ddd;
    border-left: 5px solid #666;
    border-radius: 6px;
    padding: 10px 12px;
    color: #333;
}

.guide-card a.btn {
    margin-top: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.guide-screenshot {
    margin-top: 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    overflow: hidden;
}

.guide-screenshot img {
    width: 100%;
    display: block;
    border-radius: 5px;
    cursor: zoom-in;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.guide-screenshot img:hover {
    opacity: 0.92;
    transform: scale(1.01);
}

.guide-screenshot-small {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.guide-screenshot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 760px) {
    .guide-screenshot-grid {
        grid-template-columns: 1fr;
    }
}

.guide-image-preview {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    padding: 24px;
}

.guide-image-preview.active {
    display: flex;
}

.guide-image-preview img {
    max-width: 96vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
}

.guide-image-preview-close {
    position: fixed;
    top: 18px;
    right: 26px;
    color: #fff;
    font-size: 34px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

.openness-intro {
    margin-bottom: 10px;
    text-align: center;
}

.openness-intro h2,
.openness-intro p {
    text-align: center;
}

.openness-scale-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin: 20px 0 40px;
}

.openness-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.openness-card-image {
    aspect-ratio: 4 / 3;
    background: #edf2f7;
    overflow: hidden;
    cursor: pointer;
}

.openness-card-image picture,
.openness-card-image img {
    width: 100%;
    height: 100%;
    display: block;
}

.openness-card-image img {
    object-fit: cover;
}

.openness-card-body {
    padding: 14px 12px 16px;
    text-align: center;
}

.openness-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.openness-rank-1 { background: #9b2c2c; }
.openness-rank-2 { background: #c05621; }
.openness-rank-3 { background: #fef08a; color: #744210; }
.openness-rank-4 { background: #2f855a; }
.openness-rank-5 { background: #276749; }

.openness-card-body h3 {
    margin: 0;
    font-size: 15px;
    color: #2d3748;
    font-weight: 600;
    line-height: 1.3;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
    }

    .filter-controls input,
    .filter-controls select {
        width: 100%;
    }

    .openness-scale-grid {
        grid-template-columns: 1fr;
    }

    .analysis-card-heading-row,
    .analysis-content {
        flex-direction: column;
        align-items: stretch;
    }

    .result-source-switch {
        align-self: flex-start;
    }

    .analysis-data-column,
    .google-visualization-notice {
        width: 100%;
        min-width: 0;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .openness-scale-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
