/* 手机安全区域系统 - 适配刘海屏和手势条 */

/* iOS 安全区域变量 */
:root {
    --safe-top: max(env(safe-area-inset-top), 44px);
    --safe-bottom: max(env(safe-area-inset-bottom), 34px);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

/* 手机刘海屏适配 */
.phone-notch {
    padding-top: var(--safe-top);
}

/* 手机底部手势条适配 */
.phone-gesture {
    padding-bottom: var(--safe-bottom);
}

/* 顶部导航栏 - 带状态栏 */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-primary);
    padding-top: max(env(safe-area-inset-top), 20px);
    padding-bottom: 12px;
}

/* 底部导航栏 - 带手势条 */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
}

/* 内容区域 - 避开顶部和底部 */
.app-content {
    min-height: calc(100vh - var(--safe-top) - var(--safe-bottom));
    padding-top: 8px;
    padding-bottom: 80px; /* 底部导航栏高度 + 安全区域 */
}

/* 全屏弹窗 - 完整安全区域 */
.modal-fullscreen {
    position: fixed;
    inset: 0;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

/* 底部弹窗 - 手势条适配 */
.modal-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
    border-radius: 24px 24px 0 0;
}

/* 顶部固定搜索栏 */
.search-bar-fixed {
    position: sticky;
    top: max(env(safe-area-inset-top), 20px);
    z-index: 40;
}

/* 页面容器 - 完整适配 */
.page-container {
    min-height: 100vh;
    padding-top: max(env(safe-area-inset-top), 20px);
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
}

/* 滚动内容区域 */
.scroll-content {
    padding-bottom: calc(60px + max(env(safe-area-inset-bottom), 20px));
}

/* 固定按钮 - 底部安全区域 */
.fixed-button-bottom {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 20px);
    left: 16px;
    right: 16px;
    z-index: 90;
}

/* 小米刘海适配 */
@supports (padding: max(0px)) {
    .xiaomi-notch {
        padding-top: max(44px, env(safe-area-inset-top));
    }
}

/* iPhone 刘海适配 */
@supports (padding: env(safe-area-inset-top)) {
    .iphone-notch {
        padding-top: env(safe-area-inset-top);
    }
}

/* 手势条指示器（可选） */
.gesture-indicator {
    width: 134px;
    height: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    margin: 8px auto;
}

/* 状态栏文字颜色适配 */
.status-bar-light {
    color-scheme: light;
}

.status-bar-dark {
    color-scheme: dark;
}

