/* 基本樣式 */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 水平導航列樣式 */
.horizontal-nav {
    width: 100%;
    height: 80px;
    background-color:  #F8FAFD;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
}

/* 功能容器樣式 */
.function-container {
    position: relative;
    z-index: 2;
    height: 100vh;
    display: flex;
}

/* 垂直導航欄樣式 */
.vertical-nav {
    width: 30%;
    height: 100%;
    display: flex;
    z-index: 9999;
    flex-direction: column;
    border-right: 1px solid  #F8FAFD;
    background-color:  #F8FAFD;
}

.nav-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nav-sidebar {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
}

/* 按鈕樣式 */
.nav-button, .desktop-locate-button, .mobile-nav-buttons .nav-button {
    width: 100%;
    height: 40px;
    background: white;
    color: #333;
    font-size: 16px;
    padding: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    margin: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-button i {
    font-size: 16px;
    color: #333;
}

.nav-button span {
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.nav-button:hover {
    background-color: #f0f0f0;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.1), 
                inset -1px -1px 3px rgba(255, 255, 255, 0.9);
}

.nav-button.active {
    background-color: #C2E7FF;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2), 
                -2px -2px 5px rgba(255, 255, 255, 0.7);
    transform: translateY(-2px);
    border: none;
}

.nav-button.active i,
.nav-button.active span {
    color: #1a73e8;
}

.nav-button:active, .desktop-locate-button:active, .mobile-nav-buttons .nav-button:active {
    transform: scale(0.95);
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2), 
                inset -2px -2px 5px rgba(255, 255, 255, 0.7);
}

/* 地圖樣式 */
#map {
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* 主內容樣式 */
.main-content {
    width: 70%;
    height: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 搜尋容器樣式 */
.search-container {
    position: fixed;
    display: flex;
    overflow: hidden;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    padding: 10px;
}

#search-input {
    width: calc(100% - 40px);
    padding: 5px 16px;
    padding-right: 50px;
    border: none;
    border-radius: 24px;
    box-sizing: border-box;
    font-size: 16px;
    outline: none;
    background: #dcdddb;
}

#search-button {
    position: absolute;
    width: 44px;
    height: 44px;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #666;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#search-button:hover {
    color: #333;
}

#suggestions-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

#suggestions-container.active {
    display: block;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.search-history {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-history.active {
    display: block;
}

.history-title {
    padding: 8px 12px;
    font-weight: bold;
    color: #666;
    border-bottom: 1px solid #eee;
}

.history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background-color: #f5f5f5;
}

.history-item i {
    color: #666;
}

/* 當前位置標記樣式 */
.current-location-marker {
    background: transparent;
}

.location-marker-inner {
    width: 20px;
    height: 20px;
    background: #4285f4;
    border-radius: 50%;
    position: relative;
    animation: pulse 2s infinite;
}

.location-marker-inner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.6);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(66, 133, 244, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}

/* 自定義縮放控制項樣式 */
.leaflet-control-zoom {
    margin-top: 20px !important;
    margin-right: 20px !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
}

.leaflet-control-zoom a {
    background-color: white !important;
    color: #333 !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
    background-color: #f5f5f5 !important;
}

/* 狀態欄樣式 */
.status-bar {
    width: 90%;
    margin-top: 0% !important;
    margin-bottom: 0% !important;
    padding: 0;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    border-radius: 8px;
    overflow: visible;
    position: relative;
}

.current-address {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.current-address i {
    color: #4285f4;
    font-size: 18px;
}

.current-address span {
    color: #333;
    font-size: 14px;
    flex: 1;
    line-height: 1.5;
}

.toggle-details {
    background: white;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-details:hover {
    background: #f5f5f5;
}

.toggle-details.active {
    background: #f0f0f0;
    color: #4285f4;
}

.toggle-details i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.toggle-details.active i {
    transform: rotate(180deg);
    color: #4285f4;
}

.details-container {
    border-top: 1px solid #eee;
    padding: 0;
    background: #f8f8f8;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    display: none;
    flex-direction: column;
    min-height: auto;
    transition: all 0.3s ease;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1010;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 0 0 8px 8px;
    max-height: 0;
}

.details-container.active {
    display: block !important;
    padding: 16px;
    overflow-y: auto;
    height: auto;
    min-height: 150px;
    max-height: 500px;
}

.coordinates {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

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

.detail-item i {
    color: #666;
    font-size: 14px;
}

.detail-item span {
    color: #333;
    font-size: 14px;
}

/* 操作按鈕樣式 */
.action-buttons {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    gap: 16px;
}

.action-button {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 18px;
    transition: all 0.3s ease;
    flex: 1;
}

.action-button:hover {
    background-color: #f5f5f5;
    color: #4285f4;
}

.action-button:active {
    transform: scale(0.95);
}

/* 時間選擇器樣式 */
.time-selector {
    padding: 0;
}

#time-range {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
}

#time-range:hover {
    border-color: #4285f4;
}

#time-range:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

/* 移除拖動把手相關樣式 */
.drag-handle {
    display: none;
}

/* 移除手機導航按鈕相關樣式 */
.mobile-nav-buttons {
    display: none !important;
}

/* 電腦端定位按鈕樣式 */
.desktop-plus-button {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 1000;
}

.desktop-plus-button:hover {
    background: #f5f5f5;
}

.desktop-plus-button:active {
    transform: scale(0.95);
}

.desktop-locate-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 1000;
}

