/* 모바일 주문 버튼 - 바텀 네비게이션 위 */
.mobile-floating-order-btn {
    display: none;
    position: fixed;
    bottom: 66px; /* 바텀 네비 높이(56px) + 간격(10px) */
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 400px;
    padding: 16px;
    background: var(--color-buy);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 999;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(14, 203, 129, 0.3);
    transition: all 0.3s;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 768px) {
    .mobile-floating-order-btn {
        display: flex;
    }
}

.mobile-floating-order-btn:hover {
    background: #0db574;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 203, 129, 0.4);
}

.mobile-floating-order-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.mobile-floating-order-btn svg {
    width: 20px;
    height: 20px;
}

/* iOS 안전 영역 대응 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-floating-order-btn {
        bottom: calc(56px + env(safe-area-inset-bottom) + 10px);
    }
}

/* 포지션 패널이 있을 때 간격 조정 */
.position-panel + .mobile-floating-order-btn {
    bottom: 76px; /* 약간 더 높게 */
}

/* 차트 컨트롤의 주문 버튼은 숨기기 (하단 버튼이 있으므로) */
@media (max-width: 768px) {
    .mobile-order-chart-btn {
        display: none !important;
    }
}
.mobile-order-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.mobile-order-modal.show {
    display: block;
}

/* 모달 오버레이 */
.mobile-order-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-order-modal.show .mobile-order-modal-overlay {
    opacity: 1;
}

/* 모달 컨테이너 */
.mobile-order-modal-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.mobile-order-modal.show .mobile-order-modal-container {
    transform: translateY(0);
}

/* 모달 헤더 */
.mobile-order-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.mobile-order-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-order-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.mobile-order-modal-close:hover {
    background: var(--bg-hover);
}

/* 모달 바디 */
.mobile-order-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: env(safe-area-inset-bottom, 20px); /* iOS 하단 안전 영역 */
}

/* PC 주문 폼 스타일 조정 */
.mobile-order-modal-body .order-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    height: auto;
}

/* 포지션 모드 셀렉터 */
.mobile-order-modal-body .position-mode-selector {
    margin-bottom: 8px;
}

/* 주문 타입과 레버리지 간격 조정 */
.mobile-order-modal-body .order-tabs {
    margin-bottom: 4px;
}

.mobile-order-modal-body .order-type-selector {
    margin-bottom: 8px;
}

.mobile-order-modal-body .leverage-selector {
    margin-bottom: 8px;
}

/* 입력 필드 간격 */
.mobile-order-modal-body .order-inputs {
    gap: 12px;
}

/* 제출 버튼 스타일 */
.mobile-order-modal-body .order-submit-btn {
    margin-top: 16px;
    padding: 16px;
    font-size: 16px;
    border-radius: 8px;
}

/* 태블릿 대응 */
@media (min-width: 769px) {
    .mobile-order-modal {
        display: none !important;
    }
}

/* 작은 화면 대응 */
@media (max-height: 600px) {
    .mobile-order-modal-container {
        max-height: 85vh;
    }
    
    .mobile-order-modal-body {
        padding: 12px;
    }
    
    .mobile-order-modal-body .order-inputs {
        gap: 8px;
    }
}

/* iOS 안전 영역 대응 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-order-modal-body {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* 스크롤바 스타일 */
.mobile-order-modal-body::-webkit-scrollbar {
    width: 4px;
}

.mobile-order-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-order-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* 애니메이션 개선 */
@media (prefers-reduced-motion: reduce) {
    .mobile-order-modal-overlay,
    .mobile-order-modal-container {
        transition: none;
    }
}
