body {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans TC', Arial, sans-serif;
    background-color: #121212;
    color: #f0f0f0;
}

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

/* 精簡化頂部控制區 */
.compact-header {
    background-color: #1e1e1e;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
    flex-wrap: wrap;
}

/* 左側標題和檔案區 */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 300px;
}

/* 標題搭配LOGO */
.app-title {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.app-logo {
    color: #4CAF50;
    font-size: 22px;
}

.app-name {
    font-weight: bold;
    letter-spacing: 0.5px;
    font-size: 16px;
}

/* 檔案上傳區 */
.file-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-input-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 90px;
}

.file-input-group label {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-button {
    display: flex;
    align-items: center;
    background-color: #2a2a2a;
    color: #ddd;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.file-button:hover {
    background-color: #333;
    border-color: #555;
}

.file-button i {
    color: #4CAF50;
    margin-right: 4px;
}

/* 播放模式切換樣式 */
.mode-switch-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 10px;
}

.mode-switch-container label {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

.mode-switch {
    display: flex;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}

.mode-switch input[type="radio"] {
    display: none;
}

.mode-switch label {
    padding: 4px 8px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0;
}

.mode-switch input[type="radio"]:checked + label {
    background-color: #4CAF50;
    color: white;
}

/* 日期控制區 */
.date-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-input-group label {
    font-size: 12px;
    color: #aaa;
}

input[type="date"] {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    width: 120px;
}

/* 播放設定區 */
.playback-settings {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.speed-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.speed-input-group label {
    font-size: 12px;
    color: #aaa;
}

input[type="number"] {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-size: 13px;
    width: 50px;
    outline: none;
}

/* 勾選框 */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.checkbox-group label {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

.checkbox-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4CAF50;
    cursor: pointer;
}

/* 控制按鈕區 */
.control-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.control-button {
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-button:hover:not(:disabled) {
    background-color: #444;
}

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

.control-button.play {
    background-color: #4CAF50;
}

.control-button.pause {
    background-color: #546e7a;
}

.control-button.reset {
    background-color: #ff9800;
}

.control-button.info {
    background-color: #2196F3;
    padding: 6px;
    min-width: auto;
}

.control-button.home {
    background-color: #3F51B5;
}

.control-button.analysis {
    background-color: #9C27B0;
}

.control-button i {
    font-size: 14px;
}

/* 內容區域 */
.content-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

#map {
    flex: 1;
    height: 100%;
    position: relative;
}

.content-container.sidebar-collapsed #map {
    width: 100%; /* 確保地圖佔據完整寬度 */
}

/* 側邊欄折疊按鈕 */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: 350px; /* 位置對應側邊欄寬度 */
    transform: translateY(-50%);
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-right: none;
    border-radius: 4px 0 0 4px;
    padding: 12px 5px;
    cursor: pointer;
    z-index: 1000;
    color: #aaa;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: #333;
    color: white;
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

/* 修改現有的折疊樣式 */
.content-container.sidebar-collapsed .earthquake-sidebar {
    position: absolute; /* 改為絕對定位 */
    right: -350px;  /* 將側邊欄移出視圖 */
    transform: none; /* 移除transform */
}

.content-container.sidebar-collapsed .sidebar-toggle {
    right: 0;
}

.content-container.sidebar-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.earthquake-sidebar {
    width: 350px;
    background-color: #1a1a1a;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, right 0.3s ease;
}

/* 修改後的 earthquake-header 樣式 - 單行佈局 */
.earthquake-header {
    padding: 10px 12px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.header-title {
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 排序選項樣式 */
.sort-switch {
    display: flex;
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}

.sort-switch input[type="radio"] {
    display: none;
}

.sort-switch label {
    padding: 4px 8px;
    font-size: 11px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0;
    font-weight: normal;
}

.sort-switch input[type="radio"]:checked + label {
    background-color: #4CAF50;
    color: white;
}

/* 規模篩選下拉選單樣式 */
.magnitude-filter-dropdown {
    position: relative;
}

.magnitude-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #1a1a1a;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.magnitude-filter-btn:hover {
    background-color: #333;
    border-color: #555;
    color: #fff;
}

.magnitude-filter-btn i {
    font-size: 10px;
    transition: transform 0.2s;
}

.magnitude-filter-dropdown.open .magnitude-filter-btn i {
    transform: rotate(180deg);
}

.magnitude-filter-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
    z-index: 100;
    display: none;
    min-width: 80px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.magnitude-filter-dropdown.open .magnitude-filter-menu {
    display: block;
}

.magnitude-option {
    padding: 8px 12px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.magnitude-option:hover {
    background-color: #3a3a3a;
    color: #fff;
}

.magnitude-option.active {
    background-color: #4CAF50;
    color: white;
}

/* 舊的 earthquake-count 樣式保留給相容性 */
.earthquake-count {
    font-size: 13px;
    color: #aaa;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
}

.earthquake-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
}

.earthquake-list::-webkit-scrollbar {
    width: 6px;
}

.earthquake-list::-webkit-scrollbar-track {
    background: #222;
}

.earthquake-list::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 6px;
}

.earthquake-item {
    background-color: #2a2a2a;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 5px;
    border-left: 4px solid #4CAF50;
    animation: slideIn 0.3s ease-out;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.earthquake-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background-color: #333;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.earthquake-item.magnitude-50 {
    border-left-color: #fdcf00;
}

.earthquake-item.magnitude-55 {
    border-left-color: #FF9800;
}

.earthquake-item.magnitude-60 {
    border-left-color: #F44336;
}

.earthquake-item.magnitude-65 {
    border-left-color: #E91E63;
}

.earthquake-item.magnitude-70 {
    border-left-color: #9C27B0;
}

.magnitude {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.magnitude span:first-child {
    color: #fff;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.3);
}

.quake-details {
    font-size: 14px;
    color: #bbb;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.longitude-info, .latitude-info {
    color: #bbb;
    text-align: right;
}

.depth-info {
    color: var(--depth-text-color, #bbb);
    font-weight: bold;
}

.datetime-info {
    color: #bbb;
}

.no-data {
    padding: 20px;
    text-align: center;
    color: #888;
}

/* 統計、日期和深度圖例的合併框 */
.info-display {
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    display: none;
    width: 300px;
    box-sizing: border-box;
}

.date-display {
    font-size: 50px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 15px 0;
    margin: 15px 0;
    transition: font-size 0.3s ease;
}

/* 日期範圍顯示樣式 */
.date-display.date-range-display {
    font-size: 30px;
}

/* 小時顯示樣式 */
.date-display.hour-display {
    font-size: 40px;
}

.date-display.hour-display span.hour {
    font-size: 32px;
    color: #8BC34A;
}

.earthquake-stats {
    width: 100%;
}

.earthquake-stats h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #fff;
    font-size: 20px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 18px;
}

.magnitude-range {
    color: #ddd;
    font-size: 18px;
}

.magnitude-count {
    font-weight: bold;
    font-size: 18px;
}

.stats-item.m7plus .magnitude-range {
    color: #9C27B0;
}

.stats-item.m6to7 .magnitude-range {
    color: #E91E63;
}

.stats-item.m5to6 .magnitude-range {
    color: #F44336;
}

.stats-item.m4to5 .magnitude-range {
    color: #FF9800;
}

.stats-item.m3to4 .magnitude-range {
    color: #FFC107;
}

.stats-item.mbelow3 .magnitude-range {
    color: #8BC34A;
}

.total-count {
    margin-top: 14px;
    padding-top: 14px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 20px;
}

/* 深度圖例樣式 */
.depth-legend h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: #fff;
    font-size: 16px;
}

.depth-scale {
    width: 100%;
    height: 30px;
    background: linear-gradient(to right, #ff0000, #ffff45, #00ff00, #00ffff, #4646ff);
    margin-bottom: 5px;
    border-radius: 4px;
    border: 1px solid #fff;
}

.depth-labels {
    display: flex;
    justify-content: space-between;
    color: #fff;
    position: relative;
    height: 20px;
    margin-top: 5px;
}

.depth-label {
    font-size: 12px;
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.depth-label:nth-child(1) {
    left: 0%;
}

.depth-label:nth-child(2) {
    left: 16.67%;
}

.depth-label:nth-child(3) {
    left: 33.33%;
}

.depth-label:nth-child(4) {
    left: 50%;
}

.depth-label:nth-child(5) {
    left: 66.67%;
}

.depth-label:nth-child(6) {
    left: 83.33%;
}

.depth-label:nth-child(7) {
    left: 100%;
}

.depth-ticks {
    position: relative;
    width: 100%;
    height: 5px;
    margin-bottom: 5px;
}

.depth-tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 5px;
    background-color: #fff;
    transform: translateX(-50%);
}

.depth-tick:nth-child(1) {
    left: 0%;
}

.depth-tick:nth-child(2) {
    left: 16.67%;
}

.depth-tick:nth-child(3) {
    left: 33.33%;
}

.depth-tick:nth-child(4) {
    left: 50%;
}

.depth-tick:nth-child(5) {
    left: 66.67%;
}

.depth-tick:nth-child(6) {
    left: 83.33%;
}

.depth-tick:nth-child(7) {
    left: 100%;
}

/* 地圖提示 */
.loading-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 400;
}

.loading-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    color: #4CAF50;
}