.desktop-locate-button:hover {
    background: #f5f5f5;
}

.desktop-locate-button:active {
    transform: scale(0.95);
}

.desktop-locate-button.location-locked {
    background-color: #4285f4;
    color: white;
}

.nav-item {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 4px 16px;
    box-sizing: border-box;
}

/* 移除舊的 nav-label 樣式 */
.nav-label {
    display: none;
}

/* 瑕疵列表樣式 */
.defects-list {
    width: 90%;
    margin: 20px 5%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100% - 40px);
}

.defects-title {
    padding: 16px;
    margin: 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.defect-items {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.defect-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.defect-item:last-child {
    border-bottom: none;
}

.defect-item:hover {
    background-color: #f5f5f5;
}

.defect-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    transition: opacity 0.3s ease;
    background-color: #f0f0f0;
}

.defect-image[data-src] {
    opacity: 0;
}

.defect-image-placeholder {
    width: 100px;
    height: 100px;
    background-color: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.defect-image-placeholder::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.defect-info {
    flex: 1;
    padding: 4%;
}

.defect-type {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.defect-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

/* 彈出視窗中的圖片樣式 */
.defect-popup img {
    width: 240px;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* 瑕疵標記樣式 */
.defect-marker {
    background: transparent;
}

.defect-marker-inner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.severity-high {
    background-color: #ff4444;
}

.severity-medium {
    background-color: #ffbb33;
}

.severity-low {
    background-color: #00C851;
}

/* 彈出視窗樣式 */
.defect-popup {
    padding: 8px;
}

.defect-popup h3 {
    margin: 8px 0;
    font-size: 16px;
    color: #333;
}

.defect-popup p {
    margin: 4px 0;
    font-size: 14px;
    color: #666;
}

.defect-popup .severity {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    margin-top: 8px;
}

/* 手機版樣式 */
@media screen and (max-width: 768px) {
    .function-container {
        width: 100%;
        min-width: unset;
        height: 40vh;
        position: fixed;
        bottom: 0;
        top: auto;
        margin-top: 0;
        flex-direction: column;
    }

    /* 調整垂直導航欄 */
    body > div.function-container > div.vertical-nav {
        width: 100%;
        height: 62px !important;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
    }

    .nav-sidebar {
        flex-direction: row;
        padding: 0;
        justify-content: space-evenly;
    }

    .nav-item {
        width: auto;
        padding: 0;
    }

    .nav-button {
        width: auto;
        padding: 0 15px;
        height: 36px;
        margin: 0;
        justify-content: center;
        box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.15), 
                    inset -2px -2px 4px rgba(255, 255, 255, 0.6);
    }

    .nav-button i {
        margin: 0;
    }

    /* 調整主內容區 */
    .main-content {
        width: 100%;
        height: auto;
    }

    /* 調整地圖容器 */
    #map {
        width: 100%;
        height: 60vh;
        margin-left: 0;
        margin-bottom: 40vh;
    }

    /* 調整瑕疵列表容器 */
    body > div.function-container > div.main-content > div.defects-list {
        height: calc(40vh - 62px - 80px);
        overflow-y: auto;
    }

    .defect-items {
        height: 100%;
        overflow-y: auto;
    }

    /* 調整狀態欄和瑕疵列表 */
    .status-bar,
    .defects-list {
        width: 100%;
        margin: 10px 0;
        border-radius: 0;
    }

    /* 調整搜尋容器 */
    .search-container {
        width: 90%;
        min-width: unset;
    }

    /* 調整定位按鈕 */
    .desktop-locate-button {
        bottom: 42vh;
    }

    /* 調整新增按鈕 */
    .desktop-plus-button {
        bottom: calc(42vh + 9%);
    }

    /* 調整彈出視窗樣式 */
    .leaflet-popup {
        z-index: 10000 !important;
    }

    .leaflet-popup-content-wrapper {
        z-index: 10000 !important;
    }

    .leaflet-popup-content {
        margin: 8px;
        max-width: 200px;
        z-index: 10000 !important;
    }

    .defect-popup {
        padding: 4px;
        z-index: 10000 !important;
    }

    .defect-popup img {
        width: 180px;
        height: 120px;
    }

    .defect-popup h3 {
        font-size: 14px;
        margin: 4px 0;
    }

    .defect-popup p {
        font-size: 12px;
        margin: 2px 0;
    }

    .defect-popup .severity {
        font-size: 10px;
        padding: 2px 4px;
        margin-top: 4px;
    }

    /* 隱藏瑕疵列表標題 */
    body > div.function-container > div.main-content > div.defects-list > h2 {
        display: none !important;
    }

    /* 隱藏按鈕文字 */
    .nav-button span {
        display: none !important;
    }

    /* 調整詳細信息容器在移動設備上的樣式 */
    .details-container {
        position: static; /* 在移動設備上恢復靜態定位 */
        box-shadow: none;
        border-radius: 0;
        max-height: 0;
        top: auto;
        left: auto;
        z-index: auto;
    }
    
    .details-container.active {
        display: block !important;
        padding: 12px;
        overflow-y: auto;
        min-height: 120px;
        max-height: 350px;
    }

    .nav-button.active {
        box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15), 
                    -1px -1px 3px rgba(255, 255, 255, 0.6);
        transform: translateY(-1px);
    }

    /* 調整縮放控制項在手機端的位置 */
    .leaflet-control-zoom {
        margin-top: 10px !important;
        margin-right: 10px !important;
    }

    .leaflet-control-zoom a {
        width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
        font-size: 16px !important;
    }
}

.leaflet-control-attribution {
        display: none !important;
    }

.leaflet-container a {
    visibility: hidden !important;
}

/* 清空搜尋按鈕樣式 */
#clear-search {
    position: absolute;
    right: 18%;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
    padding: 0;
    transition: all 0.3s ease;
    z-index: 10;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
}

