/* 基礎樣式 */
body { 
    margin: 0; 
    padding: 0; 
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #F5F3FF;
}

/* 頁首樣式 */
.header {
    background: linear-gradient(to right, #2E1065, #4F46E5);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(46, 16, 101, 0.2);
    z-index: 1000;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

/* 內容容器樣式 */
.content-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 側邊欄樣式 */
.sidebar {
    width: 300px;
    padding: 20px;
    background: #ffffff;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(46, 16, 101, 0.1);
    position: relative;
    height: calc(100vh - 60px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* 控制組樣式 */
.control-group {
    margin-bottom: 20px;
    background: #EEF2FF;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #C7D2FE;
}

/* 表單元素樣式 */
input[type="range"] {
    width: 100%;
    margin-top: 8px;
    accent-color: #4F46E5;
}

#crime-type-select, #district-select {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #C7D2FE;
    border-radius: 6px;
    background-color: #ffffff;
    color: #2E1065;
    font-size: 14px;
}

select:hover {
    border-color: #818CF8;
}

select:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* 年份顯示樣式 */
.year-display {
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: #EEF2FF;
    border-radius: 6px;
    color: #2E1065;
    border: 1px solid #C7D2FE;
}

/* 犯罪數量顯示樣式 */
#crime-count {
    margin: 10px 0;
    padding: 15px;
    background: #EEF2FF;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: #2E1065;
    border: 1px solid #C7D2FE;
    font-size: 16px;
}

/* 主頁面底部按鈕容器 */
.bottom-button-container {
    margin-bottom: 20px;
    background: #EEF2FF;
    padding: 0px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
}

/* 主頁面的按鈕樣式 */
.nav-button-statistics,
.nav-button-interact {
    flex: 1;
    padding: 8px 12px; /* 減少內邊距 */
    background: linear-gradient(to right, #2E1065, #4F46E5);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px; /* 稍微縮小字體 */
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

/* 互動頁面返回按鈕容器 */
#nav-button {
    width: 100%;
    padding: 10px 12px; /* 減少內邊距 */
    background: linear-gradient(to right, #2E1065, #4F46E5);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px; /* 稍微縮小字體 */
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}



/* 側邊欄樣式更新 */
.sidebar {
    width: 320px;
    padding: 20px 10px;
    padding-bottom: 60px; /* 減少底部間距 */
    background: #ffffff;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(46, 16, 101, 0.1);
    position: relative;
    height: calc(100vh - 60px);
    box-sizing: border-box;
}

/* 分析結果區域樣式 - 調整底部間距 */
#analysis-result {
    margin-top: 20px;
    margin-bottom: 60px; /* 減少底部間距 */
}

/* 地圖容器樣式 */
.map-container {
    position: relative;
    flex: 1;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
}

/* 分析表單樣式 */
.input-group {
    margin-bottom: 15px;
}

.form-input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #C7D2FE;
    border-radius: 6px;
    font-size: 14px;
    color: #2E1065;
    box-sizing: border-box;
}



/* 分析結果區域樣式 */
#analysis-result {
    margin-top: 20px;
    margin-bottom: 80px;
}

#result-content {
    padding: 10px;
    margin-left: 0;
    background: #F3F4F6;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: #2E1065;
    height: auto;
    overflow: visible;
}

/* 控制組樣式 */
.control-group {
    margin-bottom: 20px;
    background: #EEF2FF;
    padding: 15px 10px;
    border-radius: 8px;
    border: 1px solid #C7D2FE;
    height: auto;
}






/* 主題切換按鈕樣式 */
#theme-toggle-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.theme-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
}

.theme-button:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.theme-button.dark {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.theme-button.dark:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.theme-button.light {
    background-color: rgba(0, 0, 0, 0.2);
    color: black;
}

.theme-button.light:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* 彈出視窗樣式 */
.mapboxgl-popup {
    max-width: 400px;
    font: 14px/20px 'Helvetica Neue', Arial, Helvetica, sans-serif;
}

.mapboxgl-popup-content {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #C7D2FE;
    box-shadow: 0 2px 4px rgba(46, 16, 101, 0.1);
}

/* 圖例樣式 */
.map-legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.75);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    max-width: 250px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#legend {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

#legend h3 {
    margin: 0 0 12px 0;
    color: #2E1065;
    font-size: 16px;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 0;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-label {
    color: #4B5563;
    font-size: 14px;
}

/* 深色主題樣式 */
.theme-dark .map-legend {
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-dark .legend-label {
    color: white;
}

.theme-dark #legend h3 {
    color: white;
}


/* /////////環域分析////////// */

/* 表單輸入框樣式 */
.input-group {
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex; /* 使用 Flexbox 對齊 */
    flex-direction: column; /* 垂直排列 */
    align-items: stretch; /* 讓輸入框撐滿容器 */
}

.form-input {
    width: 100%; /* 撐滿父容器 */
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #C7D2FE;
    border-radius: 6px;
    font-size: 14px;
    color: #2E1065;
    box-sizing: border-box; /* 確保寬度包含邊框 */
}

.form-input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}


/* 開始分析按鈕樣式 */
#analyze-button {
    width: calc(100% - 0px); 
    margin: 0px 0px;
    padding: 10px 20px;
    background: linear-gradient(to right, #2E1065, #4F46E5);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    display: block;
    box-shadow: 0 2px 4px rgba(46, 16, 101, 0.2);
}

#analyze-button:hover {
    background: linear-gradient(to right, #4F46E5, #6366F1);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(46, 16, 101, 0.25);
}

#analyze-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(46, 16, 101, 0.2);
}

/* 確保分析表單內的其他樣式不受影響 */
#analysis-form {
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.input-group {
    margin-bottom: 15px;
}





/* Mapbox 導航控制樣式 */
.mapboxgl-ctrl-top-right {
    top: 45px;
    right: 10px;
}


/* 深色主題 - 側邊欄 */
.theme-dark .sidebar {
    background: #1E1E2E;
    color: #EDEDED;
    border: 1px solid #333;
}

.theme-dark .control-group {
    background: #2C2C3C;
    border: 1px solid #EDEDED;
}

.theme-dark .year-display, 
.theme-dark #crime-count {
    background: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}

.theme-dark select {
    background: #2C2C3C;
    color: #EDEDED;
    border: 1px solid #EDEDED;
}

.theme-dark .bottom-button-container {
    background: #1E1E2E;
    color: #EDEDED;
}

.theme-dark #district-select{
    background-color: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}

.theme-dark #crime-type-select{
    background-color: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}

.theme-dark .input-group{
    background-color: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}

.theme-dark .form-input{
    background-color: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}

.theme-dark #result-content{
    background-color: #2C2C3C;
    border: 1px solid #EDEDED;
    color: #EDEDED;
}
