/* Synergy Page Styles */

/* Navigation Path and Header Container - 다른 페이지와 동일한 패딩 */
.navigation-path {
    padding: 0px;
}

.header-container {
    padding: 0px;
}

@media (max-width: 1200px) {
    .navigation-path,
    .header-container {
        padding-left: 0px;
        padding-right: 0px;
    }
}

/* Filter Section */
.filter-section {
    margin: 20px 0;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.time-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.time-filter-btn {
    padding: 8px 16px;
    border: 1px solid #333;
    background: var(--card-background);
    color: #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.time-filter-btn:hover {
    filter: brightness(1.1);
    border-color: #555;
}

.time-filter-btn.active {
    background: #730000;
    border-color: #730000;
    color: #fff;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spoiler-checkbox-container {
    display: flex;
    align-items: center;
    margin-left: 12px;
}

.spoiler-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    user-select: none;
}

.spoiler-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.fallback-notice {
    font-size: 14px;
}

.search-container input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid #333;
    background: var(--card-background);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    height: 36px;
}

.search-container input:focus {
    outline: none;
    border-color: #730000;
    background: #1a1a1a;
}

.search-container input::placeholder {
    color: #666;
}

.separator-line {
    height: 1px;
    background: #333;
    margin: 20px 0;
}

/* Main Container */
.synergy-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

/* Character Tabs */
.character-tabs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* display: flex;
    flex-direction: row;
    flex-wrap: wrap;*/
    gap: 8px;
    width: 100%;
}

@media (max-width: 768px) {
    .character-tabs {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .character-tab {
        gap: 6px !important;
        min-width: 0 !important;
        padding: 4px 6px !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left;
    }
    
    .character-tab-image-wrapper {
        position: relative;
    }
    
    .character-tab-image {
        width: 36px !important;
        height: 36px !important;
    }
    
    .character-tab-info {
        width: 100%;
    }
    
    .character-tab-name {
        font-size: 12px !important;
        margin-bottom: 0px !important;
        justify-content: flex-start;
    }
    
    .character-tab-time {
        display: none;
    }

    .character-tab-time-wrapper{
        justify-content: flex-start;
    }

    .character-tab-recommend-mobile {
        display: inline-flex !important;
        position: absolute;
        bottom: 0;
        left: 0;
        z-index: 1;
        padding: 1px;
    }
    
    .character-tab-recommend-desktop {
        display: none !important;
    }

    .detail-time-wrapper {
        justify-content: center;
    }
}

.character-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border: 1px solid #333;
    background: var(--card-background);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    /* min-width: 160px; */
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.character-tab:hover {
    filter: brightness(1.1);
    border-color: #555;
}

.character-tab.active {
    background: #2a1a1a;
    border-color: #730000;
}

.character-tab.hidden {
    display: none;
}

.character-tab-image-wrapper {
    position: relative;
    flex-shrink: 0;
}

.character-tab-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.character-tab-info {
    flex: 1;
    min-width: 0;
}

.character-tab-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.character-tab-time-wrapper {
    display: flex;
    align-items: center;
    gap: 2px;
}

.character-tab-time {
    font-size: 12px;
    color: #999;
}

.character-tab-recommend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    color: #ffd54f;
}

.character-tab-recommend-mobile {
    display: none;
}

.character-tab-recommend-desktop {
    display: inline-flex;
}

.recommend-icon {
    display: block;
    width: 14px;
    height: 14px;
}


/* Character Detail */
.character-detail {
    flex: 1;
    min-width: 0;
    background: var(--card-background);
    border-radius: 12px;
    padding: 24px;
    user-select: text;
}

.detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #730000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 기존 detail-placeholder 스타일 (사용 안 함) */
.detail-placeholder-old {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* Detail Sections */
.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.detail-header-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: contain;
}

.detail-header-info h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #fff;
}

.detail-time-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-header-info .detail-time {
    font-size: 14px;
    color: #999;
}

.romance-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.detail-section {
    margin-bottom: 32px;
}

.detail-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #730000;
}

.detail-section-title.collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: opacity 0.2s ease;
}

