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

/* Base styles for all factions */
#diplomacy-view {
    background-image: url('../img/diplomacy.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 700px;
    position: relative;
    padding: 20px;
    color: #fff;
    font-size: 1rem;
}

/* 山歌 (Shu) - Red/Gold Theme */
.shu-city #diplomacy-view::before {
    background-color: rgba(139, 0, 0, 0.4);
}

.shu-city .diplomacy-container,
.shu-city .faction-list,
.shu-city .diplomacy-actions {
    border-color: rgba(255, 215, 0, 0.4);
}

.shu-city .faction-item {
    border-color: rgba(255, 215, 0, 0.4);
}

.shu-city .faction-item.selected {
    background-color: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}
.shu-city #faction-item h4 {
    color: #ffcc00;
}
.shu-city #diplomacy-general-select,
.shu-city #diplomacy-action {
	color: #ffcc00;
}

/* 神仙 (Wei) - Blue/Silver Theme */
.wei-city #diplomacy-view::before {
    background-color: rgba(30, 144, 255, 0.3);
}

.wei-city .diplomacy-container,
.wei-city .faction-list,
.wei-city .diplomacy-actions {
    border-color: rgba(192, 192, 192, 0.4);
}

.wei-city .faction-item {
    border-color: rgba(192, 192, 192, 0.4);
}

.wei-city #faction-item h4 {
    color: #ffffff;
}
.wei-city #diplomacy-general-select,
.wei-city #diplomacy-action {
	color: #ffffff;
}
	
.wei-city .faction-item.selected {
    background-color: rgba(192, 192, 192, 0.15);
    border-color: rgba(192, 192, 192, 0.7);
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.4);
}

/* 天渺 (Wu) - Gold/Brown Theme */
.wu-city #diplomacy-view::before {
    background-color: rgba(218, 165, 32, 0.3);
}

.wu-city .diplomacy-container,
.wu-city .faction-list,
.wu-city .diplomacy-actions {
    border-color: rgba(139, 69, 19, 0.4);
}

.wu-city .faction-item {
    border-color: rgba(139, 69, 19, 0.4);
}

.wu-city .faction-item.selected {
    background-color: rgba(218, 165, 32, 0.15);
    border-color: rgba(139, 69, 19, 0.7);
    box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
}

.wu-city #diplomacy-general-select,
.wu-city #diplomacy-action {
	color: #ffcc00;
}

/* Faction-specific button styles */
.shu-city #execute-diplomacy,
.shu-city #return-city-from-diplomacy {
    background-color: rgba(139, 0, 0, 0.8);
    border: 1px solid gold;
}

.wei-city #execute-diplomacy,
.wei-city #return-city-from-diplomacy {
    background-color: rgba(30, 144, 255, 0.8);
    border: 1px solid silver;
}

.wu-city #execute-diplomacy,
.wu-city #return-city-from-diplomacy {
    background-color: rgba(218, 165, 32, 0.8);
    border: 1px solid #8B4513;
    color: #333;
}

