/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* 容器布局 - 兼容安卓5.0 */
.app-container {
    min-height: 100vh;
    /* 现代浏览器 */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* 头部样式 - 兼容安卓5.0 */
.app-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 16px;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-logo {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
}

.logo-img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}

.logo-text {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

/* 主体内容 - 兼容安卓5.0 */
.app-main {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 标签页样式 - 兼容安卓5.0 */
.app-tabs {
    background-color: #fff;
    -webkit-border-radius: 8px;
    border-radius: 8px;
    margin-bottom: 16px;
    -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tab-nav {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    border-bottom: 1px solid #e4e7ed;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.tab-item {
    padding: 16px 24px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #606266;
    background: none;
    border: none;
    outline: none;
    /* -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1; */
    text-align: center;
    min-width: 80px;
}

.tab-item:hover {
    color: #409eff;
}

.tab-item.active {
    color: #409eff;
    border-bottom-color: #409eff;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #409eff;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    border-top-color: transparent;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@-webkit-keyframes spin {
    to { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 卡片样式 */
.section-card {
    background-color: #fff;
    -webkit-border-radius: 8px;
    border-radius: 8px;
    -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    overflow: hidden;
}

.section-header {
    padding: 16px;
    border-bottom: 1px solid #efe7ed;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.section-content {
    padding: 16px;
}

/* 网格布局 - 全浏览器兼容 */
.app-grid {
    /* 默认使用Flexbox */
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -10px;
}

/* 现代浏览器使用Grid */
@supports (display: grid) {
    .app-grid:not(.no-grid) {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
        margin: 0;
    }
}

/* IE和老版本浏览器特殊处理 */
.ie .app-grid,
.compat-mode .app-grid,
.no-flexbox .app-grid {
    display: block;
    margin: 0;
}

.ie .app-grid::after,
.compat-mode .app-grid::after,
.no-flexbox .app-grid::after {
    content: "";
    display: table;
    clear: both;
}

/* 功能卡片 - 兼容安卓5.0 */
.func-card {
    background-color: #fff;
    -webkit-border-radius: 8px;
    border-radius: 8px;
    padding: 16px;
    -webkit-box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    border: 1px solid #ebeef5;

    /* Flexbox布局 */
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 calc(50% - 20px);
    -ms-flex: 0 0 calc(50% - 20px);
    flex: 0 0 calc(50% - 20px);
    margin: 10px;
    min-width: 260px;
    max-width: calc(50% - 20px);
}

/* 支持Grid的现代浏览器 */
@supports (display: grid) {
    .func-card {
        -webkit-flex: none;
        -ms-flex: none;
        flex: none;
        margin: 0;
        max-width: none;
    }
}

.func-card:hover {
    -webkit-box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
    transform: translateY(-2px);
}

.card-header {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.card-logo {
    width: 50px;
    height: 50px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    -o-object-fit: contain;
    object-fit: contain;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
        -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
}

.card-header-content {
    -webkit-box-flex: 2;
    -webkit-flex: 2;
    -ms-flex: 2;
    flex: 2;
    min-width: 0;
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.card-date {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
}

.card-content {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 10px;
}

.card-info {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    /* min-width: 80px; */
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    flex: 1;
        -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
}

.card-version {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
}

.card-btn {
    background-color: #409eff;
    color: white;
    border: none;
    padding: 8px 16px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    -webkit-transition: background-color 0.3s ease;
    -o-transition: background-color 0.3s ease;
    transition: background-color 0.3s ease;
    outline: none;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin-bottom: 4px;
}

.card-btn:hover {
    background-color: #66b1ff;
}

.card-btn:active {
    background-color: #3a8ee6;
}

.card-btn-link {
    background-color: #67c23a;
    color: white;
    border: none;
    padding: 4px 8px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    -webkit-transition: background-color 0.3s ease;
    -o-transition: background-color 0.3s ease;
    transition: background-color 0.3s ease;
    outline: none;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.card-btn-link:hover {
    background-color: #85ce61;
}

.card-btn-link:active {
    background-color: #5daf34;
}

.card-desc {
    -webkit-box-flex: 2;
    -webkit-flex: 2;
    -ms-flex: 2;
    flex: 2;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

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

/* 消息提示样式 */
.message-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
    transform: translateX(-50%);
    background-color: #f56c6c;
    color: white;
    padding: 12px 24px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    -webkit-box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    -webkit-transition: opacity 0.3s ease;
    -o-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
}

.message-toast.show {
    opacity: 1;
}

.message-toast.success {
    background-color: #67c23a;
}

/* 响应式设计 - 针对安卓5.0优化 */
@media (max-width: 768px) {
    .app-header {
        padding: 12px;
    }

    .logo-text {
        font-size: 16px;
    }

    .app-main {
        padding: 12px;
    }

    .tab-item {
        padding: 12px 8px;
        font-size: 12px;
        min-width: 60px;
    }

    .app-grid {
        margin: -5px;
    }

    .func-card {
        -webkit-flex: 0 0 calc(100% - 10px);
        -ms-flex: 0 0 calc(100% - 10px);
        flex: 0 0 calc(100% - 10px);
        margin: 5px;
        padding: 12px;
        max-width: calc(100% - 10px);
    }

    .card-header {
        gap: 8px;
    }

    .card-logo {
        width: 40px;
        height: 40px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .tab-item {
        padding: 10px 6px;
        font-size: 11px;
        min-width: 50px;
    }

    .card-title {
        font-size: 14px;
    }

    .card-version {
        font-size: 12px;
    }

    .card-btn {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* 安卓5.0特殊优化 */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    .func-card {
        /* 确保在低版本安卓上正确显示 */
        width: calc(50% - 20px);
        display: block;
        float: left;
        /* margin: 10px; */
    }

    .app-grid::after {
        content: "";
        display: table;
        clear: both;
    }
}

@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
    .func-card {
        width: calc(100% - 10px);
        margin: 5px;
    }
}

/* ========== 浏览器兼容性增强样式 ========== */

/* IE浏览器特殊优化 */
.ie .func-card,
.compat-mode .func-card {
    float: left;
    width: calc(50% - 20px);
    margin: 10px;
    display: block;
}

.ie .app-grid::after,
.compat-mode .app-grid::after {
    content: "";
    display: table;
    clear: both;
}

/* Android 4.x 特殊处理 */
.android4 .func-card {
    width: 48%;
    margin: 1%;
}

.android4 .app-grid {
    display: block;
    margin: 0;
}

/* WebView 特殊处理 */
.webview .func-card {
    width: calc(100% - 20px);
    margin: 10px;
    max-width: none;
}

.webview .app-grid {
    display: block;
    margin: 0;
}

/* 老版本Safari优化 */
.ios .func-card {
    -webkit-flex: 0 0 calc(50% - 20px);
    flex: 0 0 calc(50% - 20px);
}

/* 无Flexbox支持的浏览器 */
.no-flexbox .app-grid {
    display: block;
}

.no-flexbox .func-card {
    float: left;
    width: calc(50% - 20px);
    margin: 10px;
    display: block;
}

.no-flexbox .app-grid::after {
    content: "";
    display: table;
    clear: both;
}

/* 移动端兼容性优化 */
@media (max-width: 768px) {
    .ie .func-card,
    .compat-mode .func-card,
    .android4 .func-card,
    .webview .func-card,
    .no-flexbox .func-card {
        width: calc(100% - 10px);
        margin: 5px;
        float: none;
    }
}

/* 按钮兼容性优化 */
.ie .card-btn,
.compat-mode .card-btn,
.android4 .card-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    outline: none;
}

/* 图片兼容性 */
.ie .card-logo,
.compat-mode .card-logo {
    max-width: 50px;
    max-height: 50px;
}

/* 文字省略兼容性 */
.ie .card-title,
.compat-mode .card-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
}

/* 动画兼容性 */
.ie .func-card:hover,
.compat-mode .func-card:hover {
    -webkit-transform: none;
    -ms-transform: none;
    transform: none;
}

/* 调试面板兼容性 */
.ie #debug-panel,
.compat-mode #debug-panel {
    position: fixed;
    top: 50px;
    left: 50px;
    right: 50px;
    bottom: 50px;
    background: white;
    border: 2px solid #409eff;
    z-index: 2000;
    padding: 20px;
    overflow: auto;
}
