/**
 * 건물 구매 UI 스타일 (L2-10)
 * 
 * BEM 네이밍 컨벤션 사용
 * 
 * @author 슬뚜
 * @version 1.0.0
 * @since 2026-01-22
 */

/* === 컨테이너 === */
.building-shop {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: linear-gradient(135deg, var(--color-bg-dark, #1a0f0a) 0%, var(--color-bg-medium, #2d1b0e) 100%);
    border-radius: 12px;
    border: 2px solid var(--color-primary, #8b4513);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    max-width: 95vw;
}

/* === 섹션 === */
.building-shop__section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.building-shop__title {
    font-size: 12px;
    font-weight: bold;
    color: var(--color-text-secondary, #bdbdbd);
    min-width: 40px;
    text-align: center;
}

.building-shop__buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* === 건물 버튼 === */
.building-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    padding: 4px;
    background: linear-gradient(180deg,
            var(--color-primary-light, #a0522d) 0%,
            var(--color-primary, #8b4513) 50%,
            var(--color-primary-dark, #5d3a1a) 100%);
    border: 2px solid var(--color-primary-dark, #5d3a1a);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-family: inherit;
}

.building-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
    border-color: var(--color-gold, #ffd700);
}

.building-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* === 버튼 내부 요소 === */
.building-btn__icon {
    font-size: 24px;
    line-height: 1;
}

.building-btn__cost {
    font-size: 11px;
    font-weight: bold;
    color: var(--color-gold, #ffd700);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin-top: 2px;
}

/* === 비활성화 상태 === */
.building-btn:disabled,
.building-btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(50%);
}

.building-btn--disabled .building-btn__cost {
    color: var(--color-text-muted, #757575);
}

/* === 선택됨 상태 === */
.building-btn--selected {
    border-color: var(--color-gold, #ffd700);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    /* L3-12: Bounce + Pulse 애니메이션 */
    animation: btn-bounce 0.3s ease, pulse-gold 1s infinite 0.3s;
}

/* L3-12: 버튼 선택 시 bounce 효과 */
@keyframes btn-bounce {
    0%, 100% { transform: translateY(-2px) scale(1); }
    50% { transform: translateY(-2px) scale(1.1); }
}

@keyframes pulse-gold {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.8);
    }
}

/* L3-12: 호버 시 아이콘 wiggle 효과 */
.building-btn:hover:not(:disabled) .building-btn__icon {
    animation: icon-wiggle 0.3s ease;
}

@keyframes icon-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* === 생산 건물 색상 === */
.building-shop__section--production .building-btn {
    background: linear-gradient(180deg,
            #6d8b3d 0%,
            #4a6b2a 50%,
            #3d5a22 100%);
    border-color: #3d5a22;
}

.building-shop__section--production .building-btn:hover:not(:disabled) {
    border-color: #a5d46a;
}

/* === 방어 건물 색상 === */
.building-shop__section--defense .building-btn {
    background: linear-gradient(180deg,
            #8b6b4a 0%,
            #6b4a2a 50%,
            #5a3d22 100%);
    border-color: #5a3d22;
}

.building-shop__section--defense .building-btn:hover:not(:disabled) {
    border-color: #c9a87c;
}

/* === 반응형 === */
@media (max-width: 480px) {
    .building-shop {
        padding: 8px;
        gap: 6px;
        bottom: 5px;
    }

    .building-btn {
        width: 50px;
        height: 50px;
    }

    .building-btn__icon {
        font-size: 20px;
    }

    .building-btn__cost {
        font-size: 10px;
    }

    .building-shop__title {
        font-size: 10px;
        min-width: 32px;
    }
}

/* === 드래그 중 버튼 상태 (260202) === */
.building-btn--dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* === 드래그 오버레이 (260202) === */
.building-drag-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    display: none;
    font-size: 32px;
    transform: translate(-50%, -50%);
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
    transition: opacity 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* === 숨김 상태 트랜지션 === */
.building-shop[style*="display: none"] {
    pointer-events: none;
}

.building-shop.building-shop--hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(100%);
    pointer-events: none;
}