/* 주간보스 시급계산기 전용 스타일 (데스크탑 & 모바일 통합 최적화) */

/* 테이블 전체 컨테이너 */
#boss-table-header, 
#boss-list-container {
    max-width: 100%;
}

#boss-table-header {
    background-color: #f0f0f0;
    color: #555;
    font-weight: 600;
    border: 1px solid #e0e0e0;
    border-bottom: 2px solid #d0d0d0;
    border-radius: 8px 8px 0 0;
    margin-top: 2em;
}

#boss-list-container {
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background-color: #fff;
    margin-bottom: 2em;
}

.boss-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding: 0.8em 0.5em;
    transition: background-color 0.2s ease-in-out;
    cursor: pointer;
    background-color: #fff;
    font-size: 0.95em;
}

.boss-row:hover { background-color: #f5f5f5; }

.boss-row.selected {
    background-color: #fffde7;
    position: relative;
    box-shadow: inset 4px 0 0 #f5a207;
}

.boss-row.header {
    cursor: default;
    padding: 1em 0.5em;
    border: none;
    background: transparent;
}

.boss-row > span { text-align: center; }

/* 컬럼별 너비 (데스크탑) */
.boss-name { 
    width: 20%; 
    padding-left: 1em; 
    font-weight: 600; 
    text-align: left !important; 
    display: flex;
    align-items: center;
    gap: 10px;
}

.boss-row.header .boss-name {
    display: block;
}

.boss-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8f8f8;
}