/* Faction-specific relation bars */
.shu-city .relation-fill {
    background: linear-gradient(90deg, #8B0000, #ffcc00);
}

.wei-city .relation-fill {
    background: linear-gradient(90deg, #1E90FF, #a0d8ff);
}

.wu-city .relation-fill {
    background: linear-gradient(90deg, #DAA520, #f5e6b3);
}


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

#diplomacy-view .header,
#diplomacy-view .diplomacy-container {
    position: relative;
    z-index: 1;
}

#diplomacy-city-name {
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-size: 2rem;
    margin-bottom: 20px;
}

.diplomacy-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.faction-list {
    width: 30%;
    background-color: rgba(30, 30, 30, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.diplomacy-actions {
    width: 70%;
    background-color: rgba(30, 30, 30, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

/* 修改勢力項目樣式，整合關係顯示 */
.faction-item {
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: rgba(50, 50, 50, 0.6);
    color: #fff;
    position: relative;
}

.faction-item .relation-info {
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.faction-item .relation-value {
    margin-right: 10px;
    font-size: 0.9rem;
    color: #ffcc00;
}

.wei-city .faction-item .relation-value {
	    color: #ffffff;
}
.faction-item:hover {
    background-color: rgba(255, 215, 0, 0.1);
    transform: translateX(5px);
}

.faction-item.selected {
    background-color: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.faction-item h4 {
    margin-bottom: 8px;
    color: #ffcc00;
    font-size: 1.1rem;
}
.wei-city .faction-item h4 {
	color: #ffffff;
}
.relation-bar {
    height: 8px;
    background-color: rgba(0, 0, 0, 0.3);
    margin-top: 8px;
    border-radius: 4px;
    overflow: hidden;
}

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

/* 移除原有的關係狀態區塊樣式 */
#relations-status {
    display: none;
}

#action-params {
    margin: 15px 0;
    padding: 15px;
    background-color: rgba(40, 40, 40, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.param-group {
    margin-bottom: 15px;
}

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ffcc00;
}

.param-group input,
.param-group select {
    width: 100%;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #555;
    border-radius: 4px;
}

#diplomacy-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    background-color: rgba(40, 40, 40, 0.7);
    min-height: 60px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #fff;
    font-style: italic;
}

#relations-status {
    margin-top: 15px;
}

.relation-item {
    margin-bottom: 12px;
    padding: 12px;
    background-color: rgba(50, 50, 50, 0.6);
    border-radius: 6px;
    border-left: 3px solid #ffcc00;
}

#execute-diplomacy {
    background-color: rgba(139, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 215, 0, 0.5);
    transition: all 0.3s;
}

#execute-diplomacy:hover {
    background-color: rgba(165, 42, 42, 0.9);
    transform: scale(1.05);
}

#return-city-from-diplomacy {
    background-color: rgba(139, 0, 0, 0.8);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#return-city-from-diplomacy:hover {
    background-color: rgba(165, 42, 42, 0.9);
}

.diplomacy-resources span {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
    margin-right: 10px;
    color: #fff;
}


/* 手機版樣式調整 */
@media (max-width: 768px) {
    #diplomacy-view {
        font-size: 1rem;
        min-height: 500px;
        padding: 2px;
    }
    
    #diplomacy-city-name {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .diplomacy-container {
        flex-direction: column;
        gap: 15px;
        margin-top: 15px;
        padding: 15px;
    }
    
    .faction-list,
    .diplomacy-actions {
        width: 100%;
        padding: 1px;
    }
    
    /* 勢力列表改為網格布局，每行兩個項目 */
    #factions-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
   .faction-item {
        margin-bottom: 8px;
        padding: 4px;
        margin-left: 9px;
        margin-right: 12px;
    }
    
    .faction-item h4 {
        font-size: 0.95rem;
    }
    
    .faction-item p {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .relation-bar {
        height: 6px;
    }
    
    /* 調整外交行動區塊 */
    .diplomacy-option {
        padding: 10px;
    }
    
    .param-group input,
    .param-group select {
        padding: 6px;
        font-size: 14px;
    }
    
    #diplomacy-result {
        font-size: 14px;
        padding: 10px;
    }
	.desktop-display
	{
		display:none;
	}
}

/* 針對非常小的設備進一步調整 */
@media (max-width: 480px) {
    #diplomacy-view {
        font-size: 0.8rem;
        min-height: 400px;
        padding: 4px;
    }
    
    #factions-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .faction-item h4 {
        font-size: 0.9rem;
    }
    
    .faction-item p {
        font-size: 0.8rem;
    }
    
    .param-group input,
    .param-group select {
        padding: 5px;
        font-size: 12px;
    }
}
/* 在現有的 @media (max-width: 768px) 區塊中添加以下樣式 */
@media (max-width: 768px) {
    
    /* 美化手機版 SELECT BOX */
    #diplomacy-general-select,
    #diplomacy-action {
        width: 100%;
        padding: 10px;
        margin: 8px 0;
        background-color: rgba(50, 50, 50, 0.9);
        border: 1px solid rgba(255, 215, 0, 0.5);
        border-radius: 6px;
        font-size: 0.95rem;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23ffcc00" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 16px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }
    /* 聚焦狀態 */
    #diplomacy-general-select:focus,
    #diplomacy-action:focus {
        outline: none;
        border-color: #ffcc00;
        box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.3);
    }
    
    /* 選項樣式 */
    #diplomacy-general-select option,
    #diplomacy-action option {
        background-color: rgba(30, 30, 30, 0.9);
        color: #fff;
        padding: 8px;
    }
    
    /* 選中選項樣式 */
    #diplomacy-general-select option:checked,
    #diplomacy-action option:checked {
        background-color: rgba(139, 0, 0, 0.7);
        color: #ffcc00;
    }
    #wei-city select
	{
		color: #ffffff;
	}
    /* 行動參數區域美化 */
    #action-params {
        margin: 1px 0;
        padding: 12px;
        background-color: rgba(40, 40, 40, 0.8);
    }
    
    .param-group select,
    .param-group input {
        padding: 8px;
        background-color: rgba(30, 30, 30, 0.9);
        color: #fff;
        border: 1px solid rgba(255, 215, 0, 0.3);
        border-radius: 4px;
    }
	.diplomacy-resources {
		display:none;
	}
	.diplomacy-relation-detail {
		display:none;
	}
}

/* 在現有的 @media (max-width: 480px) 區塊中添加以下樣式 */
@media (max-width: 480px) {

    /* 更小的設備進一步調整 */
    #diplomacy-general-select,
    #diplomacy-action {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .param-group select,
    .param-group input {
        padding: 6px;
    }
    
    /* 調整下拉箭頭大小 */
    #diplomacy-general-select,
    #diplomacy-action {
        background-size: 14px;
        background-position: right 8px center;
    }
}