#clear-search:hover {
    background: #f5f5f5;
    color: #4285f4;
}

#clear-search:active {
    transform: translateY(-50%) scale(0.95);
}

/* 地圖圖例樣式 */
.map-legend {
    position: fixed;
    bottom: 90px;  /* 調整到定位按鈕上方 */
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 90px;
    transition: all 0.3s ease;
}

.legend-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.legend-title.mt-3 {
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 6px 0;
}

.legend-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 4px;
}

.legend-icon i {
    font-size: 14px;
    color: #333;
}

.legend-text {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .map-legend {
        bottom: calc(40vh + 18%);
        right: 10px;
        padding: 8px;
        max-width: 90px;
        transform: translateX(calc(100% + 10px));
        cursor: pointer;
    }

    .map-legend::before {
        content: "圖例";
        position: absolute;
        left: -40px;
        top: 50%;
        transform: translateY(-50%);
        background: white;
        padding: 8px;
        border-radius: 8px 0 0 8px;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        font-size: 12px;
        color: #333;
        cursor: pointer;
    }

    .map-legend.active {
        transform: translateX(0);
    }

    .legend-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .legend-icon {
        width: 16px;
        height: 16px;
        margin-right: 6px;
    }

    .legend-icon i {
        font-size: 12px;
    }

    .legend-text {
        font-size: 11px;
    }
}

/* Marker Cluster 樣式 */
.custom-cluster-icon {
    background: none;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    transition: all 0.2s ease;
    position: relative;
}

.cluster-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    filter: blur(10px);
    z-index: -1;
}

.cluster-small {
    width: 30px;
    height: 30px;
    font-size: 12px;
    background-color: rgba(255, 222, 89, 0.9);
}

.cluster-small::before {
    background-color: rgba(255, 222, 89, 0.9);
    width: 45px;
    height: 45px;
}

.cluster-medium {
    width: 35px;
    height: 35px;
    font-size: 14px;
    background-color: rgba(255, 149, 0, 0.6);
}

.cluster-medium::before {
    background-color: rgba(255, 149, 0, 0.6);
    width: 52px;
    height: 52px;
}

.cluster-large {
    width: 40px;
    height: 40px;
    font-size: 16px;
    background-color: rgba(255, 59, 48, 0.9);
}

.cluster-large::before {
    background-color: rgba(255, 59, 48, 0.6);
    width: 60px;
    height: 60px;
}

.cluster-icon:hover {
    transform: scale(1.1);
}

.cluster-icon:hover::before {
    filter: blur(12px);
}

/* 相機 Popup 樣式 */
.camera-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 10000;
    display: none;
    flex-direction: column;
}

.camera-popup.active {
    display: flex;
}

.camera-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10002;
    background: transparent;
}