.boss-difficulty { width: 15%; }
.party-size-per-boss { width: 10%; }
.crystal-price { width: 15%; text-align: right !important; padding-right: 1em; font-weight: 600; color: #2e7d32; }
.clear-time-per-boss { width: 12%; }
.actual-clear-time { width: 13%; }
.hourly-rate-won { width: 15%; text-align: right !important; padding-right: 1em; font-weight: bold; color: #c62828; }

/* 캐릭터 관리 탭 */
.character-management {
    margin-bottom: 1.5em;
    border-bottom: 2px solid #ddd;
    display: flex;
    align-items: center; /* 하단 정렬에서 중앙 정렬로 변경하여 줄바꿈 시 정렬 최적화 */
    flex-wrap: wrap; /* 줄바꿈 허용 */
    gap: 4px;
    padding-bottom: 8px;
}

.char-tab {
    padding: 3px 8px;
    background: #e9ecef;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px; 
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.char-tab.active {
    background: #f5a623;
    color: white;
    border-color: #f5a623;
}

.add-char-btn {
    padding: 3px 8px !important;
    font-size: 0.95em !important;
    height: auto !important;
    min-height: unset !important;
    margin-bottom: 2px;
    background-color: #8ebebc !important;
    white-space: nowrap;
    border-radius: 6px !important;
}

.add-char-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
    opacity: 0.6;
    background-image: none !important;
}

.delete-char-btn {
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.1);
    color: #888;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}
.char-tab.active .delete-char-btn { background: rgba(255,255,255,0.3); color: white; }
.delete-char-btn:hover { background: #e74c3c !important; color: white !important; }

/* 요약 카드 디자인 정제 - 통일성 있는 색상 체계 */
.summary-container { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 2em; 
}

.summary-card {
    flex: 1; 
    padding: 1.5em; 
    background: #ffffff; 
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    border-top: 4px solid #f5a623;
    position: relative;
    transition: all 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.summary-card.account {
    border-top-color: #607d8b;
}

.summary-card h3 { 
    font-size: 1.05em; 
    font-weight: 700; 
    margin-bottom: 1.2em; 
    color: #444; 
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.8em;
}

.summary-card .col-6 {
    margin-bottom: 12px;
}

.summary-card strong { 
    font-size: 0.95em; 
    color: #888; 
    font-weight: 600;
    margin-bottom: 2px;
}

.summary-card div[id] { 
    font-size: 1.05em; 
    font-weight: 700; 
}

/* 색상 그룹화 (Group 1: 활동 지표 - Slate) */
#selected-boss-count, #total-char-count, 
#total-clear-time-hours, #account-total-time { 
    color: #546e7a !important; 
}

/* 색상 그룹화 (Group 2: 수익 지표 - Amber/Orange) */
#weekly-profit, #account-total-profit,
#weekly-profit-won-val, #account-total-profit-won-val,
#weekly-profit-mepo-val, #account-total-profit-mepo-val { 
    color: #e67e22 !important; 
}

/* 색상 그룹화 (Group 3: 최종 결과 - Teal) */
#total-weekly-hourly-wage, #account-hourly-wage { 
    color: #00897b !important; 
}

/* 다크모드 대응 - 채도 조절 및 가시성 확보 */
body.dark-mode .summary-card {
    background: #252525;
    border-color: #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

body.dark-mode .summary-card h3 { color: #eee; border-bottom-color: #333; }
body.dark-mode .summary-card strong { color: #999; }

body.dark-mode #selected-boss-count, body.dark-mode #total-char-count,
body.dark-mode #total-clear-time-hours, body.dark-mode #account-total-time { 
    color: #90a4ae !important; 
}

body.dark-mode #weekly-profit, body.dark-mode #account-total-profit,
body.dark-mode #weekly-profit-won-val, body.dark-mode #account-total-profit-won-val,
body.dark-mode #weekly-profit-mepo-val, body.dark-mode #account-total-profit-mepo-val { 
    color: #ffb74d !important; 
}

body.dark-mode #total-weekly-hourly-wage, body.dark-mode #account-hourly-wage { 
    color: #4db6ac !important; 
}

/* 셀렉트 및 입력창 디자인 */
.boss-row select, .boss-row input {
    width: 100%; padding: 4px 8px; border-radius: 6px; border: 1px solid #ccc;
    background-color: #fff; font-size: 0.95em; transition: border-color 0.2s;
}
.boss-row select:hover, .boss-row input:focus { border-color: #f5a623; outline: none; }

/* 반응형 (모바일) 최적화 */
@media screen and (max-width: 960px) {
    #boss-table-header { display: none; }
    #boss-list-container { border: none; background: transparent; }
    
    .summary-container { flex-direction: column; }
    
    .boss-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.2em;
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 12px;
        box-shadow: 0 3px 6px rgba(0,0,0,0.05);
        position: relative;
        overflow: hidden;
        background-color: #fff;
        transition: all 0.2s ease;
    }

    /* 보스 배경 이미지 가상 요소 (카드 전체 꽉 차게) */
    .boss-row::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: var(--boss-bg);
        background-size: cover; /* 비율 유지하며 꽉 채움 */
        background-repeat: no-repeat;
        background-position: center; /* 중앙 배치 */
        opacity: 0.07; /* 크기가 커진 만큼 더 은은하게 조정 */
        z-index: 0;
        pointer-events: none;
    }

    /* 내부 콘텐츠가 배경 위로 오도록 설정 */
    .boss-row > span {
        position: relative;
        z-index: 1;
    }

    .boss-row.selected {
        background-color: #fffbeb;
        border: 2px solid #f5a207; /* 선택 시 테두리 강조 */
        box-shadow: 0 4px 12px rgba(245, 162, 7, 0.15);
    }

    .boss-row.selected::before {
        opacity: 0.2; /* 선택된 보스는 이미지를 조금 더 진하게 */
    }

    .boss-name { 
        width: 100%; font-size: 1.1em; margin-bottom: 0.8em; padding-left: 0;
        border-bottom: 2px solid #f5a623; padding-bottom: 0.4em; color: #333;
    }

    .boss-difficulty, .party-size-per-boss, .crystal-price, 
    .clear-time-per-boss, .actual-clear-time, .hourly-rate-won {
        width: 100%; display: flex; justify-content: space-between; align-items: center;
        padding: 0.4em 0; border-bottom: 1px solid #f5f5f5;
    }

    /* 모바일 레이블 주입 */
    .boss-difficulty::before { content: "난이도"; font-weight: bold; color: #888; font-size: 0.95em; }
    .party-size-per-boss::before { content: "파티인원"; font-weight: bold; color: #888; font-size: 0.95em; }
    .crystal-price::before { content: "획득 메소"; font-weight: bold; color: #888; font-size: 0.95em; }
    .clear-time-per-boss::before { content: "최저시급컷(분)"; font-weight: bold; color: #888; font-size: 0.95em; }
    .actual-clear-time::before { content: "클리어타임(분)"; font-weight: bold; color: #888; font-size: 0.95em; }
    .hourly-rate-won::before { content: "시급환산(원)"; font-weight: bold; color: #888; font-size: 0.95em; }

    .boss-row select, .boss-row input {
        width: 50% !important; max-width: none; text-align: right !important;
    }
    
    .crystal-price, .hourly-rate-won { padding-right: 0 !important; }
}

/* 다크모드 대응 */
body.dark-mode #boss-table-header {
    background-color: #333;
    color: #eee;
    border-color: #444;
    border-bottom-color: #555;
}

body.dark-mode #boss-list-container {
    background-color: #1e1e1e;
    border-color: #444;
}

body.dark-mode .boss-row {
    background-color: #1e1e1e;
    border-bottom-color: #333;
    color: #ccc;
}

body.dark-mode .boss-row:hover {
    background-color: #2d2d2d;
}

body.dark-mode .boss-row.selected {
    background-color: #2d2a1e;
    box-shadow: inset 4px 0 0 #f5a207;
}

body.dark-mode .boss-name {
    color: #ffffff; /* 완전한 흰색으로 변경 */
    font-weight: 700; /* 글자 두께를 더 두껍게 */
}

body.dark-mode .boss-row.header .boss-name {
    color: #f5a623; /* 헤더의 '보스명'은 포인트 색상으로 강조 */
}

body.dark-mode .boss-difficulty,
body.dark-mode .party-size-per-boss,
body.dark-mode .clear-time-per-boss,
body.dark-mode .actual-clear-time {
    color: #bbb; /* 다른 수치들은 적절한 밝은 회색 */
}

body.dark-mode .boss-icon {
    background: #333;
}

body.dark-mode .crystal-price {
    color: #81c784; /* 밝은 초록 */
}

body.dark-mode .hourly-rate-won {
    color: #e57373; /* 밝은 빨강 */
}

body.dark-mode .char-tab {
    background: #333;
    border-color: #444;
    color: #aaa;
}

body.dark-mode .char-tab.active {
    background: #f5a623;
    color: white;
    border-color: #f5a623;
}

body.dark-mode .character-management {
    border-bottom-color: #444;
}

body.dark-mode .char-nickname-section label {
    color: #aaa;
}

body.dark-mode .summary-card h3 {
    color: #fff;
    border-bottom-color: #444;
}

body.dark-mode .accordion-header {
    color: #eee;
}

body.dark-mode .accordion-content {
    color: #ccc;
}

body.dark-mode .delete-char-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
}

body.dark-mode .char-tab.active .delete-char-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 모바일 다크모드 레이블 */
@media screen and (max-width: 960px) {
    body.dark-mode .boss-row {
        border-color: #444;
        background-color: #252525;
        background-image: none; /* 기존 배경 방식 제거 */
    }

    body.dark-mode .boss-row::before {
        opacity: 0.15; /* 다크모드에서 이미지 가시성 약간 증가 */
    }

    body.dark-mode .boss-row.selected {
        background-color: #2d2a1e;
        border-color: #f5a207;
    }

    body.dark-mode .boss-row.selected::before {
        opacity: 0.25;
    }
    
    body.dark-mode .boss-name {
        border-bottom-color: #f5a623;
        color: #fff;
    }

    body.dark-mode .boss-difficulty::before,
    body.dark-mode .party-size-per-boss::before,
    body.dark-mode .crystal-price::before,
    body.dark-mode .clear-time-per-boss::before,
    body.dark-mode .actual-clear-time::before,
    body.dark-mode .hourly-rate-won::before {
        color: #888;
    }

    body.dark-mode .boss-difficulty, 
    body.dark-mode .party-size-per-boss, 
    body.dark-mode .crystal-price, 
    body.dark-mode .clear-time-per-boss, 
    body.dark-mode .actual-clear-time, 
    body.dark-mode .hourly-rate-won {
        border-bottom-color: #333;
    }
}