.detail-section-title.collapsible:hover {
    opacity: 0.8;
}

.detail-section-title.collapsible span {
    flex: 1;
}

.section-chevron {
    width: 12px;
    height: 12px;
    color: rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease, color 0.2s ease;
    flex-shrink: 0;
    transform: rotate(90deg); /* 초기 상태: 아래 방향 */
}

.detail-section-title.collapsible:hover .section-chevron {
    color: rgba(255, 255, 255, 0.9);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 10000px;
    opacity: 1;
}

.detail-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Special Award Table */
.award-icon {
    width: 32px;
    border-radius: 0px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    display: inline-block;
}

.award-name-recommended {
    color: #ffd54f !important;
    font-weight: 600;
}

.award-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    table-layout: fixed;
}

.award-table th,
.award-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

/* 랭크와 이름 열이 우선적으로 너비 차지 */
.award-table th:nth-child(1),
.award-table td:nth-child(1) {
    width: 39px;
}

.award-table th:nth-child(2),
.award-table td:nth-child(2) {
    width: 180px;
}

/* 보상 열은 나머지 공간 차지 */
.award-table th:nth-child(3),
.award-table td:nth-child(3) {
    width: auto;
}

/* 협력 보상 PC/모바일 레이아웃 */
.award-name-desktop {
    display: block;
}

.award-name-cell {
    display: none;
}

.award-description-desktop {
    display: table-cell;
}

@media (max-width: 768px) {
    .award-table th:nth-child(3),
    .award-table td:nth-child(3) {
        display: none;
    }
    
    .award-reward-header {
        display: none;
    }
    
    .award-name-desktop {
        display: none;
    }
    
    .award-name-cell {
        display: block;
    }
    
    .award-name {
        font-weight: 500;
        margin-bottom: 4px;
    }
    
    .award-description {
        font-size: 12px;
        color: #999;
        line-height: 1.4;
    }
    
    .award-description-desktop {
        display: none;
    }
}

