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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    color: #333;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 600;
}

.developer-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.25rem;
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 0.25rem;
    background: rgba(255,255,255,0.15);
    padding: 0.25rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.header-btn {
    background: transparent;
    color: rgba(255,255,255,0.8);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.header-btn.active {
    background: rgba(255,255,255,0.95);
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 頁面容器 */
.page-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.page {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f5f5f5;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h2 {
    color: #667eea;
    margin: 0;
    font-size: 1.5rem;
}

/* 地圖頁面特殊樣式 */
#map-page .map-container {
    height: calc(100vh - 200px);
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
}

.map-controls {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    padding: 0.75rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    flex-wrap: wrap;
    align-items: center;
}

/* 地圖村別篩選器樣式 */
.map-layer-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.map-layer-selector label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.map-layer-selector select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
    min-width: 200px;
}

.map-village-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.map-village-filter label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.map-village-filter select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    min-width: 120px;
}

.map-village-filter select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 列表頁面特殊樣式 */
.list-controls {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 統計頁面特殊樣式 */
#stats-page {
    background: #f8f9fa;
}

/* 照片預覽容器 */
.photo-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* 照片疊加顯示 */
.photo-preview-container.stacked {
    display: block;
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0.5rem auto;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 疊加顯示的照片項目 */
.photo-preview-container.stacked .photo-preview-item {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.photo-preview-container.stacked .photo-preview-item:not(:first-child) {
    z-index: 0;
    transform: translate(2px, 2px);
    opacity: 0.7;
}

.photo-preview-container.stacked .photo-preview-item:hover {
    z-index: 10;
    transform: translate(0, 0);
    opacity: 1;
}

.photo-preview-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .delete-photo {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview-item .delete-photo:hover {
    background: rgba(255, 0, 0, 1);
}

/* 照片計數顯示 */
.photo-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 20;
}

/* 照片瀏覽器樣式 */
.photo-viewer-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
}

.photo-viewer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.photo-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.photo-nav button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.photo-nav span {
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: center;
}

.photo-display {
    max-width: 100%;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.photo-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.photo-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.photo-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* 照片畫廊樣式 */
.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* 詳情頁面照片疊加顯示 */
.photo-gallery.stacked {
    display: block;
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.gallery-photo {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
}

/* 疊加顯示的照片 */
.photo-gallery.stacked .gallery-photo {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.photo-gallery.stacked .gallery-photo:not(:first-child) {
    z-index: 0;
    transform: translate(3px, 3px);
    opacity: 0.7;
}

.photo-gallery.stacked .gallery-photo:hover {
    z-index: 10;
    transform: translate(0, 0);
    opacity: 1;
}

.gallery-photo:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

/* 詳情頁面照片計數徽章 */
.detail-photo-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 20;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 400px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f5f5f5;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    font-weight: bold;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-bottom: 1rem;
    color: #667eea;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.checkbox-group label:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #667eea;
}

.coord-status {
    color: #ff9800;
    font-size: 0.9rem;
}

.coord-status.success {
    color: #4CAF50;
    font-weight: 600;
}

#coord-display {
    background: #e8f5e9;
    padding: 0.75rem;
    border-radius: 8px;
    font-family: monospace;
}

#photo-preview img {
    max-width: 100%;
    margin-top: 0.5rem;
    border-radius: 8px;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* 按鈕樣式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: #667eea;
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-blue {
    background: #2196F3;
    color: white;
    flex: 1;
}

.btn-green {
    background: #4CAF50;
    color: white;
    flex: 1;
}

.btn-red {
    background: #f44336;
    color: white;
    flex: 1;
}

.btn-orange {
    background: #ff9800;
    color: white;
    flex: 1;
}

/* 搜尋和篩選 */
.search-box input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filters select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.filter-tags, .status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-tag {
    padding: 0.5rem 1rem;
    border: none;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.filter-tag:hover {
    background: #e0e0e0;
}

.filter-tag.active {
    background: #667eea;
    color: white;
}

/* 標記列表 */
.marker-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.marker-card {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.marker-card:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.marker-content {
    flex: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.marker-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.btn-edit {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.btn-edit:hover {
    background: #1976D2;
    transform: scale(1.1);
}

.marker-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.marker-type {
    font-size: 1.5rem;
}

.marker-severity {
    font-size: 1.2rem;
}

.marker-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.marker-village {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.marker-desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.marker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: #e3f2fd;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* 資料操作按鈕 */
.data-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

/* 統計儀表板 */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 1.25rem 1rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #333;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.progress-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.progress-section h3 {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.5s;
}

.stats-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.stats-section h3 {
    margin-bottom: 1rem;
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* 類型統計行樣式 */
.type-stat-row {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
}

/* 村別詳細信息樣式 */
.village-detail {
    margin-left: 0.5rem;
    margin-bottom: 0.3rem;
    padding: 0.3rem;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 2px solid #4caf50;
}

.village-header {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
}

.location-list {
    margin-left: 0.3rem;
}

.location-item {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.1rem;
    padding-left: 0.3rem;
    border-left: 1px solid #e0e0e0;
}

/* 複製按鈕樣式 */
.copy-btn {
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 0.5rem;
}

.copy-btn:hover {
    background: #45a049;
}

.copy-btn:active {
    background: #3d8b40;
}

.stat-label-text {
    min-width: 120px;
}

.stat-bar {
    flex: 1;
    height: 25px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 0.5rem;
}

.stat-bar-fill {
    height: 100%;
    transition: width 0.5s;
}

/* 地圖容器 */
.map-container {
    flex: 1;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

#map {
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

.map-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 90%;
    text-align: center;
    line-height: 1.4;
}

.map-hint::before {
    content: '💡';
    margin-right: 0.5rem;
}

/* 彈窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 0;
}

/* 防止背景滾動 - iOS Safari優化 */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

/* iOS Safari滾動優化 */
body {
    -webkit-overflow-scrolling: touch;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: fixed;
    right: 1rem;
    top: 1rem;
    font-size: 2.2rem;
    cursor: pointer;
    color: white;
    z-index: 10001;
    background: #ff4444;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    border: 4px solid white;
    font-weight: bold;
    line-height: 1;
}

.close:hover {
    background: #ff6666;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.detail-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-label {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.status-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-left: 0.5rem;
}

/* 編輯彈窗特殊樣式 */
#edit-modal .modal-content {
    max-width: 700px;
    max-height: 90vh;
}

#edit-modal .form-group {
    margin-bottom: 1.25rem;
}

#edit-modal .form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

#edit-photo-preview img {
    max-width: 100%;
    margin-top: 0.5rem;
    border-radius: 8px;
    border: 2px solid #ddd;
}

#edit-coord-display {
    background: #e8f5e9;
    padding: 0.75rem;
    border-radius: 8px;
    font-family: monospace;
    margin-top: 0.5rem;
}

/* Safari和iOS特殊優化 */
@supports (-webkit-touch-callout: none) {
    /* 只在iOS Safari上應用 */
    .marker-card, .btn, .filter-tag {
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 防止iOS Safari的橡皮筋效果 */
    .sidebar, .map-container {
        overscroll-behavior: contain;
    }
    
    /* iOS Safari輸入框優化 */
    input, select, textarea {
        -webkit-appearance: none;
        border-radius: 8px;
    }
}

/* 通用Safari優化 */
* {
    -webkit-tap-highlight-color: transparent;
}

/* 確保所有互動元素都有適當的觸控目標 */
.btn, .filter-tag, .tab-btn, .btn-edit {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* 修復Safari上的彈窗滾動問題 */
.modal-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* 修復Safari上的表單元素 */
input[type="text"], input[type="file"], select, textarea {
    -webkit-appearance: none;
    border-radius: 8px;
    background-color: white;
}

/* 修復Safari上的按鈕樣式 */
button {
    -webkit-appearance: none;
    border: none;
    background: none;
    cursor: pointer;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        min-height: auto;
    }
    
    .header h1 {
        font-size: 1.2rem;
        text-align: center;
        margin: 0;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.25rem;
    }
    
    .header-btn {
        flex: 1;
        text-align: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        border-radius: 12px;
        min-height: 48px;
    }
    
    .page {
        padding: 0.75rem;
        padding-top: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .page-header h2 {
        text-align: center;
        font-size: 1.25rem;
        margin: 0;
        order: 1;
    }
    
.page-header .header-actions {
    order: 2;
    gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    padding: 0.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.page-header .header-actions .btn {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-height: 36px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.page-header .header-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
    
    #map-page .map-container {
        height: calc(100vh - 280px);
        min-height: 300px;
        border-radius: 16px;
    }
    
    .map-controls {
        flex-direction: row;
        gap: 0.75rem;
        margin-top: 0.75rem;
        justify-content: center;
    }
    
    .map-controls .btn {
        flex: 1;
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    /* 列表頁面優化 */
    .list-controls {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-radius: 16px;
    }
    
    .search-box {
        margin-bottom: 1rem;
    }
    
    .search-box input {
        padding: 1rem;
        font-size: 16px;
        border-radius: 12px;
        min-height: 48px;
    }
    
    .filters {
        margin-bottom: 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filters label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .filters select {
        padding: 0.75rem;
        font-size: 16px;
        border-radius: 12px;
        min-height: 48px;
    }
    
    .filter-tags {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .filter-tag {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border-radius: 20px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .status-filters {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .status-filters .filter-tag {
        flex: 1;
        text-align: center;
    }
    
    /* 標記卡片優化 */
    .marker-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-radius: 16px;
    }
    
    .marker-name {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .marker-desc {
        font-size: 0.95rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }
    
    .marker-tags {
        gap: 0.5rem;
    }
    
    .tag {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border-radius: 12px;
        min-height: 32px;
    }
    
    .btn-edit {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    /* 數據操作按鈕 */
    .data-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    .data-actions .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 12px;
    }
    
    /* 統計頁面優化 */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* 手機端表單優化 */
    .form-group input[type="text"],
    .form-group input[type="file"],
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 防止iOS自動縮放 */
        padding: 1rem;
    }
    
    /* 手機端按鈕優化 */
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        min-height: 48px; /* 確保觸控目標足夠大 */
    }
    
    .btn-edit {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
    
    /* 手機端標記卡片優化 */
    .marker-card {
        padding: 1.25rem;
    }
    
    .marker-name {
        font-size: 1.2rem;
    }
    
    .marker-desc {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    /* 手機端篩選器優化 */
    .filter-tags, .status-filters {
        gap: 0.75rem;
    }
    
    .filter-tag {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* 手機端搜尋框優化 */
    .search-box input {
        padding: 1rem;
        font-size: 16px;
        min-height: 48px;
    }
    
    /* 手機端彈窗優化 */
    .modal {
        padding: 0;
        background: rgba(0,0,0,0.6);
    }
    
    .modal-content {
        margin: 0;
        max-width: 100%;
        max-height: calc(100vh - 1rem);
        padding: 0;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(0);
        animation: slideUp 0.3s ease-out;
        background: white;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .modal-header {
        position: relative;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 20px 20px 0 0;
        padding: 1.5rem 1rem 1rem 1rem;
        flex-shrink: 0;
        z-index: 10;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .modal-header h2 {
        color: white !important;
        -webkit-text-fill-color: white !important;
        text-shadow: 0 2px 8px rgba(0,0,0,0.5);
        margin: 0;
        font-size: 1.4rem;
        font-weight: bold;
        text-align: center;
        flex: 1;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
        max-height: calc(100vh - 200px);
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .modal-content h2 {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
        text-align: center;
        color: #667eea;
        font-weight: 700;
        padding-top: 1rem;
        padding-bottom: 0.5rem;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .form-group {
        margin-bottom: 1.25rem;
        position: relative;
        z-index: 2;
        margin-top: 1rem;
    }
    
    .form-actions {
        position: relative;
        z-index: 2;
        margin-top: 1rem;
    }
    
    /* 確保表單內容在標題區域下方 */
    #disaster-form {
        margin-top: 2rem;
        position: relative;
        z-index: 2;
        padding-top: 1rem;
    }
    
    .form-group label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }
    
    .form-group input[type="text"],
    .form-group input[type="file"],
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 1rem;
        border-radius: 12px;
        min-height: 48px;
    }
    
    .resource-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .resource-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem;
        background: #f8f9fa;
        border-radius: 16px;
        border: 2px solid transparent;
        transition: all 0.2s ease;
        min-height: 52px;
    }
    
    .resource-item:hover {
        background: #e9ecef;
        border-color: #667eea;
    }
    
    .resource-item:has(input[type="checkbox"]:checked) {
        background: #e3f2fd;
        border-color: #667eea;
        color: #1976d2;
    }
    
    .resource-item label {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-weight: normal;
        margin-bottom: 0;
        cursor: pointer;
        flex: 1;
    }
    
    .resource-item input[type="number"] {
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 0.5rem;
        font-size: 0.9rem;
        text-align: center;
    }
    
    .resource-item input[type="number"]:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    }
    
    .equipment-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.5rem;
        padding: 0.75rem;
        background-color: #f9f9f9;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
    }
    
    .equipment-item {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.6rem;
        background-color: white;
        border-radius: 6px;
        border: 1px solid #ddd;
        transition: all 0.2s;
        font-size: 0.9rem;
    }
    
    .equipment-item label {
        display: flex;
        align-items: center;
        cursor: pointer;
    }
    
    .equipment-item:hover {
        background-color: #f0f8ff;
        border-color: #4CAF50;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .equipment-item input[type="checkbox"] {
        margin-right: 0.4rem;
        cursor: pointer;
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .equipment-item:has(input[type="checkbox"]:checked) {
        background-color: #e8f5e9;
        border-color: #4CAF50;
        font-weight: 500;
    }
    
    .qty-input {
        width: 100%;
        padding: 0.4rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 0.85rem;
        text-align: center;
        transition: all 0.2s;
    }
    
    .qty-input:focus {
        outline: none;
        border-color: #4CAF50;
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    }
    
    .equipment-item:has(input[type="checkbox"]:not(:checked)) .qty-input {
        background-color: #f5f5f5;
        color: #999;
        pointer-events: none;
    }
    
    .equipment-item input[type="checkbox"] {
        margin-right: 0.4rem;
        cursor: pointer;
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .custom-equipment-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
        min-height: 0;
    }
    
    .custom-equipment-tag {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        background-color: #e3f2fd;
        border: 1px solid #2196F3;
        border-radius: 20px;
        font-size: 0.9rem;
        color: #1976d2;
    }
    
    .remove-custom-equipment {
        background: none;
        border: none;
        color: #f44336;
        font-size: 1.2rem;
        cursor: pointer;
        padding: 0;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s;
    }
    
    .remove-custom-equipment:hover {
        background-color: #ffebee;
    }
    
    .custom-equipment-add {
        margin-top: 10px;
        padding: 10px;
        background-color: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 6px;
    }
    
    .custom-equipment-row {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    
    .custom-equipment-name {
        flex: 6;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        min-width: 0;
    }
    
    .custom-equipment-qty {
        width: 35px;
        padding: 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        text-align: center;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .custom-equipment-btn {
        padding: 8px 12px;
        border: 1px solid #6c757d;
        border-radius: 4px;
        background: #6c757d;
        color: white;
        cursor: pointer;
        white-space: nowrap;
        font-size: 14px;
    }
    
    .custom-equipment-btn:hover {
        background: #5a6268;
    }
    
    /* 手机端响应式调整 */
    @media (max-width: 768px) {
        .custom-equipment-row {
            flex-direction: column;
            gap: 8px;
        }
        
        .custom-equipment-name {
            flex: none;
            width: 100%;
        }
        
        .custom-equipment-qty {
            width: 80px;
            align-self: flex-start;
        }
        
        .custom-equipment-btn {
            align-self: flex-start;
            width: auto;
        }
    }
    
    .coord-actions {
        display: flex;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    .coord-actions .btn {
        flex: 1;
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
        border-radius: 12px;
        font-weight: 500;
    }
    
    .checkbox-group label:hover {
        background: #e9ecef;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin: 0;
        cursor: pointer;
        accent-color: #667eea;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
        padding-top: 1rem;
        border-top: 1px solid #e0e0e0;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 1.2rem;
        font-size: 1.1rem;
        min-height: 52px;
        border-radius: 16px;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .form-actions .btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
    }
    
    .form-actions .btn-secondary {
        background: #f8f9fa;
        color: #495057;
        border: 2px solid #dee2e6;
    }
    
    .close {
        position: absolute;
        font-size: 2.5rem;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: #ff2222;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        border: 4px solid white;
        box-shadow: 0 8px 32px rgba(0,0,0,0.8);
        font-weight: bold;
        z-index: 10001;
        line-height: 1;
        cursor: pointer;
        animation: pulse 1.5s infinite;
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }
    
    @keyframes pulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.05); }
        100% { transform: scale(1); }
    }
    
    /* 臨時標記樣式 */
    .temp-marker-icon {
        z-index: 1000 !important;
        pointer-events: none !important;
    }
    
    .temp-marker-icon .leaflet-marker-icon {
        z-index: 1000 !important;
        pointer-events: none !important;
    }
    
    /* 確保臨時標記在地圖上可見 */
    .leaflet-marker-pane .temp-marker-icon {
        z-index: 1000 !important;
    }
    
    /* 臨時標記脈動動畫 - 只對內部div應用 */
    .temp-marker-icon .leaflet-marker-icon > div {
        animation: markerPulse 1.5s infinite !important;
    }
    
    @keyframes markerPulse {
        0% { 
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
            box-shadow: 0 6px 20px rgba(255,68,68,0.6);
        }
        50% { 
            transform: translate(-50%, -50%) scale(1.3);
            opacity: 0.9;
            box-shadow: 0 8px 30px rgba(255,68,68,0.8);
        }
        100% { 
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
            box-shadow: 0 6px 20px rgba(255,68,68,0.6);
        }
    }
    
    #edit-modal .modal-content {
        max-width: 100%;
        max-height: calc(100vh - 1rem);
    }
    
    /* 手機端分頁優化 */
    .tab-btn {
        padding: 1.25rem 0.75rem;
        font-size: 1rem;
        min-height: 48px;
    }
    
    /* 手機端地圖提示優化 */
    .map-hint {
        font-size: 1rem;
        padding: 1rem 1.5rem;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100% - 2rem);
        text-align: center;
    }
    
    /* 手機端關閉按鈕優化 */
    .close {
        font-size: 2.5rem;
        right: 1rem;
        top: 1rem;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255,255,255,0.9);
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    .close:hover {
        background: rgba(255,255,255,1);
        transform: scale(1.1);
    }
    
    /* 手機端資料操作按鈕優化 */
    .data-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .data-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    /* 手機端表單動作按鈕優化 */
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* 手機端標籤優化 */
    .tag {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-height: 32px;
        display: flex;
        align-items: center;
    }
    
    /* 手機端統計區域優化 */
    .stats-section {
        padding: 1rem;
    }
    
    .stats-section h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .progress-section {
        padding: 1rem;
    }
    
    .progress-section h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    /* 手機端標題優化 */
    .header h1 {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .tab-content h2 {
        font-size: 1.3rem;
        margin-bottom: 1.25rem;
    }
}

/* 超小螢幕優化 */
@media (max-width: 480px) {
    .header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .header-btn {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    .page {
        padding: 0.5rem;
        padding-top: 0.75rem;
    }
    
    .page-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        gap: 0.75rem;
    }
    
    .page-header h2 {
        font-size: 1.1rem;
    }
    
    .page-header .header-actions .btn {
        padding: 0.6rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    #map-page .map-container {
        height: calc(100vh - 250px);
        min-height: 250px;
        border-radius: 12px;
    }
    
    .map-controls .btn {
        padding: 0.6rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .list-controls {
        padding: 0.5rem;
        margin-bottom: 0.4rem;
        border-radius: 8px;
        display: flex;
        flex-direction: row;
        gap: 0.4rem;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .search-box {
        flex: 1;
        min-width: 120px;
    }
    
    .search-box input {
        padding: 0.5rem;
        font-size: 14px;
        min-height: 36px;
        border-radius: 6px;
    }
    
    .filters {
        display: flex;
        flex-direction: row;
        gap: 0.4rem;
        flex-wrap: wrap;
        align-items: center;
        flex: 1;
    }
    
    .filter-group {
        display: flex;
        flex-direction: row;
        gap: 0.3rem;
        align-items: center;
        min-width: 80px;
    }
    
    .filter-group label {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .filters select {
        padding: 0.4rem;
        font-size: 14px;
        min-height: 36px;
        border-radius: 6px;
        flex: 1;
    }
    
    .filter-tag {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        border-radius: 16px;
        min-height: 40px;
    }
    
    .marker-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 12px;
    }
    
    .marker-name {
        font-size: 1rem;
    }
    
    .marker-desc {
        font-size: 0.9rem;
    }
    
    .tag {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 10px;
        min-height: 28px;
    }
    
    .btn-edit {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .data-actions .btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-height: 36px;
        border-radius: 8px;
        flex: 1;
        min-width: 80px;
    }
    
    .stat-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
        margin-bottom: 0.3rem;
    }
    
    .stat-card {
        padding: 0.3rem;
        border-radius: 4px;
        min-height: 45px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .stat-card h3 {
        font-size: 0.8rem;
        margin-bottom: 0.05rem;
        line-height: 1;
    }
    
    .stat-card p {
        font-size: 0.5rem;
        margin: 0;
        line-height: 1;
    }
    
    .stat-icon {
        font-size: 1.3rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 0.75rem;
        border-radius: 16px 16px 0 0;
    }
    
    .modal-content h2 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group input[type="text"],
    .form-group input[type="file"],
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 0.75rem;
        border-radius: 10px;
        min-height: 44px;
    }
    
    .checkbox-group label {
        padding: 0.6rem;
        border-radius: 10px;
        gap: 0.6rem;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 44px;
    }
    
    .checkbox-group label:hover {
        background: #e9ecef;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin: 0;
        cursor: pointer;
        accent-color: #667eea;
    }
    
    .form-actions {
        gap: 0.6rem;
        margin-top: 1.25rem;
        padding-top: 0.75rem;
    }
    
    .form-actions .btn {
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
        border-radius: 10px;
    }
    
    .close {
        font-size: 1.8rem;
        right: 0.75rem;
        top: 0.75rem;
        width: 40px;
        height: 40px;
    }
}

/* 手機端觸控優化 */
@media (max-width: 768px) {
    /* 觸控目標最小尺寸 */
    .btn, .header-btn, .filter-tag, .tag, .btn-edit {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 觸控反饋 */
    .btn:active, .header-btn:active, .filter-tag:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* 滾動優化 */
    .page {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .marker-list {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* 防止意外縮放 */
    input[type="text"], input[type="file"], select, textarea {
        font-size: 16px !important;
    }
    
    /* 地圖觸控優化 */
    .leaflet-container {
        touch-action: pan-x pan-y;
    }
    
    /* 改善可讀性 */
    .marker-card {
        line-height: 1.5;
    }
    
    .marker-name {
        line-height: 1.4;
    }
    
    .marker-desc {
        line-height: 1.5;
    }
    
    /* 狀態指示器 */
    .status-indicator {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        display: inline-block;
        margin-right: 0.5rem;
    }
    
    .status-pending { background-color: #ffc107; }
    .status-inProgress { background-color: #17a2b8; }
    .status-completed { background-color: #28a745; }
    
    /* 改善視覺層次 */
    .marker-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border: 1px solid rgba(0,0,0,0.05);
    }
    
    .marker-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        transform: translateY(-1px);
        transition: all 0.2s ease;
    }
    
    /* 改善表單體驗 */
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }
    
/* 改善按鈕狀態 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-weight: 600;
}

.btn-primary:active {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-secondary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    font-weight: 500;
}

.btn-secondary:active {
    background: #e9ecef;
}

/* 空狀態樣式 */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin: 1rem 0;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.empty-description {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* 地圖彈出視窗樣式 */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 0;
    overflow: hidden;
}

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

.popup-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: center;
}

.popup-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.popup-type {
    font-size: 0.9rem;
    opacity: 0.9;
}

.popup-body {
    padding: 1rem;
    background: white;
}

.popup-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.severity-badge, .status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.severity-badge.light {
    background: #e8f5e8;
    color: #2e7d32;
}

.severity-badge.medium {
    background: #fff3e0;
    color: #f57c00;
}

.severity-badge.heavy {
    background: #ffebee;
    color: #d32f2f;
}

.status-badge.pending {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.inProgress {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.completed {
    background: #e8f5e8;
    color: #2e7d32;
}

.popup-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.popup-contact {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.75rem;
}

.popup-resources {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.resource-tag {
    background: #f0f0f0;
    color: #333;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.popup-photos {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
}

.popup-photo-item {
    position: relative;
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
    background: #f5f5f5;
    flex-shrink: 0;
    box-sizing: border-box;
}

.popup-photo-item:hover {
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.popup-photo-thumbnail {
    width: 100%;
    height: 100%;
    max-width: 80px;
    max-height: 80px;
    object-fit: cover;
    display: block;
}

.popup-photo-more {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.popup-image-container {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.popup-image-container .photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.popup-image-container .photo-gallery.stacked {
    display: block;
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.popup-image-container .gallery-photo {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
}

.popup-image-container .photo-gallery.stacked .gallery-photo {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.popup-image-container .photo-gallery.stacked .gallery-photo:not(:first-child) {
    z-index: 0;
    transform: translate(3px, 3px);
    opacity: 0.7;
}

.popup-image-container .photo-gallery.stacked .gallery-photo:hover {
    z-index: 10;
    transform: translate(0, 0);
    opacity: 1;
}

.popup-image-container .gallery-photo:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.popup-image-container .detail-image-container {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: 12px;
}

.popup-image-container .detail-image {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 12px;
}

.popup-image-container .detail-photo-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 20;
}

.popup-time {
    font-size: 0.8rem;
    color: #999;
    text-align: center;
}

.popup-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.popup-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn.primary {
    background: #667eea;
    color: white;
}

.popup-btn.primary:hover {
    background: #5a6fd8;
}

.popup-btn.secondary {
    background: #e0e0e0;
    color: #333;
}

.popup-btn.secondary:hover {
    background: #d0d0d0;
}

/* 詳情彈窗樣式 */
.detail-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    margin: 0;
    border-radius: 20px;
    overflow: hidden;
}

.detail-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.detail-image-container {
    width: 100%;
    max-height: 200px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* 詳情卡片中的照片顯示 */
.photo-card {
    margin-top: 1rem;
}

.detail-photo-wrapper {
    margin-bottom: 1rem;
}

.detail-photo-container {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    display: block;
}

.detail-photo-container:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
}

.detail-photo-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: contain;
    background: #1a1a1a;
    cursor: pointer;
}

.photo-expand-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(51, 51, 51, 0.8);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.photo-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(51, 51, 51, 0.8);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    border-radius: 0 0 6px 6px;
}

.photo-control-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.photo-control-btn:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.photo-control-btn:active {
    transform: scale(0.95);
}

.photo-timestamp {
    position: absolute;
    bottom: 48px;
    left: 0;
    right: 0;
    background: rgba(51, 51, 51, 0.9);
    color: #fff;
    padding: 6px 8px;
    border-radius: 0;
    font-size: 12px;
    z-index: 6;
    text-align: left;
    line-height: 1.4;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
}

.detail-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card.status-card {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-color: #bbdefb;
}

.detail-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.detail-icon {
    font-size: 1.2rem;
}

.detail-title {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.detail-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-text {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.4;
}

.status-display {
    margin-bottom: 0.5rem;
}

.status-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
}

.resource-tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.resource-tag {
    background: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.detail-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-primary {
    background: #007bff;
    color: white;
}

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

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

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-icon {
    font-size: 1rem;
}

.btn-text {
    font-size: 0.85rem;
}

/* 手機端彈出視窗優化 */
@media (max-width: 768px) {
    .custom-popup .leaflet-popup-content {
        width: 260px !important;
    }
    
    .popup-header {
        padding: 0.75rem;
    }
    
    .popup-header h3 {
        font-size: 1rem;
    }
    
    .popup-body {
        padding: 0.75rem;
    }
    
    .popup-photos {
        gap: 0.4rem;
        margin-bottom: 0.5rem;
        margin-top: 0.3rem;
    }
    
    .popup-photo-item {
        width: 40px;
        height: 30px;
    }
    
    .popup-photo-thumbnail {
        height: 100%;
    }
    
    .popup-photo-more {
        font-size: 1rem;
    }
    
    .popup-actions {
        padding: 0.75rem;
    }
    
    .popup-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    /* 詳情彈窗手機優化 */
    .detail-modal-content {
        max-width: 95vw;
        max-height: 80vh;
        margin: 15vh auto;
        border-radius: 12px;
        position: relative;
        top: 45%;
        transform: translateY(-50%);
    }
    
    .detail-container {
        padding: 0.5rem;
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 0.5rem 1rem;
    }
    
    .modal-header .close {
        font-size: 1.5rem;
        padding: 0.5rem;
    }
    
    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }
    
    .detail-card {
        padding: 0.5rem;
        border-radius: 6px;
        margin-bottom: 0.3rem;
    }
    
    .detail-card-header {
        margin-bottom: 0.3rem;
    }
    
    .detail-icon {
        font-size: 1rem;
    }
    
    .detail-title {
        font-size: 0.75rem;
        font-weight: 600;
    }
    
    .detail-text {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .detail-value {
        font-size: 0.8rem;
    }
    
    .detail-actions {
        padding: 0.5rem;
        gap: 0.4rem;
    }
    
    .detail-actions .btn {
        padding: 0.5rem;
        font-size: 0.75rem;
        min-height: 36px;
    }
    
    .detail-image-container {
        max-height: 150px;
        margin-bottom: 0.5rem;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
.btn-text {
    font-size: 0.8rem;
}

/* 座標輸入組樣式 */
.coordinate-input-group {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

/* 單一座標輸入框樣式 */
.coordinate-input-single {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 2;
    min-width: 200px;
}

.coordinate-input-single label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0;
}

.coordinate-input-single input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: monospace;
    background: #f8f9fa;
    width: 100%;
}

.coordinate-input-single input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    background: white;
}

.coordinate-input-group .btn {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
    align-self: end;
}





/* 手機端優化 - 簡化版 */
@media (max-width: 768px) {
    .coordinate-input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* 基本佈局 */
    .container {
        padding: 0.5rem;
    }
    
    /* 標題區域 */
    .header {
        padding: 1rem 0.5rem;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    /* 標籤頁 */
    .tabs {
        gap: 0.5rem;
        justify-content: center;
    }
    
    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
    }
    
    /* 按鈕 */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .btn-large {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        margin: 0.5rem 0;
    }
    
    /* 模態框 */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        margin: 0 auto;
        position: relative;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .modal-header {
        padding: 0.5rem 1rem;
        min-height: auto;
    }
    
    .modal-content h2 {
        font-size: 1rem;
        padding: 0;
        margin: 0;
    }
    
    .modal-body {
        padding: 0.5rem 1rem;
        max-height: calc(85vh - 100px);
        overflow-y: auto;
    }
    
    .close {
        position: absolute;
        top: 10px;
        right: 10px;
        background: #ff4757;
        color: white;
        border: none;
        border-radius: 50%;
        width: 35px;
        height: 35px;
        font-size: 1rem;
        cursor: pointer;
        z-index: 1001;
    }
    
    /* 表單 */
    .form-group {
        margin-bottom: 0.6rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
        display: block;
        font-weight: 600;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.5rem;
        font-size: 0.85rem;
        width: 100%;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    
    .form-actions {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }
    
    .form-actions .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* 卡片 */
    .marker-card {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        border: 1px solid #eee;
        border-radius: 6px;
        background: white;
    }
    
    .marker-card h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .marker-info {
        font-size: 0.8rem;
        margin-bottom: 0.6rem;
        color: #666;
    }
    
    .marker-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .marker-actions .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        flex: 1;
        min-width: 70px;
    }
    
    /* 統計卡片 */
    .stats-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 0.2rem;
        margin-bottom: 0.2rem;
    }
    
    .stat-card {
        padding: 0.25rem;
        text-align: center;
        background: white;
        border: 1px solid #eee;
        border-radius: 2px;
        min-height: 50px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .stat-card h3 {
        font-size: 0.9rem;
        margin-bottom: 0.05rem;
        font-weight: 600;
        line-height: 1;
    }
    
    .stat-card p {
        font-size: 0.5rem;
        color: #666;
        margin: 0;
        line-height: 1;
    }
    
    /* 篩選器 */
    .filters {
        flex-direction: column;
        gap: 0.8rem;
        background: #f8f9fa;
        padding: 0.8rem;
        border-radius: 6px;
        margin-bottom: 1rem;
    }
    
    .filters > div {
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .filters label {
        font-size: 0.9rem;
        font-weight: 500;
    }
    
    .filters select {
        padding: 0.6rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 0.9rem;
    }
    
    .filter-tags {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    
    .filter-tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 15px;
        border: 1px solid #ddd;
        background: white;
        min-height: 36px;
    }
    
    .filter-tag.active {
        background: #6c5ce7;
        color: white;
        border-color: #6c5ce7;
    }
    
    .status-filters {
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    
    /* 頁面標題 */
    .page-header {
        padding: 0.8rem 0.5rem;
        background: #f8f9fa;
        border-radius: 6px;
        margin-bottom: 1rem;
    }
    
    .page-header h2 {
        font-size: 1.1rem;
        margin: 0;
    }
    
    /* 搜尋框 */
    .search-container {
        margin-bottom: 1rem;
    }
    
    .search-container input {
        width: 100%;
        padding: 0.6rem 1rem;
        border: 1px solid #ddd;
        border-radius: 20px;
        font-size: 0.9rem;
    }
    
    /* 地圖控制 */
    .map-controls {
        position: fixed;
        bottom: 10px;
        left: 10px;
        right: 10px;
        background: white;
        padding: 0.5rem;
        border-radius: 6px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        flex-direction: row;
        gap: 0.4rem;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .map-controls .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-height: 32px;
        flex: 1;
        min-width: 80px;
    }
    
    .map-village-filter {
        flex-direction: row;
        gap: 0.3rem;
        align-items: center;
        flex: 1;
        min-width: 120px;
    }
    
    .map-village-filter label {
        font-size: 0.7rem;
        font-weight: 500;
        white-space: nowrap;
    }
    
    .map-village-filter select {
        padding: 0.4rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 0.8rem;
        flex: 1;
    }
    
    /* 列表 */
    .marker-list {
        padding-bottom: 120px;
    }
    
    .data-actions {
        position: fixed;
        bottom: 20px;
        left: 10px;
        right: 10px;
        background: white;
        padding: 0.5rem;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        display: flex;
        flex-direction: row;
        gap: 0.4rem;
        flex-wrap: wrap;
        margin-top: 0;
    }
    
    /* 統計頁面 */
    #stats-page {
        padding-bottom: 100px;
    }
    
    /* 照片預覽手機端優化 */
    .photo-preview-container {
        gap: 0.3rem;
    }
    
    .photo-preview-container.stacked {
        width: 60px;
        height: 60px;
    }
    
    .photo-preview-item {
        width: 60px;
        height: 60px;
    }
    
    .photo-preview-item .delete-photo {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .photo-count-badge {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    /* 照片瀏覽器手機端 */
    .photo-viewer-content {
        max-width: 95vw;
        max-height: 80vh;
        width: 100%;
        position: relative;
        top: 45%;
        transform: translateY(-50%);
    }
    
    .photo-nav {
        gap: 0.3rem;
        padding: 0.3rem;
    }
    
    .photo-nav button {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    .photo-nav span {
        font-size: 0.75rem;
        min-width: 50px;
    }
    
    .photo-display {
        max-height: 50vh;
        padding: 0.3rem;
    }
    
    .photo-display img {
        max-height: 45vh;
    }
    
    .photo-actions button {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* 照片畫廊手機端 */
    .photo-gallery {
        gap: 0.3rem;
    }
    
    .photo-gallery.stacked {
        width: 100px;
        height: 100px;
    }
    
    .gallery-photo {
        max-width: 100px;
        max-height: 100px;
    }
    
    .detail-photo-thumbnail {
        max-height: 60px;
    }
    
    .photo-expand-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 6px;
        right: 6px;
    }
    
    .photo-control-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .photo-timestamp {
        font-size: 11px;
        bottom: 44px;
        padding: 3px 6px;
    }
    
    .detail-photo-count {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .stat-row {
        padding: 0.6rem;
        margin-bottom: 0.4rem;
        background: white;
        border: 1px solid #eee;
        border-radius: 4px;
    }
    
    .type-stat-row {
        flex-direction: column;
        gap: 0.2rem;
        align-items: flex-start;
        padding: 0.4rem;
        margin-bottom: 0.2rem;
    }
    
    .village-detail {
        margin-left: 0.3rem;
        padding: 0.3rem;
        background: #f8f9fa;
        border-radius: 3px;
        margin-top: 0.2rem;
    }
    
    .village-header {
        font-size: 0.75rem;
        margin-bottom: 0.1rem;
    }
    
    .location-list {
        margin-top: 0.2rem;
    }
    
    .location-item {
        padding: 0.1rem 0;
        font-size: 0.7rem;
        color: #666;
        margin-bottom: 0.05rem;
    }
}
    
    .coordinate-input-group .btn {
        width: 100%;
        padding: 0.75rem;
    }
    
    .coordinate-input-single {
        min-width: unset;
    }
    
    .coordinate-input-single input {
        font-size: 16px; /* 防止iOS縮放 */
    }
}
}