/* MapLibre 特定樣式 */
.maplibregl-control-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.maplibregl-ctrl-top-right {
    position: absolute;
    top: 10px;
    right: 10px;
}

.maplibregl-ctrl button {
    background-color: rgba(30, 30, 30, 0.8);
    border: 1px solid #444;
    color: #fff;
}

.maplibregl-ctrl button:hover {
    background-color: rgba(50, 50, 50, 0.8);
}

/* 彈出窗口樣式 */
.maplibregl-popup {
    z-index: 500;
}

.maplibregl-popup-content {
    background-color: rgba(40, 40, 40, 0.9);
    color: #f0f0f0;
    padding: 12px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 280px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.maplibregl-popup-close-button {
    color: #f0f0f0;
    font-size: 18px;
    padding: 4px 8px;
}

.maplibregl-popup-close-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 圖表容器樣式 */
.chart-container {
    height: 180px;
    margin-bottom: 10px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.chart-container h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #fff;
    font-size: 16px;
}

#earthquake-trend-chart {
    width: 100%;
    height: 140px;
}

/* 滑桿樣式 */
.magnitude-range-slider {
    display: flex;
    flex-direction: column;
    width: 300px;
    margin-right: 10px;
}

.magnitude-slider {
    height: 10px;
    margin-top: 5px;
}

