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

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

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

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

.trade-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    background: #444;
    border-radius: 4px;
    border-left: 3px solid #ffd700;
}

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

.trade-info-value {
    color: #fff;
    font-weight: bold;
}

.trade-cities {
    margin-bottom: 15px;
}

.trade-cities-title {
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
}

.season-legend {
    display: flex;
    gap: 8px;
    font-size: 11px;
    align-items: center;
}

.season-legend::before {
    content: '필터: ';
    font-size: 10px;
    color: #ccc;
    margin-right: 4px;
}

.legend-item {
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    border: 2px solid transparent;
}

.legend-item:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.legend-item.peak {
    background: #e74c3c;
    color: white;
}

.legend-item.off {
    background: #3498db;
    color: white;
}

.legend-item.regular {
    background: #27ae60;
    color: white;
}

/* 활성 상태 스타일 */
.legend-item.active {
    opacity: 1;
    border-color: #ffd700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.legend-item.active:hover {
    border-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* 비활성 상태 스타일 */
.legend-item.inactive {
    opacity: 0.4;
    background: #666 !important;
    color: #ccc !important;
    border-color: #999;
    position: relative;
}

.legend-item.inactive::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #ff4444;
    transform: translateY(-50%);
    border-radius: 1px;
}

.legend-item.inactive:hover {
    opacity: 0.6;
    transform: scale(1.02);
    border-color: #ffd700;
}

/* 클릭 효과 */
.legend-item:active {
    transform: scale(0.95);
}

.trade-cities-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
    overflow-y: auto;
    position: relative;
}

.trade-city-item {
    background: #444;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    border-left: 4px solid #666;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.trade-city-item:hover {
    background: #555;
    transform: translateX(2px);
}

.trade-city-item.peak-season {
    border-left-color: #e74c3c;
    background: rgba(231, 76, 60, 0.15);
}

.trade-city-item.off-season {
    border-left-color: #3498db;
    background: rgba(52, 152, 219, 0.15);
}

.trade-city-item.regular-season {
    border-left-color: #27ae60;
    background: rgba(39, 174, 96, 0.15);
}

/* 도시 아이템 애니메이션 */
.trade-city-item.hidden {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.trade-city-item.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.trade-city-item.fade-out {
    animation: fadeOut 0.3s ease-out;
}

.city-number {
    background: #666;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.trade-city-item.peak-season .city-number {
    background: #e74c3c;
}

.trade-city-item.off-season .city-number {
    background: #3498db;
}

.trade-city-item.regular-season .city-number {
    background: #27ae60;
}

.trade-city-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-city-name {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
}

.trade-city-region {
    font-size: 11px;
    color: #aaa;
}

.trade-city-season-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.trade-city-season {
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: bold;
    text-align: center;
    min-width: 40px;
}

.trade-city-season.peak {
    background: #e74c3c;
    color: white;
}

.trade-city-season.off {
    background: #3498db;
    color: white;
}

.trade-city-season.regular {
    background: #27ae60;
    color: white;
}

.climate-info {
    font-size: 9px;
    color: #999;
    text-align: center;
}

.trade-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

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

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

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

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

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

.trade-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;
}

.trade-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;
}

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

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

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

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

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

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

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

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

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

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

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

/* 도시 개수 표시 개선 */
.cities-count {
    position: absolute;
    right: 0;
    top: 0;
    background: #444;
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
}

/* 필터 상태 표시기 */
.filter-status {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    font-size: 9px;
    color: #ccc;
}

.filter-status.has-filters {
    color: #ffd700;
}

.filter-status::before {
    content: '●';
    font-size: 8px;
}

/* 애니메이션 클래스 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 리스트 재정렬 애니메이션 */
.trade-city-item.reordering {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 호버 시 설명 툴팁 */
.legend-item.active::after {
    content: attr(data-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: 1000;
}

.legend-item.active:hover::after {
    opacity: 1;
}

/* 접근성 개선 */
.legend-item:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

.legend-item[aria-pressed="true"] {
    /* 스크린 리더용 활성 상태 */
}

.legend-item[aria-pressed="false"] {
    /* 스크린 리더용 비활성 상태 */
}

/* 스크롤바 스타일링 */
.trade-cities-list::-webkit-scrollbar {
    width: 6px;
}

.trade-cities-list::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

.trade-cities-list::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

.trade-cities-list::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .trade-basic-info {
        grid-template-columns: 1fr;
    }
    
    .trade-controls {
        flex-direction: column;
    }
    
    .trade-popup {
        min-width: 300px;
    }
    
    .trade-cities-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .season-legend {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .legend-item {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    .season-legend::before {
        content: '필터:';
        font-size: 9px;
    }
    
    .trade-city-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .trade-city-season-info {
        align-items: flex-start;
        flex-direction: row;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .trade-info-title {
        font-size: 16px;
    }
    
    .trade-basic-info {
        font-size: 12px;
    }
    
    .trade-cities-title {
        font-size: 14px;
    }
    
    .trade-city-item {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .city-number {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .trade-city-name {
        font-size: 13px;
    }
    
    .trade-city-region {
        font-size: 10px;
    }
    
    .trade-city-season {
        font-size: 9px;
        padding: 2px 4px;
        min-width: 35px;
    }
    
    .climate-info {
        font-size: 8px;
    }
    
    .legend-item {
        font-size: 8px;
        padding: 2px 6px;
    }
    
    .season-legend::before {
        font-size: 8px;
    }
}

/* 고해상도 디스플레이 대응 */
@media (min-resolution: 2dppx) {
    .legend-item {
        border-width: 1px;
    }
    
    .trade-city-item {
        border-left-width: 3px;
    }
    
    .trade-info-item {
        border-left-width: 2px;
    }
}

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

/* 애니메이션 감소 설정 지원 */
@media (prefers-reduced-motion: reduce) {
    .trade-city-item,
    .legend-item,
    .trade-btn,
    .trade-popup-item {
        transition: none;
    }
    
    .fade-in,
    .fade-out {
        animation: none;
    }
    
    .legend-item:hover {
        transform: none;
    }
    
    .trade-city-item:hover {
        transform: none;
    }
}

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