/* 客戶端手機版樣式：只影響 Customer 前台頁面（Views/Shared/_Layout.cshtml），不影響管理後台。 */

:root {
    --customer-mobile-nav-height: 64px;
}

* {
    touch-action: manipulation;
}

@media (max-width: 767.98px) {
    body.customer-mobile-nav-active {
        padding-bottom: calc(var(--customer-mobile-nav-height) + env(safe-area-inset-bottom));
    }

    /* 全站按鈕在手機上維持至少 44px 觸控高度。 */
    .btn {
        min-height: 44px;
    }
}

/* 客戶角色手機版：上方 Navbar 只留品牌 Logo，選單／按鈕改由底部導覽與「我的」offcanvas 提供，避免兩套導覽重複。 */
@media (max-width: 767.98px) {
    .customer-mobile-navbar .navbar-toggler,
    .customer-mobile-navbar #mainNav {
        display: none;
    }
}

/* 底部導覽列 */
.customer-mobile-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1060;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: var(--customer-mobile-nav-height);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    background: rgba(3, 8, 22, .92);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .35);
    backdrop-filter: blur(18px);
}

.customer-mobile-nav-item {
    display: flex;
    flex: 1 1 0;
    min-width: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    border: 0;
    background: transparent;
    color: var(--np-muted, #9fb4d1);
    font-size: .72rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.1;
}

.customer-mobile-nav-item i {
    font-size: 1.3rem;
}

.customer-mobile-nav-item.active {
    color: var(--np-cyan, #25f4ee);
    text-shadow: 0 0 12px rgba(37, 244, 238, .4);
}

.customer-mobile-nav-item-primary {
    color: var(--np-text, #f8fbff);
}

.customer-mobile-nav-fab {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin-top: -1.6rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #10b981 0%, #25f4ee 100%);
    box-shadow: 0 .5rem 1.1rem rgba(16, 185, 129, .38), 0 0 0 4px rgba(3, 8, 22, .92);
    color: #031827;
    font-size: 1.4rem;
}

.customer-mobile-nav-item-primary.active .customer-mobile-nav-fab {
    box-shadow: 0 .6rem 1.4rem rgba(37, 244, 238, .5), 0 0 0 4px rgba(3, 8, 22, .92);
}

/* 我的 offcanvas */
.customer-mobile-profile-offcanvas {
    width: min(320px, 86vw);
    border-left: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    background: rgba(7, 18, 37, .98);
    color: var(--np-text, #f8fbff);
}

.customer-mobile-profile-card {
    padding: .9rem 1rem;
    border: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    border-radius: 8px;
    background: rgba(37, 244, 238, .08);
}

/* 密碼顯示/隱藏按鈕，供登入頁與修改密碼頁共用 */
.customer-password-field {
    position: relative;
}

.customer-password-field input {
    padding-right: 2.75rem;
}

.customer-password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: grid;
    place-items: center;
    width: 2.75rem;
    border: 0;
    background: transparent;
    color: var(--np-muted, #9fb4d1);
}

.customer-password-toggle:focus-visible {
    outline: 2px solid var(--np-cyan, #25f4ee);
    outline-offset: -2px;
}

/* 登入頁手機版：表單優先，品牌介紹簡化 */
@media (max-width: 767.98px) {
    .np-login-shell {
        display: flex;
        flex-direction: column;
    }

    .np-login-shell .np-login-card {
        order: -1;
    }

    .np-login-brand-full {
        display: none;
    }
}

/* 客戶首頁手機版：先看到帳號、餘額、下單、快速入口 */
@media (max-width: 767.98px) {
    .customer-dashboard-hero-full {
        display: none;
    }

    .customer-dashboard-hero-mobile {
        display: block;
    }

    .customer-quick-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .65rem;
    }

    .customer-quick-links a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .35rem;
        min-height: 4.5rem;
        padding: .75rem;
        text-align: center;
        font-size: .85rem;
        color: var(--np-text, #f8fbff);
    }
}

@media (min-width: 768px) {
    .customer-dashboard-hero-mobile {
        display: none;
    }
}

/* 服務列表手機卡片 */
.service-mobile-card {
    display: grid;
    gap: .4rem;
    padding: .95rem 1rem;
    border: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    border-radius: 8px;
    background: rgba(3, 8, 22, .48);
}

.service-mobile-card-title {
    overflow-wrap: anywhere;
    font-weight: 800;
}

.service-mobile-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1rem;
    color: var(--np-muted, #9fb4d1);
    font-size: .82rem;
}

.service-platform-chip-row {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .3rem;
    -webkit-overflow-scrolling: touch;
}

.service-platform-chip-row::-webkit-scrollbar {
    height: 6px;
}

.service-platform-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 2.4rem;
    padding: .4rem .85rem;
    border: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    border-radius: 999px;
    background: rgba(3, 8, 22, .48);
    color: var(--np-muted, #9fb4d1);
    font-size: .85rem;
    font-weight: 700;
    white-space: nowrap;
}

.service-platform-chip.active {
    border-color: rgba(37, 244, 238, .7);
    background: rgba(37, 244, 238, .14);
    color: var(--np-cyan, #25f4ee);
}

/* 手機簡化分頁：只顯示上一頁／頁數／下一頁 */
.mobile-pager-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.mobile-pager-simple .btn {
    flex: 0 0 auto;
}

.mobile-pager-simple .mobile-pager-status {
    flex: 1 1 auto;
    text-align: center;
    color: var(--np-muted, #9fb4d1);
    font-size: .85rem;
}

/* 建立訂單手機三步驟 */
@media (max-width: 767.98px) {
    .order-wizard-step {
        display: none;
    }

    .order-wizard-step.is-active {
        display: block;
    }

    .order-wizard-steps-indicator {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .5rem;
        margin-bottom: .85rem;
        color: var(--np-muted, #9fb4d1);
        font-size: .82rem;
        font-weight: 800;
    }

    .manual-order-preview {
        position: static;
    }

    .order-wizard-sticky-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--customer-mobile-nav-height, 0px);
        z-index: 1050;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .65rem .9rem calc(.65rem + env(safe-area-inset-bottom));
        border-top: 1px solid var(--np-border, rgba(126, 179, 255, .22));
        background: rgba(3, 8, 22, .96);
        box-shadow: 0 -.6rem 1.4rem rgba(0, 0, 0, .3);
    }

    body:not(.customer-mobile-nav-active) .order-wizard-sticky-bar {
        bottom: 0;
    }

    .order-wizard-sticky-bar-amount {
        display: grid;
        gap: .1rem;
        color: var(--np-text, #f8fbff);
    }

    .order-wizard-sticky-bar-amount span {
        color: var(--np-muted, #9fb4d1);
        font-size: .74rem;
        font-weight: 700;
    }

    .order-wizard-sticky-bar-amount strong {
        font-size: 1.1rem;
    }

    .order-wizard-sticky-bar .btn {
        flex: 0 0 auto;
        min-width: 9.5rem;
    }

    body.order-wizard-active {
        padding-bottom: calc(4.5rem + var(--customer-mobile-nav-height, 0px) + env(safe-area-inset-bottom));
    }
}

@media (min-width: 768px) {
    .order-wizard-steps-indicator,
    .order-wizard-sticky-bar {
        display: none !important;
    }
}

/* 我的常用手機卡片微調 */
.manual-favorite-option-meta {
    min-width: 0;
}

.manual-favorite-option-meta .text-truncate {
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .manual-favorite-option {
        grid-template-columns: 1fr;
        gap: .75rem;
    }

    .manual-favorite-actions {
        justify-content: space-between;
        gap: .75rem;
    }

    .manual-favorite-actions .btn {
        flex: 1 1 0;
    }
}

/* 訂單明細手機版：狀態優先、直向流程 */
@media (max-width: 767.98px) {
    .order-details-mobile-first {
        order: -1;
    }

    .customer-order-flow {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .customer-order-flow-step {
        position: relative;
        display: flex;
        align-items: flex-start;
        gap: .75rem;
        text-align: left;
        padding: .6rem .25rem;
        border: 0;
        background: transparent;
        border-radius: 0;
    }

    .customer-order-flow-step::before {
        content: "";
        position: absolute;
        left: 1.2rem;
        top: 2.4rem;
        bottom: -.6rem;
        width: 2px;
        background: var(--np-border, rgba(126, 179, 255, .22));
    }

    .customer-order-flow-step:last-child::before {
        display: none;
    }

    .customer-order-flow-dot {
        flex: 0 0 auto;
        margin-bottom: 0;
    }
}

.order-link-copy-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.order-link-copy-row a {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* 我的錢包手機版 */
@media (max-width: 767.98px) {
    .wallet-balance-hero {
        padding: 1.1rem;
        text-align: center;
    }

    .wallet-balance-hero .fs-3 {
        font-size: 2rem !important;
    }

    .wallet-summary-scroll {
        display: flex;
        gap: .65rem;
        overflow-x: auto;
        padding-bottom: .3rem;
        -webkit-overflow-scrolling: touch;
    }

    .wallet-summary-scroll > div {
        flex: 0 0 auto;
        min-width: 9.5rem;
    }
}

.wallet-mobile-card {
    display: grid;
    gap: .35rem;
    padding: .9rem 1rem;
    border: 1px solid var(--np-border, rgba(126, 179, 255, .22));
    border-radius: 8px;
    background: rgba(3, 8, 22, .48);
}

.wallet-mobile-card .amount-credit {
    color: var(--np-success, #32f5a9);
    font-weight: 900;
}

.wallet-mobile-card .amount-debit {
    color: var(--np-danger, #ff4d8d);
    font-weight: 900;
}

/* 修改密碼手機版 */
.password-hint-list {
    display: grid;
    gap: .25rem;
    margin: .4rem 0 0;
    padding: 0;
    list-style: none;
    font-size: .82rem;
}

.password-hint-list li {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--np-muted, #9fb4d1);
}

.password-hint-list li.is-met {
    color: var(--np-success, #32f5a9);
}

.password-hint-list li i {
    font-size: .95rem;
}

/* 手機簡化分頁：只保留上一頁／下一頁，頁碼文字已由各頁 summary 顯示 */
@media (max-width: 767.98px) {
    #servicePager .page-item:not(:first-child):not(:last-child),
    #orderPager .page-item:not(:first-child):not(:last-child),
    #customerWalletPager .page-item:not(:first-child):not(:last-child) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}
