/* ==================== */
/* BASE STYLES & RESETS */
/* ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 3px;
}

/* ============== */
/* SCREEN LAYOUTS */
/* ============== */
.screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ============= */
/* OVERWORLD MAP */
/* ============= */
#overworld.active {
    background-image: url('../img/bigmap.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    position: relative;
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    color: white;
	overflow: hidden;
}

/* 左側面板 - 固定不動 */
.left-panel {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    height: 100vh;
    overflow-y: hidden; /* 如果內容過長可以滾動 */
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 215, 0, 0.3);
}

/* 右側面板 - 可滾動區域 */
.right-panel {
    display: flex;
    flex-direction: column;
    height: 80vh;
    overflow: auto;
}

#overworld::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

#overworld > * {
    position: relative;
    z-index: 1;
}

/* ============ */
/* HEADER STYLES - 固定在顶部 */
/* ============ */
.header {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

#current-faction {
    color: #ffcc00;
    font-size: 1.5rem;
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

/* ================ */
/* FACTION INFORMATION */
/* ================ */
#faction-info {
    color: white;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.4);
    margin: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    flex: 1;
    text-align: center;
    justify-content: center;
    font-size: 0.95rem;
}

.info-icon {
    margin-right: 8px;
    font-size: 1.1em;
}

/* =============== */
/* ACTION BUTTONS */
/* =============== */
.action-buttons {
    display: flex;
    justify-content: space-between;
    padding: 0 2px 15px;
    gap: 12px;
}

.action-buttons button {
    flex: 1;
    padding: 14px;
    font-size: 1rem;
    background-color: rgba(139, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
}

/* =============== */
/* SEARCH CONTAINER */
/* =============== */
.search-container {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 15px;
    margin: 0 0 10px 0;
}

/* ============== */
/* CITY CARDS - 加大间距 */
/* ============== */
#cities-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 35px; /* 加大卡片间距 */
    padding: 25px 15px;
	overflow: auto;
}

.city-card {
    background-color: rgba(40, 40, 40, 0.9);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
	margin: 5px;
}

.city-card h3 {
    color: #ffcc00;
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

/* 城市詳細資訊行樣式 */
.city-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-label {
    color: #ffcc00;
    font-weight: bold;
    margin-right: 10px;
}

.detail-value {
    color: white;
}
/* 城市卡片資訊行樣式 */
.city-card .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.city-card .info-item {
    flex: 1;
    text-align: center;
    min-width: 0;
    padding: 0 5px;
}

.city-card .info-label {
    display: block;
    font-size: 0.8rem;
    color: #ffcc00;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.city-card .info-value {
    display: block;
    font-size: 0.9rem;
    color: white;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 調整卡片內間距 */
.city-card {
    padding: 15px;
}

.city-card h3 {
    margin-bottom: 15px;
}

/* Add these styles to your existing map-view.css */

/* ==================== */
/* FACTION-SPECIFIC STYLES */
/* ==================== */

/* 山歌 (Shu) - Red/Gold Theme */
.shu-city .city-card {
    border: 1px solid #8B0000;
    background-color: rgba(70, 0, 0, 0.85);
}

.shu-city .city-card h3 {
    color: #ffcc00;
    border-bottom-color: rgba(255, 215, 0, 0.4);
}

.shu-city .info-item {
    color: #ffcc00;
}

.shu-city .action-buttons button {
    background-color: rgba(139, 0, 0, 0.8);
    border: 1px solid gold;
}

/* 神仙 (Wei) - Blue/Silver Theme */
.wei-city .city-card {
    border: 1px solid #1E90FF;
    background-color: rgba(0, 0, 70, 0.85);
}

.wei-city .city-card h3 {
    color: silver;
    border-bottom-color: rgba(192, 192, 192, 0.4);
}

.wei-city .info-item {
    color: silver;
}

.wei-city .action-buttons button {
    background-color: rgba(30, 144, 255, 0.8);
    border: 1px solid silver;
}

/* 天渺 (Wu) - Gold/Brown Theme */
.wu-city .city-card {
    border: 1px solid #DAA520;
    background-color: rgba(70, 50, 0, 0.85);
}

.wu-city .city-card h3 {
    color: #DAA520;
    border-bottom-color: rgba(218, 165, 32, 0.4);
}

.wu-city .info-item {
    color: #DAA520;
}

.wu-city .action-buttons button {
    background-color: rgba(218, 165, 32, 0.8);
    border: 1px solid #8B4513;
    color: #ffffff;
}

/* Add these to your existing responsive sections */
@media (max-width: 599px) {
    .shu-city .mobile-action-buttons button {
        background-color: rgba(139, 0, 0, 0.8);
    }
    
    .wei-city .mobile-action-buttons button {
        background-color: rgba(30, 144, 255, 0.8);
    }
    
    .wu-city .mobile-action-buttons button {
        background-color: rgba(218, 165, 32, 0.8);
    }
}

/* ================= */
/* RESPONSIVE LAYOUTS */
/* ================= */

/* 平板 (600px+) */
@media (min-width: 600px) {
    .cities-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        padding: 30px 20px;
    }
    
    .city-card {
        padding: 25px;
    }
}

/* 桌面 (1024px+) */
@media (min-width: 1024px) {
    #overworld.active {
        display: grid;
        grid-template-columns: 300px 1fr;
        grid-template-rows: auto 1fr;
        gap: 35px;
        padding: 35px 25px;
    }

    .header {
        grid-column: 1 / -1;
        position: static;
    }

    .cities-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 30px;
    }
	.action-buttons {
		flex-direction: column;
	}
}

/* ==================== */
/* MOBILE SPECIFIC STYLES - 修正版 */
/* ==================== */
@media (max-width: 599px) {
    #overworld.active {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    /* 隱藏左側面板 */
    .left-panel {
        display: none;
    }

    /* 固定header */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background-color: rgba(0, 0, 0, 0.5);
        padding: 10px 3px;
    }

    /* 右側面板全寬 */
    .right-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        width: 100%;
		margin: 46px 1px;
		top: -36px;
    }

    /* 城市容器滾動區域 */
    #cities-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px;
    }

    /* 移動版專用行動按鈕欄 */
    .mobile-action-buttons {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(0, 0, 0, 0.9);
        padding: 10px;
        z-index: 1000;
        gap: 10px;
        border-top: 1px solid rgba(255, 215, 0, 0.3);
    }

    .mobile-action-buttons button {
        flex: 1;
        padding: 12px;
        font-size: 0.9rem;
        background-color: rgba(139, 0, 0, 0.8);
        color: white;
        border: none;
        border-radius: 5px;
    }

    /* 隱藏桌面元素 */
    .search-container,
    .city-group:not(:first-child) {
        display: none !important;
    }
}

/* 桌面樣式保持不變 */
@media (min-width: 600px) {
    .mobile-action-buttons {
        display: none !important;
    }
}

/* ==================== */
/* DESKTOP SPECIFIC STYLES */
/* ==================== */
@media (min-width: 1023px) {
    /* Show all elements on desktop */
    #faction-info,
    .search-container,
    .city-group {
        display: block !important;
    }
}
/* Ensure proper transitions between mobile and desktop */
@media (min-width: 600px) {
    .left-panel {
        display: block !important;
		height: 60vh;
    }
    
    .action-buttons {
        position: static !important;
        background-color: transparent !important;
    }
}
@media (max-width: 1023px) {
    .left-panel {
		height: 60vh;
    }
	.search-container
	{
		display: none !important;
	}
}
@media (min-width: 1024px) {
    .left-panel {
		height: 75vh;
    }
}