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

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

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

.shu-city .personnel-container,
.shu-city .personnel-subpage {
    border-color: rgba(255, 215, 0, 0.4);
}

.shu-city .personnel-option {
    border-color: rgba(255, 215, 0, 0.3);
}

.shu-city .personnel-option:hover {
    background-color: rgba(139, 0, 0, 0.2);
}

.shu-city .personnel-subpage h3,
.shu-city #personnel-city-name {
    color: #ffcc00;
}

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

.wei-city .personnel-container,
.wei-city .personnel-subpage {
    border-color: rgba(192, 192, 192, 0.4);
}

.wei-city .personnel-option {
    border-color: rgba(192, 192, 192, 0.3);
}

.wei-city .personnel-option:hover {
    background-color: rgba(30, 144, 255, 0.2);
}

.wei-city .personnel-subpage h3,
.wei-city #personnel-city-name {
    color: silver;
}

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

.wu-city .personnel-container,
.wu-city .personnel-subpage {
    border-color: rgba(139, 69, 19, 0.4);
}

.wu-city .personnel-option {
    border-color: rgba(139, 69, 19, 0.3);
}

.wu-city .personnel-option:hover {
    background-color: rgba(218, 165, 32, 0.2);
}

.wu-city .personnel-subpage h3,
.wu-city #personnel-city-name {
    color: #DAA520;
}

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

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

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

/* Faction-specific general items */
.shu-city .general-item {
    border-left: 4px solid #8B0000;
}

.wei-city .general-item {
    border-left: 4px solid #1E90FF;
}

.wu-city .general-item {
    border-left: 4px solid #DAA520;
}

/* ===== 基本樣式 ===== */
/* 背景遮罩層 */
#personnel-view::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

/* 確保內容在遮罩層上方 */
#personnel-view .header,
#personnel-view .personnel-container {
    position: relative;
    z-index: 1;
}

/* 城市名稱標題樣式 */
#personnel-city-name {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-size: 1.3rem;
    margin-bottom: 20px;
}

/* ===== 主容器佈局 ===== */
.personnel-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
}

/* 操作按鈕行 */
.personnel-options-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* 單個操作選項樣式 */
.personnel-option {
    flex: 1;
    min-width: 50px;
    border-radius: 8px;
    padding: 15px;
    background-color: rgba(40, 40, 40, 0.8);
    transition: all 0.3s ease;
}

.personnel-option:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.personnel-option:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* 武將狀態顯示區 */
.personnel-status {
    width: 100%;
    background-color: rgba(30, 30, 30, 0.8);
    padding: 15px;
    border-radius: 8px;
    order: 2;
}

.general-search-item {
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    color: #ffffff;
}

/* ===== 特殊按鈕樣式 ===== */
/* 城主任命按鈕 */
.appoint-lord-btn {
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 獎賞按鈕 */
#reward-btn, #mobile-reward-btn {
    background-color: rgba(50, 205, 50, 0.7);
    color: white;
    margin: 17px;
}

#reward-btn:hover, #mobile-reward-btn:hover {
    background-color: rgba(50, 205, 50, 0.9);
}

/* 重賞按鈕 */
#heavy-reward-btn, #mobile-heavy-reward-btn {
    background-color: rgba(255, 165, 0, 0.7);
    color: white;
    margin: 17px;
}

#heavy-reward-btn:hover, #mobile-heavy-reward-btn:hover {
    background-color: rgba(255, 165, 0, 0.9);
}

/* 寵幸按鈕 */
#favor-btn, #mobile-favor-btn {
    background-color: rgba(255, 105, 180, 0.7);
    color: white;
    margin: 17px;
}

#favor-btn:hover, #mobile-favor-btn:hover {
    background-color: rgba(255, 105, 180, 0.9);
}

/* 解雇按鈕 */
#dismiss-btn, #mobile-dismiss-btn {
    background-color: rgba(220, 20, 60, 0.7);
    color: white;
    margin: 17px;
}

#dismiss-btn:hover, #mobile-dismiss-btn:hover {
    background-color: rgba(220, 20, 60, 0.9);
}

/* ===== 子頁面樣式 ===== */
.personnel-subpage {
    display: none;
    position: relative;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.personnel-subpage.active {
    display: block;
}

/* 子頁面標題 */
.personnel-subpage h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* 解雇子頁面特殊段落樣式 */
#dismiss-subpage.personal-subpage.active p {
    padding: 5px;
}

/* 返回按鈕 */
.back-to-personnel {
    display: inline-block;
    margin-bottom: 20px;
    padding: 5px 10px;
    border-radius: 5px;
}

/* ===== 手機版樣式 ===== */
@media (max-width: 478px) {
    /* 隱藏電腦版元素 */
    .personnel-status,
    #search-general-select,
    #general-to-reward,
    #general-to-move,
    #general-to-appoint,
    #target-city-move,
    .city-resources {
        display: none !important;
    }

    /* 顯示手機版元素 */
    #mobile-search-general-select,
    #mobile-general-to-reward,
    #mobile-general-to-move,
    #mobile-general-to-appoint,
    #mobile-target-city-move {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }

    /* 調整主容器 */
    .personnel-container {
        padding: 10px;
        margin-top: 10px;
    }
    
    /* 田字形網格佈局 */
    .personnel-options-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        gap: 10px;
        height: 60vh;
        margin-bottom: 10px;
    }

    /* 網格選項樣式 */
    .personnel-option {
        min-height: 0;
        height: 100%;
        padding: 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .personnel-option h3 {
        margin: 5px 0;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    /* 隱藏電腦版內容 */
    .personnel-option-content {
        display: none !important;
    }

    /* 功能按鈕顏色區分 */
    .personnel-option[data-subpage="favor"] {
        background-color: rgba(255, 105, 180, 0.1);
    }

    .personnel-option[data-subpage="dismiss"] {
        background-color: rgba(220, 20, 60, 0.1);
    }

    /* 全屏子頁面 */
    .personnel-subpage {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.80);
        z-index: 1000;
        margin: 0;
        padding: 20px;
    }

    /* 手機版表單元素 */
    .personnel-subpage select {
        width: 90%;
        height: 50px;
        margin: 15px auto;
        padding: 12px 15px;
        font-size: 1.1rem;
        background-color: rgba(255, 255, 255, 0.9);
        border: 2px solid;
        border-radius: 8px;
        color: #333;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        appearance: none;
        background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" 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 15px center;
        background-size: 20px;
        transition: all 0.3s ease;
    }

    .personnel-subpage select:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
    }

    .personnel-subpage button {
        width: 90%;
        height: 50px;
        margin: 20px auto;
        padding: 12px;
        font-size: 1.1rem;
        background-color: rgba(255, 215, 0, 0.7);
        border: none;
        border-radius: 8px;
        color: #333;
        font-weight: bold;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
        transition: all 0.3s ease;
    }

    .personnel-subpage button:active {
        transform: scale(0.98);
        background-color: rgba(255, 215, 0, 0.9);
    }
}