/* =========================================
   Layout, Reset & Global Styles - ?????App??
   ========================================= */

/* ????? */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--custom-font, var(--font-family));
    font-size: var(--font-size-base);
    line-height: 1.5;
    background: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Vue ????????*/
[v-cloak] { display: none !important; }

/* ?????? */
::selection {
    background: #EFEFEF;
    color: #000000;
}

/* ??????- iOS?? */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* =========================================
   App ????
   ========================================= */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    background: transparent;
}

/* 仿手机框布局（移动端 / 桌面端统一样式） */
body.phone-frame-enabled {
    /* 将 app 居中显示在一个“手机外壳”中 */
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f3f3f5;
    padding: max(12px, env(safe-area-inset-top))
             max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom))
             max(12px, env(safe-area-inset-left));
}

body.phone-frame-enabled #app {
    width: min(420px, calc(100vw - 24px));
    height: min(860px, calc(100dvh - 24px));
    border-radius: 32px;
    /* 白色立体机身 + 更厚边框 */
    box-shadow:
        0 22px 60px rgba(0, 0, 0, 0.32),
        0 6px 16px rgba(0, 0, 0, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.65),
        inset 0 -10px 16px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    background: var(--bg-color);
    border: 8px solid #ffffff;
}

/* 桌面端：略微放大设备、增加桌面投影 */
@media (min-width: 481px) {
    body.phone-frame-enabled {
        background: #f5f5f7;
        padding: 24px;
    }

    body.phone-frame-enabled #app {
        height: min(880px, 90vh);
        border-radius: 36px;
        box-shadow:
            0 26px 70px rgba(0, 0, 0, 0.32),
            0 8px 22px rgba(0, 0, 0, 0.2),
            inset 0 0 0 1px rgba(255, 255, 255, 0.75),
            inset 0 -12px 18px rgba(0, 0, 0, 0.12);
        border: 9px solid #ffffff;
        max-height: 900px;
    }
}

/* =========================================
   ???????????????
   ========================================= */

.status-bar-placeholder {
    height: max(20px, env(safe-area-inset-top));
    background: var(--bg-color);
    width: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-4);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-main);
    position: relative;
    z-index: 999;
}

.status-bar-placeholder::before {
    content: attr(data-time);
    position: absolute;
    left: var(--space-6);
}

.status-bar-placeholder::after {
    content: "";
    position: absolute;
    right: var(--space-6);
    width: 20px;
    height: 10px;
    border: 1.5px solid var(--text-sub);
    border-radius: 3px;
    opacity: 0.6;
}

.status-bar-placeholder::after {
    background: #000000;
    background-clip: padding-box;
}

/* =========================================
   ??????
   ========================================= */

.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ???????? */
.main-content::after {
    content: '';
    display: block;
    height: calc(var(--nav-height) + var(--space-8) + env(safe-area-inset-bottom));
}

/* =========================================
   ?????? - ????
   ========================================= */

.fade-enter-active,
.fade-leave-active {
    transition: opacity var(--transition-base);
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

/* ???? - ??iOS?? */
.slide-enter-active {
    transition: transform var(--transition-slow), opacity var(--transition-slow);
}

.slide-leave-active {
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.slide-enter-from {
    transform: translateX(30%);
    opacity: 0.8;
}

.slide-leave-to {
    transform: translateX(-10%);
    opacity: 0.6;
}

/* ???????*/
.slide-up-enter-active,
.slide-up-leave-active {
    transition: transform var(--transition-slow), opacity var(--transition-slow);
}

.slide-up-enter-from {
    transform: translateY(100%);
    opacity: 0.9;
}

.slide-up-leave-to {
    transform: translateY(100%);
    opacity: 0;
}

/* Toast ???? */
.slide-down-enter-active,
.slide-down-leave-active {
    transition: all var(--transition-base);
}

.slide-down-enter-from,
.slide-down-leave-to {
    transform: translateY(-20px);
    opacity: 0;
}

/* =========================================
   ??????- ??????
   ========================================= */

.bottom-nav {
    position: fixed;
    bottom: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--space-8));
    max-width: 360px;
    height: 64px;
    background: var(--footer-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-radius: var(--radius-2xl);
    padding: 0 var(--space-3);
    z-index: 100;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: env(safe-area-inset-bottom);
}

body.phone-frame-enabled .bottom-nav {
    position: absolute;
    bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
}

body.phone-frame-enabled .footer-layout {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--icon-default);
    font-size: var(--font-size-xs);
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    border-radius: var(--radius-lg);
    user-select: none;
}

.nav-item i {
    font-size: 22px;
    transition: all var(--transition-base);
}

.nav-item span {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ?????*/
.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active i {
    transform: scale(1.05);
}

/* ????? */
.nav-item.active::before {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    animation: navDot 0.3s ease forwards;
}

@keyframes navDot {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

/* ???? */
.nav-item:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.03);
}

/* =========================================
   ??????
   ========================================= */

.page-content {
    padding: var(--space-5) 0;
    padding-bottom: calc(var(--nav-height) + var(--space-10));
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--space-5);
    color: var(--text-main);
    padding: 0 var(--space-5);
    letter-spacing: -0.02em;
}

/* =========================================
   ???? - ??????
   ========================================= */

.card-container {
    background: var(--white);
    margin: 0 var(--space-4);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-4);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.card-item {
    padding: var(--space-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background var(--transition-fast);
}

.card-item:last-child {
    border-bottom: none;
}

.card-item:active {
    background: rgba(0, 0, 0, 0.02);
}

/* =========================================
   Toast ??
   ========================================= */

.toast-message {
    position: fixed;
    top: calc(env(safe-area-inset-top) + var(--space-6));
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-3) var(--space-5);
    background: var(--white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-main);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.toast-message.success {
    background: linear-gradient(135deg, #F0FFF4 0%, #C6F6D5 100%);
    color: #276749;
}

.toast-message.error {
    background: linear-gradient(135deg, #FFF5F5 0%, #FED7D7 100%);
    color: #C53030;
}

.toast-message.warning {
    background: linear-gradient(135deg, #FFFAF0 0%, #FEEBC8 100%);
    color: #C05621;
}

/* =========================================
   ????
   ========================================= */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.p-4 { padding: var(--space-4); }

