.barter-calculator {
    font-family: 'Arial', sans-serif;
}

.barter-info-container {
    background: #333;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.barter-info-title {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}

.barter-basic-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 13px;
}

.barter-info-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    background: #444;
    border-radius: 4px;
}

.barter-info-label {
    color: #ffd700;
    font-weight: bold;
}

.barter-info-value {
    color: #ccc;
}

.barter-villages {
    margin-bottom: 15px;
}

.barter-villages-title {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.barter-villages-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.barter-village-item {
    background: #4ecdc4;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid #3bafae;
}

.barter-materials {
    margin-bottom: 15px;
}

.barter-materials-title {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.barter-materials-hint {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 10px;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
    padding: 8px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ffd700;
}

.barter-material-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.barter-material-item {
    background: #444;
    padding: 10px;
    border-radius: 4px;
    border-left: 4px solid #ffd700;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.barter-material-item:hover {
    background: #555;
    transform: translateX(3px);
}

.barter-material-item.highlighted {
    background: rgba(78, 205, 196, 0.3) !important;
    transform: scale(1.02);
    border-left-color: #4ecdc4 !important;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
}

.sub-materials .barter-material-item.highlighted {
    background: rgba(78, 205, 196, 0.25) !important;
    border-left-color: #4ecdc4 !important;
    box-shadow: 0 1px 4px rgba(78, 205, 196, 0.3);
}

.barter-material-item.highlighted .material-name-text {
    color: #4ecdc4 !important;
    font-weight: bold;
}

.barter-material-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.barter-material-info {
    flex: 1;
}

.barter-material-name {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
}

.barter-material-qty {
    font-size: 12px;
    color: #ccc;
}

.barter-material-badge {
    font-size: 11px;
    color: #999;
    text-align: right;
}

.barter-material-color {
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 2px;
    color: white;
    font-size: 10px;
}

.expand-icon {
    display: inline-block;
    margin-right: 5px;
    font-size: 12px;
    color: #ccc;
    transition: transform 0.3s ease;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    user-select: none;
    pointer-events: auto;
}

.expand-icon:hover {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

.material-name-text {
    transition: color 0.3s ease;
    padding: 2px 4px;
    border-radius: 2px;
}

.barter-material-item:hover .material-name-text {
    color: #fff;
}

.sub-materials {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #666;
}

.sub-materials .barter-material-item {
    background: #3a3a3a;
    margin-bottom: 5px;
}

.sub-materials .barter-material-item:hover {
    background: #4a4a4a;
}

.barter-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.barter-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.barter-btn-primary {
    background: #45b7d1;
    color: #fff;
}

.barter-btn-primary:hover {
    background: #3a9bc1;
}

.barter-btn-secondary {
    background: #666;
    color: #fff;
}

.barter-btn-secondary:hover {
    background: #777;
}

.barter-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2a2a;
    color: #fff;
    border: 2px solid #ffd700;
    border-radius: 8px;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    min-width: 400px;
    max-width: 90vw;
}

.barter-popup-header {
    text-align: center;
    background: #ffd700;
    color: #1a1a1a;
    margin: 0;
    padding: 15px;
    border-radius: 6px 6px 0 0;
    font-size: 16px;
    font-weight: bold;
}

.barter-popup-content {
    padding: 20px;
}

.barter-popup-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.barter-popup-item {
    cursor: pointer;
    margin: 8px 0;
    padding: 12px;
    background: #333;
    border-radius: 4px;
    transition: background 0.3s;
    border-left: 3px solid #555;
}

.barter-popup-item:hover {
    background: #444;
    border-left-color: #ffd700;
}

.barter-popup-item.selected {
    background: #ffd700;
    color: #1a1a1a;
    border-left-color: #1a1a1a;
}

.barter-popup-buttons {
    text-align: center;
    margin-top: 20px;
}

.barter-popup-btn {
    margin: 5px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.barter-popup-btn-confirm {
    background: #ffd700;
    color: #1a1a1a;
}

.barter-popup-btn-confirm:hover {
    background: #e6c200;
}

.barter-popup-btn-cancel {
    background: #666;
    color: #fff;
}

.barter-popup-btn-cancel:hover {
    background: #777;
}

.barter-exchange-info {
    background: #2a2a2a;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #555;
}

.barter-exchange-title {
    color: #ffd700;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
}

.barter-exchange-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 12px;
}

.barter-exchange-item {
    display: flex;
    justify-content: space-between;
    color: #ccc;
}

/* =================================
   이중마커 시스템 스타일 (개선된 버전)
   ================================= */

/* 계절 마커 (내부 마커) - 줌에 따른 동적 크기 조정 및 안정성 개선 */
.season-marker {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 8px !important; /* 기본 크기 */
    height: 8px !important;
    border: 1px solid white !important; /* 기본 테두리 */
    border-radius: 50% !important;
    z-index: 1000 !important;
    pointer-events: none !important;
    box-shadow: 0 0 4px rgba(0,0,0,0.6) !important; /* 그림자 강화 */
    transition: all 0.2s ease !important; /* 부드러운 전환 */
    
    /* 확대/축소 시 부드러운 전환 및 안정성 */
    will-change: width, height, border-width !important;
    
    /* 마커 안정성을 위한 추가 속성 */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 마커 컨테이너 위치 설정 - 안정성 개선 */
.city-icon {
    position: relative !important;
    display: inline-block !important;
}

/* 이중마커 컨테이너 - 안정성 개선 */
.dual-marker-container {
    position: relative !important;
    display: inline-block !important;
}

.dual-marker-container:hover .season-marker {
    transform: translate(-50%, -50%) scale(1.15) !important;
    box-shadow: 0 0 8px rgba(0,0,0,0.8) !important;
}

/* 계절별 색상 정의 (더 진한 색상) */
.season-marker.peak {
    background: #e74c3c !important; /* 성수기 - 빨간색 */
}

.season-marker.regular {
    background: #27ae60 !important; /* 평수기 - 녹색 */
}

.season-marker.off {
    background: #3498db !important; /* 비수기 - 파란색 */
}

/* 마커 상태별 스타일 - 안정성 개선 */
.marker-trade-city {
    position: relative !important;
}

.marker-trade-city img {
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
}

.marker-barter-village img {
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
}

/* 이중마커 호버 효과 개선 */
.marker-trade-city:hover img {
    transform: scale(1.1) !important;
}

.marker-trade-city:hover .season-marker {
    transform: translate(-50%, -50%) scale(1.25) !important;
    box-shadow: 0 0 8px rgba(0,0,0,0.8) !important;
}

/* 계절 정보 툴팁 스타일 */
.season-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1001;
}

.season-marker:hover + .season-tooltip,
.city-icon:hover .season-tooltip {
    opacity: 1;
}

/* 마커 상태 표시기 */
.marker-status-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffd700;
    border: 1px solid white;
    z-index: 1001;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* 재료별 마커 그룹 효과 */
.material-group-marker {
    position: relative;
}

.material-group-marker::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    z-index: -1;
    animation: rotate 3s linear infinite;
}

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

/* 줌 레벨별 마커 크기 최적화 - 더 세밀한 조정 */
@media screen and (min-width: 1200px) {
    .season-marker {
        min-width: 6px !important;
        min-height: 6px !important;
        max-width: 20px !important;
        max-height: 20px !important;
    }
}

/* 고해상도 디스플레이에서 마커 선명도 개선 */
@media (min-resolution: 2dppx) {
    .season-marker {
        box-shadow: 0 0 3px rgba(0,0,0,0.8) !important;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .barter-basic-info {
        grid-template-columns: 1fr;
    }
    
    .barter-controls {
        flex-direction: column;
    }
    
    .barter-material-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .barter-popup {
        min-width: 300px;
    }
    
    .barter-material-name {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .barter-exchange-details {
        grid-template-columns: 1fr;
    }
    
    /* 모바일에서 내부마커 크기 유지 */
    .season-marker {
        min-width: 6px !important;
        min-height: 6px !important;
        max-width: 14px !important;
        max-height: 14px !important;
    }
    
    .barter-materials-hint {
        font-size: 10px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .barter-info-title {
        font-size: 14px;
    }
    
    .barter-basic-info {
        font-size: 12px;
    }
    
    .barter-material-item {
        padding: 8px;
        font-size: 12px;
    }
    
    .barter-material-name {
        font-size: 13px;
    }
    
    .barter-material-qty {
        font-size: 11px;
    }
    
    /* 소형 화면에서도 적당한 마커 크기 유지 */
    .season-marker {
        min-width: 5px !important;
        min-height: 5px !important;
        max-width: 12px !important;
        max-height: 12px !important;
    }
}

/* 다크모드 추가 지원 */
@media (prefers-color-scheme: dark) {
    .barter-calculator {
        /* 이미 다크 테마이므로 추가 조정 불필요 */
    }
}

/* 애니메이션 감소 설정 지원 */
@media (prefers-reduced-motion: reduce) {
    .barter-material-item,
    .barter-btn,
    .barter-popup-item,
    .season-marker,
    .marker-status-indicator {
        transition: none !important;
        animation: none !important;
    }
    
    .dual-marker-container:hover .season-marker {
        transform: translate(-50%, -50%) !important;
    }
    
    .marker-trade-city:hover img {
        transform: none !important;
    }
    
    .material-group-marker::before {
        animation: none !important;
    }
}

/* 프린트 스타일 */
@media print {
    .barter-calculator {
        background: white !important;
        color: black !important;
    }
    
    .barter-info-container,
    .barter-villages,
    .barter-materials {
        background: white !important;
        border: 1px solid #000 !important;
    }
    
    .barter-info-title {
        color: #000 !important;
        border-bottom-color: #000 !important;
    }
    
    .barter-info-item {
        background: #f5f5f5 !important;
    }
    
    .barter-info-label,
    .barter-info-value {
        color: #000 !important;
    }
    
    .barter-material-item {
        background: #f9f9f9 !important;
        border-left-color: #666 !important;
        color: #000 !important;
    }
    
    .barter-material-name {
        color: #000 !important;
    }
    
    .barter-controls,
    .barter-popup,
    .season-marker {
        display: none !important;
    }
}