/*
 * BybitFX – 모바일 반응형 공통 스타일
 * 모든 페이지에서 header.php를 통해 자동 로드됨
 */

/* ===== TOUCH TARGET ===== */
@media (max-width: 1023px) {
    button, a, [role="button"] {
        -webkit-tap-highlight-color: transparent;
    }
    /* 최소 탭 타겟 44px */
    .btn-primary, .btn-outline {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== PREVENT iOS ZOOM ON INPUT ===== */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ===== SAFE AREA (노치/홈바 대응) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 1023px) {
        footer {
            padding-bottom: calc(56px + env(safe-area-inset-bottom));
        }
    }
}

/* ===== PANEL / CARD 모바일 패딩 ===== */
@media (max-width: 767px) {
    .panel {
        border-radius: 8px;
    }
    main {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* ===== TABLE → CARD 전환 (포지션, 히스토리 등) ===== */
@media (max-width: 767px) {
    .mob-card-table thead {
        display: none;
    }
    .mob-card-table tbody tr {
        display: block;
        background: #131722;
        border: 1px solid #1e2535;
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 12px;
    }
    .mob-card-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        border: none;
        font-size: 12px;
    }
    .mob-card-table tbody td::before {
        content: attr(data-label);
        color: #6b7280;
        font-size: 11px;
        font-weight: 600;
        flex-shrink: 0;
        margin-right: 8px;
    }
}

/* ===== EXCHANGE PAGE 모바일 ===== */
@media (max-width: 1023px) {
    /* 거래 화면 전체 높이에서 하단 탭 바 높이 제외 */
    #div-1 {
        height: calc(100vh - 56px - 56px - env(safe-area-inset-bottom, 0px)) !important;
    }
    /* 모바일 탭 표시 */
    #mob-tabs {
        display: flex !important;
    }
    /* 통계 행 가로 스크롤 */
    #div-8 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== FORM PAGES (입금, 회원가입, 로그인) ===== */
@media (max-width: 767px) {
    .max-w-2xl, .max-w-xl, .max-w-md {
        padding-left: 16px;
        padding-right: 16px;
    }
    /* 입력 필드 충분한 높이 */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"] {
        min-height: 48px;
        padding: 12px 16px !important;
    }
    /* 제출 버튼 */
    button[type="submit"], .btn-submit {
        min-height: 52px;
        font-size: 15px;
    }
}

/* ===== MARKETS PAGE 모바일 ===== */
@media (max-width: 767px) {
    .market-row td {
        padding-top: 10px;
        padding-bottom: 10px;
    }
    /* 코인명 줄바꿈 방지 */
    .market-row .coin-name {
        font-size: 13px;
        white-space: nowrap;
    }
}

/* ===== MODAL (전역 Alert) 모바일 ===== */
@media (max-width: 480px) {
    #fx-modal-box {
        width: calc(100% - 24px) !important;
        border-radius: 16px !important;
    }
}

/* ===== FOOTER 모바일 ===== */
@media (max-width: 767px) {
    footer .flex.items-center.justify-between {
        flex-direction: column;
        gap: 6px;
        height: auto !important;
        padding: 10px 16px;
        text-align: center;
    }
}

/* ===== SCROLLBAR 모바일 숨김 ===== */
@media (max-width: 767px) {
    .custom-scroll::-webkit-scrollbar {
        display: none;
    }
    .custom-scroll {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ===== 숫자 (가격) tabular-nums 강제 ===== */
.tabular-nums {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ===== ACTIVE STATE (터치 피드백) ===== */
@media (max-width: 1023px) {
    .mob-nav-item:active,
    button:active {
        opacity: 0.7;
        transition: opacity 0.05s;
    }
}
