/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 60px; /* 为底部导航留出空间 */
}

/* 移动端头部 */
.mobile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.menu-btn, .search-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.menu-btn:hover, .search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-title i {
    font-size: 20px;
}

/* 快速统计 */
.quick-stats {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

/* 搜索面板 */
.search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.search-panel.active {
    transform: translateY(0);
}

.search-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #f8f9fa;
}

.clear-search {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
}

.close-search {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    margin-left: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.close-search:hover {
    background: #f5f5f5;
}

.search-filters {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.filter-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.search-actions {
    padding: 16px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* 侧边菜单 */
.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1001;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.side-menu.active {
    transform: translateX(280px);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid #eee;
}

.menu-header h3 {
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-menu {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.close-menu:hover {
    background: #f5f5f5;
}

.menu-items {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item.active {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.1), transparent);
    color: #667eea;
    border-right: 3px solid #667eea;
}

.menu-item i {
    width: 24px;
    text-align: center;
    font-size: 18px;
}

.menu-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
}

.user-info i {
    font-size: 24px;
    color: #667eea;
}

.logout-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.logout-btn:hover {
    background: #f5f5f5;
}

/* 主内容区域 */
.mobile-main {
    padding: 16px;
}

/* 操作工具栏 */
.action-toolbar {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-info {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    background: #f0f4ff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #dbe4ff;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: #f5f5f5;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.action-btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 按钮通用样式 */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #f7f9ff;
}

/* 接口卡片列表 */
.interfaces-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.interface-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.interface-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.interface-card.selected {
    border-left: 4px solid #667eea;
    background: #f8faff;
}

.card-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.card-checkbox {
    margin-right: 12px;
}

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.checkbox.checked {
    background: #667eea;
    border-color: #667eea;
}

.checkbox.checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-title {
    flex: 1;
}

.card-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.card-id {
    font-size: 12px;
    color: #999;
}

.card-badges {
    display: flex;
    gap: 8px;
}

.method-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.method-post {
    background: #4cc9f0;
    color: white;
}

.method-get {
    background: #06d6a0;
    color: white;
}

.card-body {
    padding: 16px;
}

.api-url {
    font-size: 13px;
    color: #666;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    word-break: break-all;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
}

.api-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.category-cloud { background: #667eea; }
.category-third-party { background: #7209b7; }
.category-carrier { background: #f72585; }
.category-bank { background: #06d6a0; }
.category-social { background: #118ab2; }
.category-government { background: #6a994e; }
.category-education { background: #8ac926; }
.category-finance { background: #1982c4; }
.category-test { background: #8d99ae; }
.category-health { background: #ff595e; }
.category-ecommerce { background: #ef476f; }
.category-custom { background: #8338ec; }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-active {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-inactive {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-action-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: background-color 0.2s;
}

.card-action-btn:hover {
    background: #f5f5f5;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    display: none;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #666;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* 加载更多 */
.load-more {
    text-align: center;
    padding: 20px;
}

.load-more-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 99;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    font-size: 10px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-item:hover {
    color: #667eea;
    background: #f8f9ff;
}

.nav-item.active {
    color: #667eea;
    background: #f0f4ff;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
}

.close-modal:hover {
    background: #f5f5f5;
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
}

.modal-footer .btn {
    flex: 1;
}

/* 模态框内容样式 */
.api-detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.detail-value.url {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    word-break: break-all;
    font-size: 14px;
}

.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    width: fit-content;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.stat-box {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-box-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 4px;
}

.stat-box-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}

/* 通知提示 */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 1003;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 18px;
    color: #10b981;
}

/* 悬浮操作按钮 */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 98;
    transition: transform 0.3s, box-shadow 0.3s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        max-height: 90vh;
    }
}

@media (max-width: 320px) {
    .app-title {
        font-size: 16px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .card-header {
        flex-wrap: wrap;
    }
    
    .card-badges {
        margin-top: 8px;
        width: 100%;
        justify-content: flex-end;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: #121212;
        color: #e0e0e0;
    }
    
    .mobile-header {
        background: linear-gradient(135deg, #5561c3 0%, #65468f 100%);
    }
    
    .search-panel,
    .side-menu,
    .interface-card,
    .action-toolbar,
    .modal-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .interface-card.selected {
        background: #252525;
    }
    
    .bottom-nav {
        background: #1e1e1e;
        border-top-color: #333;
    }
    
    .nav-item {
        color: #aaa;
    }
    
    .nav-item.active {
        color: #667eea;
        background: #252525;
    }
    
    .search-box input,
    .api-url,
    .detail-value.url {
        background: #252525;
        border-color: #333;
        color: #e0e0e0;
    }
    
    .btn-outline {
        background: transparent;
        border-color: #667eea;
        color: #667eea;
    }
    
    .action-btn {
        background: #252525;
        color: #aaa;
    }
    
    .selection-info {
        background: #252525;
        border-color: #333;
    }
}