/* 모바일 플로팅 버튼 */
.mobile-floating-buttons {
    display: none;
}

@media (max-width: 768px) {
    .mobile-floating-buttons {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 80px;  /* 20px에서 80px로 증가 */
        right: 20px;
        z-index: 1000;  /* 9999에서 1000으로 조정 */
        gap: 12px;
    }
    
    .mobile-floating-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #2c5aa0;
        color: white;
        box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
        transition: all 0.3s ease;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        text-decoration: none;
        position: relative;
        border: none;
    }
    
    .mobile-floating-btn:active {
        transform: scale(0.95);
    }
    
    .mobile-floating-btn svg {
        width: 24px;
        height: 24px;
    }
    
    /* 메인 플로팅 버튼 (메뉴) */
    .mobile-floating-btn.primary {
        background: #2c5aa0;
        animation: floatingPulse 2s ease-in-out infinite;
        z-index: 1003;  /* 메뉴가 열리면 닫기 버튼이 되므로 가장 높게 */
    }
    
    /* TOP 버튼 (보조) */
    .mobile-floating-btn.secondary {
        background: white;
        border: 1px solid #e0e0e0;
        color: #666;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        display: none;
        z-index: 998;  /* 팝업 버튼(999)보다 낮게 설정 */
    }
    
    .mobile-floating-btn.secondary svg {
        width: 24px;
        height: 24px;
    }
    
    @keyframes floatingPulse {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
        }
        50% {
            box-shadow: 0 4px 20px rgba(44, 90, 160, 0.5);
        }
    }
    
    /* 보조 버튼들 (초기엔 숨김) */
    .mobile-floating-menu {
        position: absolute;
        bottom: 120px; /* 100px에서 120px로 더 위로 올림 */
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: center;  /* 중앙 정렬으로 다시 변경 */
        gap: 25px;  /* 간격을 20px에서 25px로 더 넓힘 */
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.3s ease;
        padding-bottom: 20px; /* 하단 여백 증가 */
    }
    
    .mobile-floating-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .mobile-floating-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: white;
        color: #333;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        text-decoration: none;
        transform: scale(0);
        transition: transform 0.3s ease;
        border: none;
        position: relative;
        z-index: 1002;  /* 메뉴 버튼들의 z-index */
    }
    
    /* 네이버 예약 버튼 특별 스타일 */
    .mobile-floating-menu-btn.naver-booking {
        background: white;
        border: 1px solid #e0e0e0;
    }
    
    .mobile-floating-menu.active .mobile-floating-menu-btn {
        transform: scale(1);
    }
    
    .mobile-floating-menu.active .mobile-floating-menu-btn:nth-child(3) {
        transition-delay: 0.05s;
    }
    
    .mobile-floating-menu.active .mobile-floating-menu-btn:nth-child(2) {
        transition-delay: 0.1s;
    }
    
    .mobile-floating-menu.active .mobile-floating-menu-btn:nth-child(1) {
        transition-delay: 0.15s;
    }
    
    .mobile-floating-menu-btn:active {
        transform: scale(0.9);
    }
    
    .mobile-floating-menu-btn svg {
        width: 24px;
        height: 24px;
    }
    
    /* 라벨 툴팁 */
    .floating-btn-label {
        position: absolute;
        right: 68px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 6px 12px;
        border-radius: 4px;
        font-size: 12px;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        pointer-events: none;
    }
    
    /* 진료예약 버튼 라벨 */
    .floating-btn-label.booking {
        padding: 8px 14px;
        font-size: 13px;
        font-weight: 500;
    }
    
    .floating-btn-label::after {
        content: '';
        position: absolute;
        right: -5px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-left: 5px solid rgba(0, 0, 0, 0.8);
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
    }
    
    .mobile-floating-menu-btn:hover .floating-btn-label {
        opacity: 1;
        visibility: visible;
    }
    
    /* 메인 버튼 회전 애니메이션 */
    .mobile-floating-btn.primary .icon-default {
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .mobile-floating-btn.primary .icon-close {
        position: absolute;
        opacity: 0;
        transform: rotate(-45deg);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .mobile-floating-btn.primary.menu-open .icon-default {
        opacity: 0;
        transform: rotate(45deg);
    }
    
    .mobile-floating-btn.primary.menu-open .icon-close {
        opacity: 1;
        transform: rotate(0);
    }
}

/* Safe Area 대응 */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .mobile-floating-buttons {
            bottom: calc(80px + env(safe-area-inset-bottom));  /* 20px에서 80px로 수정 */
            right: calc(20px + env(safe-area-inset-right));
        }
    }
}