.magnitude-values {
    display: flex;
    justify-content: space-between;
    color: #ccc;
    font-size: 11px;
    margin-top: 2px;
}

.noUi-connect {
    background: #4CAF50;
}

.noUi-handle {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.noUi-horizontal .noUi-handle {
    width: 16px;
    height: 16px;
    top: -4px;
    right: -8px;
}

.noUi-handle:before, 
.noUi-handle:after {
    display: none;
}

/* 第二行樣式 */
.second-row {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding-top: 2px;
    gap: 12px;
}

/* 響應式排版 */
@media (max-width: 1200px) {
    .compact-header {
        padding: 8px;
        gap: 8px;
    }

    .file-button {
        max-width: 100px;
    }

    input[type="date"] {
        width: 110px;
    }
    
    .info-display {
        width: 280px;
        padding: 12px;
    }
    
    .date-display {
        font-size: 40px;
    }
    
    .date-display.date-range-display {
        font-size: 26px;
    }
    
    .date-display.hour-display {
        font-size: 34px;
    }
    
    .sidebar-toggle {
        right: 300px;
    }
}

@media (max-width: 992px) {
    .earthquake-sidebar {
        width: 300px;
    }
    
    .content-container.sidebar-collapsed .earthquake-sidebar {
        transform: translateX(300px);
    }
    
    .date-display.date-range-display {
        font-size: 24px;
    }
    
    .header-controls {
        gap: 4px;
    }
    
    .sort-switch label {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .magnitude-filter-btn {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* 移動版樣式調整 */
@media (max-width: 768px) {
    .compact-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px;
    }

    .header-left, .date-controls, .playback-settings, .control-buttons {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 8px;
    }
    
    .content-container {
        flex-direction: column;
        height: calc(100vh - 170px);
    }
    
    .earthquake-sidebar {
        width: 100%;
        height: 300px;
        order: -1;
    }
    
    #map {
        height: calc(100% - 300px);
    }
    
    .info-display {
        bottom: 310px;
        left: 10px;
        width: calc(100% - 20px);
        max-width: 350px;
    }
    
    /* 手機版側邊欄收合按鈕位置調整 */
    .sidebar-toggle {
        top: 300px;
        right: auto;
        left: 50%;
        transform: translateX(-50%) rotate(90deg);
        border-radius: 0 0 4px 4px;
        border: 1px solid #444;
        border-top: none;
        padding: 5px 12px;
    }
    
    .content-container.sidebar-collapsed .sidebar-toggle {
        top: 0;
    }
    
    .content-container.sidebar-collapsed .earthquake-sidebar {
        transform: translateY(-300px);
    }
    
    .second-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .magnitude-range-slider {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .date-controls {
        width: 100%;
    }
    
    .mode-switch-container {
        margin-bottom: 5px;
    }
    
    .date-display.date-range-display {
        font-size: 22px;
    }
    
    .date-display.hour-display {
        font-size: 28px;
    }
    
    .header-controls {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .file-inputs {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .date-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .date-input-group {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .playback-settings {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .earthquake-sidebar {
        height: 250px;
    }
    
    #map {
        height: calc(100% - 250px);
    }
    
    .info-display {
        bottom: 260px;
    }
    
    .sidebar-toggle {
        top: 250px;
    }
    
    .content-container.sidebar-collapsed .earthquake-sidebar {
        transform: translateY(-250px);
    }
    
    .date-display.date-range-display {
        font-size: 18px;
    }
    
    .date-display.hour-display {
        font-size: 22px;
    }
}

/* ==================== 分析面板樣式 ==================== */

/* 覆蓋層 */
.analysis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.analysis-overlay.active {
    display: block;
    opacity: 1;
}

/* 分析面板 */
.analysis-panel {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 分析標題區 */
.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #4CAF50;
    margin-bottom: 30px;
}

.analysis-header h2 {
    color: #fff;
    font-size: 28px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.analysis-header h2 i {
    color: #4CAF50;
}

.analysis-close-btn {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analysis-close-btn:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
}

/* 分析內容區 */
.analysis-content {
    padding-bottom: 50px;
}

/* 各區塊樣式 */
.analysis-section {
    background-color: #1e1e1e;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #333;
}

.analysis-section h3 {
    color: #fff;
    font-size: 20px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-section h3 i {
    color: #4CAF50;
}

/* 日期範圍顯示 */
.analysis-date-range {
    font-size: 22px;
    color: #4CAF50;
    text-align: center;
    padding: 15px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    border: 1px solid #4CAF50;
}

/* 統計網格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border-left: 4px solid #4CAF50;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.m7plus { border-left-color: #9C27B0; }
.stat-card.m6to7 { border-left-color: #E91E63; }
.stat-card.m5to6 { border-left-color: #F44336; }
.stat-card.m4to5 { border-left-color: #FF9800; }
.stat-card.m3to4 { border-left-color: #FFC107; }
.stat-card.mbelow3 { border-left-color: #8BC34A; }
.stat-card.total { 
    border-left-color: #2196F3;
    background-color: #1a237e;
}

.stat-label {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
}

.stat-card.m7plus .stat-label { color: #9C27B0; }
.stat-card.m6to7 .stat-label { color: #E91E63; }
.stat-card.m5to6 .stat-label { color: #F44336; }
.stat-card.m4to5 .stat-label { color: #FF9800; }
.stat-card.m3to4 .stat-label { color: #FFC107; }
.stat-card.mbelow3 .stat-label { color: #8BC34A; }
.stat-card.total .stat-label { color: #64B5F6; }

/* 排行榜容器 */
.ranking-container {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #555 #222;
}

.ranking-container::-webkit-scrollbar {
    width: 8px;
}

.ranking-container::-webkit-scrollbar-track {
    background: #222;
    border-radius: 4px;
}

.ranking-container::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}

/* 排行項目 */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #2a2a2a;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.ranking-item:hover {
    background-color: #333;
    transform: translateX(5px);
}

.ranking-position {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-right: 15px;
    background-color: #444;
    color: #fff;
}

.ranking-item:nth-child(1) .ranking-position {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.ranking-item:nth-child(2) .ranking-position {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: #000;
}

.ranking-item:nth-child(3) .ranking-position {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: #fff;
}

.ranking-name {
    flex: 1;
    font-size: 16px;
    color: #fff;
}

.ranking-count {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    min-width: 60px;
    text-align: right;
}

.ranking-bar-container {
    flex: 1;
    margin: 0 15px;
    height: 8px;
    background-color: #444;
    border-radius: 4px;
    overflow: hidden;
}

.ranking-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 分析圖表容器 */
.chart-container-analysis {
    height: 350px;
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 20px;
}

.chart-container-analysis.stacked-chart {
    height: 400px;
}

#cumulative-chart,
#monthly-stacked-chart {
    width: 100%;
    height: 100%;
}

/* 圖表控制區樣式 */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #2a2a2a;
    border-radius: 8px;
}

.chart-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-control-group label {
    font-size: 14px;
    color: #aaa;
    white-space: nowrap;
}

.chart-select {
    background-color: #1a1a1a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-select:hover {
    border-color: #4CAF50;
}

.chart-select:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.chart-select option {
    background-color: #1a1a1a;
    color: #fff;
    padding: 8px;
}

/* 圖表模式切換 */
.chart-mode-switch {
    display: flex;
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}

.chart-mode-switch input[type="radio"] {
    display: none;
}

.chart-mode-switch label {
    padding: 8px 16px;
    font-size: 13px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0;
}

.chart-mode-switch input[type="radio"]:checked + label {
    background-color: #4CAF50;
    color: white;
}

/* 圖例樣式 */
.chart-legend-container {
    margin-bottom: 15px;
}

.magnitude-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px 15px;
    background-color: #2a2a2a;
    border-radius: 8px;
    justify-content: center;
}

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

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-color.m7plus { background-color: #9C27B0; }
.legend-color.m6to7 { background-color: #E91E63; }
.legend-color.m5to6 { background-color: #F44336; }
.legend-color.m4to5 { background-color: #FF9800; }
.legend-color.m3to4 { background-color: #FFEB3B; }
.legend-color.mbelow3 { background-color: #4CAF50; }

/* 無數據提示 */
.no-analysis-data {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 16px;
}

.no-analysis-data i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #555;
}

/* 響應式設計 - 分析面板 */
@media (max-width: 768px) {
    .analysis-panel {
        padding: 15px;
    }
    
    .analysis-header h2 {
        font-size: 20px;
    }
    
    .analysis-close-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .analysis-section {
        padding: 15px;
    }
    
    .analysis-section h3 {
        font-size: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .analysis-date-range {
        font-size: 16px;
    }
    
    .chart-container-analysis {
        height: 280px;
        padding: 10px;
    }
    
    .chart-container-analysis.stacked-chart {
        height: 320px;
    }
    
    .ranking-name {
        font-size: 14px;
    }
    
    .ranking-count {
        font-size: 16px;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .chart-control-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .chart-select {
        flex: 1;
        min-width: 0;
    }
    
    .magnitude-legend {
        gap: 10px;
    }
    
    .legend-item {
        font-size: 11px;
    }
    
    .legend-color {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .ranking-bar-container {
        display: none;
    }
}

/* API Input Styles */
.api-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

#api-url-input {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    font-size: 13px;
    width: 150px;
    outline: none;
    transition: border-color 0.2s;
}

#api-url-input:focus {
    border-color: #4CAF50;
}

.api-button {
    justify-content: center;
    padding: 4px 8px;
    min-width: 30px;
}

