/* ==========================================
   移动端专属 UI 组件
   ========================================== */

/* 移动端底部导航栏 */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 9995;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
        justify-content: space-around;
        align-items: center;
    }
    
    /* 为底部导航留出空间 */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom)) !important;
    }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: relative;
    padding: 4px 0;
}

.bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.bottom-nav-item span {
    font-size: 11px;
    font-weight: 500;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 0 0 2px 2px;
}

/* 卡片操作菜单 */
.card-action-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-action-menu.active {
    display: flex;
    align-items: flex-end;
    opacity: 1;
}

.action-menu-content {
    width: 100%;
    background: var(--bg-card);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.card-action-menu.active .action-menu-content {
    transform: translateY(0);
}

.action-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-menu-item i {
    width: 24px;
    margin-right: 12px;
    color: var(--primary-color);
}

.action-menu-item:active {
    background: var(--bg-hover);
    transform: scale(0.98);
}

.action-menu-close {
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    margin-top: 8px;
}

/* 密码显示/隐藏按钮 */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
}

.password-toggle:active {
    color: var(--primary-color);
}

/* 移动端浮动操作按钮 */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 76px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    z-index: 9994;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.mobile-fab i {
    font-size: 24px;
}

.mobile-fab:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mobile-fab.extended {
    width: auto;
    padding: 0 20px;
    border-radius: 28px;
}

.mobile-fab.extended span {
    margin-left: 8px;
    font-weight: 600;
}

/* 下拉刷新指示器 */
.pull-to-refresh {
    display: none;
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 9990;
}

@media (max-width: 768px) {
    .pull-to-refresh.active {
        display: flex;
        top: 20px;
    }
}

.pull-to-refresh .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 移动端搜索栏 */
.mobile-search-bar {
    display: none;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    padding: 12px 16px;
    z-index: 9991;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .mobile-search-bar {
        display: block;
    }
}

.mobile-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 16px;
    color: var(--text-primary);
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.mobile-search-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
}

/* 滑动标签指示器 */
.swipe-indicator {
    display: none;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 11px;
    border-radius: 12px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .home-tabs-container {
        position: relative;
    }
    
    .home-tabs:hover .swipe-indicator {
        display: block;
    }
}

/* 空状态提示 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 骨架屏加载 */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-hover) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.skeleton-line {
    height: 16px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
}

/* 触摸反馈效果 */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.touch-feedback:active::after {
    width: 300%;
    height: 300%;
}

/* 滑动删除容器 */
.swipe-delete-container {
    position: relative;
    overflow: hidden;
}

.swipe-delete-content {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    transition: transform 0.3s ease;
}

.swipe-delete-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
}

.swipe-delete-btn {
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.swipe-delete-btn.delete {
    background: #ff4444;
}

.swipe-delete-btn.archive {
    background: #ffa726;
}

/* 悬浮提示 */
.mobile-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.mobile-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* 移动端徽章 */
.mobile-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: #ff4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 分段控制器 */
.segment-control {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
    margin: 16px 0;
}

.segment-item {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.segment-item.active {
    background: var(--bg-card);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 操作表单 */
.action-sheet {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
}

.action-sheet.active {
    display: flex;
    align-items: flex-end;
    opacity: 1;
}

.action-sheet-content {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    background: var(--bg-card);
    border-radius: 16px;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.action-sheet.active .action-sheet-content {
    transform: translateY(0);
}

.action-sheet-header {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.action-sheet-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.action-sheet-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.action-sheet-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s ease;
}

.action-sheet-item:active {
    background: var(--bg-hover);
}

.action-sheet-item:last-child {
    border-bottom: none;
}

.action-sheet-cancel {
    margin-top: 8px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}