.award-table th {
    background: #333333;
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

.award-table td {
    color: #ccc;
    font-size: 13px;
}

.award-table tr:hover {
    background: #1a1a1a;
}

/* Dialog Events Container */
.dialog-events-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 769px) {
    .dialog-events-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Dialog Event */
.dialog-event {
    margin-bottom: 0;
    padding: 16px;
    background: #1a1a1a;
    border-radius: 8px;
    /* border-left: 3px solid #730000; */
}

.dialog-rank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.dialog-rank-header.no-choices {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.dialog-rank {
    font-size: 14px;
    font-weight: 400;
    color: #fff;
}

.dialog-unlock {
    font-size: 12px;
    color: #999;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

.unlock-stat-icon {
    height: 16px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    display: inline-block;
}

.dialog-rank {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rank-label {
    font-weight: 400;
    color: #999;
}

.rank-chevron {
    display: inline-block;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.6);
}

.rank-target {
    font-weight: 600;
    color: #ffd54f;
}


.dialog-choices {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialog-choice-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialog-choice {
    padding: 10px 12px;
    background: #0f0f0f;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.dialog-choice-number {
    font-size: 14px;
    font-weight: 500;
    color: #999;
    flex-shrink: 0;
    min-width: 20px;
}

.dialog-choice-content {
    flex: 1;
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
}

.dialog-choice-reward {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-left: 12px;
    flex-shrink: 0;
}

.dialog-choice-reward::before {
    content: "+";
    margin-right: 2px;
}

.dialog-choice-reward.max-reward {
    color: #04f7ec;
}

.dialog-choice-content.max-reward {
    color: #ffffff;
}

.dialog-choice-number.max-reward {
    color: #04f7ec;
}

.dialog-choice.low-reward {
    opacity: 0.5;
}

/* Visit Dialog */
.visit-dialog {
    margin-bottom: 0;
    padding: 16px;
    background: #1a1a1a;
    border-radius: 8px;
    /* border-left: 3px solid #0096ff; */
}

.visit-destination {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.visit-destination-image {
    height: 28px;
    object-fit: contain;
    vertical-align: middle;
}

/* Item Table */
.item-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.item-table th,
.item-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #333;
    white-space: nowrap;
    vertical-align: middle;
}

/* Affection 열 (호감도, 최초 선물) 너비 제한 */
.item-table th:nth-child(2),
.item-table td:nth-child(2),
.item-table th:nth-child(3),
.item-table td:nth-child(3) {
    width: 1%;
    padding-left: 8px;
    padding-right: 8px;
}

.item-table td {
    font-size: 13px;
}

.item-table th {
    background: #333333;
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

.item-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.item-table th.sortable:hover {
    background: #3a2a2a;
}

.item-table th.sortable.sorted {
    background: #4a2a2a;
}

.sort-indicator {
    font-size: 12px;
    margin-left: 4px;
    color: #ffd54f;
}

.item-table td {
    color: #ccc;
    font-size: 13px;
}

.item-table tr:hover {
    background: #1a1a1a;
}

.item-image {
    width: 40px;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.money-icon {
    height: 16px;
    width: auto;
    vertical-align: middle;
    margin-right: 4px;
    display: inline-block;
}

.item-table td:first-child {
    padding: 8px 12px 8px 4px;
}

@media (max-width: 768px) {
    .item-table td:first-child {
        max-width: 0;
        overflow: hidden;
    }
}

/* 선호 선물 모바일 레이아웃 */
.item-name-desktop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
}

.item-name-cell {
    display: none;
}

.item-price-desktop,
.item-source-desktop {
    display: table-cell;
}

@media (max-width: 768px) {
    /* 가격과 획득처 열 숨기기 */
    .item-price-header,
    .item-table td:nth-child(3),
    .item-source-header,
    .item-table td:nth-child(7) {
        display: none;
    }
    
    .item-name-desktop {
        display: none;
    }
    
    .item-name-cell {
        display: block;
    }
    
    .item-name-row {
        display: flex;
        align-items: center;
        gap: 4px;
        margin-bottom: 4px;
    }
    
    .item-image {
        width: 30px !important;
    }

    .item-meta-row {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        color: #999;
        margin-left: 34px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .item-price-meta {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }
    
    .item-meta-separator {
        color: #666;
        flex-shrink: 0;
    }
    
    .item-source-meta {
        color: #999;
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
        flex: 1;
        overflow: hidden;
        max-width: 100%;
    }
    
    .item-source-meta > *:not(.item-source-icon) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        flex: 1;
    }
    
    .item-source-meta .item-source-icon {
        flex-shrink: 0;
    }
    
    .item-price-desktop,
    .item-source-desktop {
        display: none;
    }
}

.item-condition-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    line-height: 20px;
}

.item-condition-icon {
    height: 16px;
    width: auto;
    vertical-align: middle;
}

/* 할인가 셀 스타일 */
.discount-cell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 할인 조건 툴팁 아이콘 */
.discount-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 2px;
}

.discount-tooltip-icon svg {
    width: 12px;
    height: 12px;
    transition: opacity 0.2s;
}

.discount-tooltip-icon:hover svg {
    opacity: 0.8;
}

.discount-tooltip-icon.js-tooltip-active svg circle {
    stroke: rgba(255, 255, 255, 0.8);
}

.discount-tooltip-icon.js-tooltip-active svg text {
    fill: rgba(255, 255, 255, 0.8);
}

.item-source {
    font-size: 13px;
    line-height: 1.5;
}

.item-source-text {
    display: inline;
}

.item-source-text-clickable {
    display: inline;
    cursor: pointer;
    transition: color 0.2s;
}

.item-source-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.6;
    transition: opacity 0.2s, filter 0.2s;
}

.item-source-icon:hover {
    opacity: 1;
}

.item-source-text-clickable:hover {
    color: #ffd700;
}

.item-source-icon svg {
    width: 14px;
    height: 14px;
    transition: stroke 0.2s;
}

.item-source-icon:hover svg {
    stroke: #ffd700;
}

/* 행 호버 시 조합식 텍스트와 아이콘 하이라이트 */
tr:hover .item-source-text-clickable {
    color: #ffd700;
}

tr:hover .item-source-icon {
    opacity: 1;
}

tr:hover .item-source-icon svg {
    stroke: #ffd700;
}

.item-efficiency {
    font-weight: 600;
}

/* Item From Modal Styles */
.item-from-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.item-from-modal {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-from-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}

.item-from-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.item-from-modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.item-from-modal-close:hover {
    color: #fff;
}

.item-from-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.item-tree-node {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
    padding: 4px 0;
}

.item-tree-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 2px;
}

.item-tree-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-tree-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.item-tree-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.item-tree-type {
    color: #999;
    font-size: 12px;
}

.item-tree-price {
    color: #04f7ec;
    font-size: 12px;
    font-weight: 500;
}

.item-tree-content-bg {
    color: #aaa;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
    font-style: italic;
}

.item-tree-compound,
.item-tree-seed,
.item-tree-shop {
    margin: 0px 0 8px 0;
    padding-left: 8px;
    border-left: 2px solid #333;
}

.item-tree-label {
    color: #d0d0d0;
    font-size: 13px;
    font-weight: 400;
}

.item-tree-shop-name {
    color: #ccc;
    font-size: 13px;
    margin-left: 4px;
}

/* Responsive */
@media (max-width: 1200px) {
    .character-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
    }
}