.close-camera {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-camera:hover {
    background: rgba(255, 255, 255, 0.3);
}

.camera-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* 拍攝引導樣式 */
.capture-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10001;
}

.guide-text {
    color: white;
    font-size: 16px;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
}

.guide-frame {
    width: 80%;
    height: 60%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    position: relative;
}

#camera-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin-top: 0;
    z-index: 10000;
}

/* 預覽容器樣式 */
.preview-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.preview-container.active {
    display: flex;
}

.preview-image {
    max-width: 90%;
    max-height: 70vh;
    object-fit: contain;
    display: none;
    margin-bottom: 20px;
}

.preview-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.preview-button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preview-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: white;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-button:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

.preview-button:active {
    transform: scale(0.95);
}

.button-label {
    background: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 14px;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.confirm-button {
    background: #4CAF50;
    color: white;
}

.confirm-button:hover {
    background: #45a049;
}

.retake-button {
    background: #f44336;
    color: white;
}

.retake-button:hover {
    background: #da190b;
}

.camera-footer {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    background: transparent;
}

/* 拍攝按鈕 */
#capture-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: white;
    border: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin: 0 auto;
}

#capture-button:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

#capture-button:active {
    transform: scale(0.9);
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    .camera-popup {
        padding: 0;
    }
    
    .camera-header {
        padding: 15px;
    }
    
    .close-camera {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .guide-text {
        font-size: 14px;
        padding: 6px 12px;
        top: 15px;
    }
    
    .camera-footer {
        bottom: 15px;
        padding: 0;
    }
    
    .capture-button {
        width: 60px;
        height: 60px;
        font-size: 25px;
    }

    .preview-controls {
        bottom: 15px;
        padding: 15px;
        gap: 15px;
    }

    .preview-button {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .button-label {
        font-size: 12px;
        padding: 3px 10px;
    }

    /* 調整相機預覽在手機上的顯示 */
    #camera-preview {
        width: 100%;
        height: 100%;
        object-fit: contain;
        margin-top: 0;
    }

    .preview-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    /* 調整拍攝引導在手機上的顯示 */
    .guide-frame {
        width: 90%;
        height: 70%;
    }
}

/* 結果容器樣式更新 */
.result-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.result-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    border-bottom: 1px solid #333;
}

.result-header h3 {
    margin: 0;
    color: black;
    font-size: 1.2rem;
}

.close-result {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.result-image {
    width: 100%;
    max-width: 800px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.result-image img {
    width: 100%;
    height: auto;
    display: block;
}

.result-details {
    width: 100%;
    max-width: 800px;
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    color: black;
}

.defect-type-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.defect-type-label {
    color: black;
}

.defect-type-value {
    color: black;
    font-weight: 500;
}

/* 更新現有的 severity-info 樣式 */
.severity-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.location-info {
    color: black;
    font-size: 1rem;
    line-height: 1.5;
}

.location-info div {
    margin-bottom: 0.5rem;
}

.no-defects {
    text-align: center;
    color: #999;
    font-size: 1.2rem;
    padding: 2rem;
}

.result-footer {
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    background-color: #1a1a1a;
    border-top: 1px solid #333;
}

.result-button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-upload {
    background-color: #4CAF50;
    color: white;
}

.cancel-upload {
    background-color: #666;
    color: white;
}

.retake-photo {
    background-color: #2196F3;
    color: white;
}

.result-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.result-button:active {
    transform: translateY(0);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .result-content {
        padding: 0.5rem;
    }

    .result-details {
        border-radius: 0;
    }

    .severity-info {
        font-size: 1rem;
    }

    .location-info {
        font-size: 0.9rem;
    }

    .result-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .defect-type-info {
        font-size: 1rem;
        padding-bottom: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .severity-info {
        font-size: 1rem;
        padding-bottom: 0.8rem;
        margin-bottom: 0.8rem;
    }

    .location-info {
        font-size: 0.9rem;
    }

    .location-info div {
        margin-bottom: 0.4rem;
    }
}

/* 加載動畫容器 */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
}

/* 加載動畫 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 圖片加載動畫 */
.defect-image.loading {
    position: relative;
    background: #f5f5f5;
    filter: blur(5px);
    transition: filter 0.3s ease-out;
}

.defect-image.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 圖片加載進度指示器 */
.defect-image.loading::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #4285f4;
    width: 0%;
    animation: progress 2s ease-in-out;
}

/* 圖片加載失敗樣式 */
.defect-image.error {
    position: relative;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.defect-image.error::after {
    content: '圖片載入失敗';
    color: #999;
    font-size: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* 圖片淡入效果 */
.defect-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out, filter 0.3s ease-out;
}

.defect-image.loaded {
    opacity: 1;
    filter: blur(0);
}