@media (max-width: 768px) {
    .filter-header {
        flex-direction: column;
        align-items: stretch;
    }

    .time-filter {
        justify-content: center;
    }

    .search-container {
        max-width: 100%;
    }

    .character-detail {
        padding: 16px;
    }

    .detail-header {
        flex-direction: column;
        text-align: center;
    }

    .award-table,
    .item-table {
        font-size: 12px;
    }

    .award-table th,
    .award-table td,
    .item-table th,
    .item-table td {
        padding: 8px;
    }
    
    /* 모바일에서 아이템 테이블: 이름(1), 호감도(2), 가격(4), 획득처(7)만 표시 */
    /* 최초 선물(3), 효율(5), 할인가(6), 최대(8), 갱신(9) 숨기기 */
    .item-table th:nth-child(3),
    .item-table td:nth-child(3),
    .item-table th:nth-child(5),
    .item-table td:nth-child(5),
    .item-table th:nth-child(6),
    .item-table td:nth-child(6),
    .item-table th:nth-child(8),
    .item-table td:nth-child(8),
    .item-table th:nth-child(9),
    .item-table td:nth-child(9) {
        display: none;
    }
}

/* Unlock Quest Spoiler Styling */
.unlock-quest-content.spoiler {
    position: relative;
    cursor: pointer;
}

.unlock-quest-content.spoiler .unlock-quest-name,
.unlock-quest-content.spoiler .unlock-quest-details {
    filter: blur(4px);
    user-select: none;
    -webkit-user-select: none;
}

.unlock-quest-content.spoiler::after {
    content: 'SPOILER';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
    pointer-events: none;
}

/* Scrollbar Styling */
.character-tabs::-webkit-scrollbar {
    width: 6px;
}

.character-tabs::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 3px;
}

.character-tabs::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.character-tabs::-webkit-scrollbar-thumb:hover {
    background: #666;
}

@media (max-width: 768px) {
    .fallback-notice{
        font-size: 12px !important;
    }

    .spoiler-checkbox-container{
        margin-left: 0px !important;
    }
}

/* 특정 이미지 파일들은 scale 1.1 적용 */
.character-tab-image[src*="Tongyong-touxiang-changfu-matoi.png"],
.character-tab-image[src*="Tongyong-touxiang-changfu-bui.png"],
.detail-header-image[src*="Tongyong-touxiang-changfu-matoi.png"],
.detail-header-image[src*="Tongyong-touxiang-changfu-bui.png"]{
    scale: 1.1;
}

.character-tab-image[src*="Tongyong-touxiang-changfu-turbo.png"],
.detail-header-image[src*="Tongyong-touxiang-changfu-turbo.png"]{
    scale: 1.15;
}