/* 响应式设计 */

/* 通用响应式样式 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    h1 {
        font-size: 24px;
    }

    .stats-container {
        flex-direction: column;
        align-items: center;
    }

    .stat-card {
        width: 100%;
        max-width: 300px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .view-toggle {
        display: flex;
        order: -1;
        /* 在搜索控件前面显示 */
        margin-bottom: 10px;
        align-self: flex-start;
    }

    .controls input {
        min-width: 100%;
    }

    table {
        font-size: 14px;
    }

    table th,
    table td {
        padding: 10px 12px;
    }

    /* 排序指示器 */
    .sort-indicator {
        font-size: 10px;
        margin-left: 3px;
    }
}

/* 图表响应式样式 */
@media (max-width: 768px) {
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chart-legend {
        gap: 8px;
        flex-wrap: wrap;
        font-size: 11px;
    }

    .chart-legend .legend-item {
        margin-bottom: 4px;
    }

    .chart-legend .legend-box {
        width: 10px;
        height: 10px;
    }

    .chart-container {
        height: 350px;
        /* 增加移动端图表高度 */
        margin-bottom: 10px;
    }

    .chart-section h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }
}

/* 移动端图表优化 */
@media (max-width: 480px) {
    .chart-container {
        height: 300px;
    }

    .chart-legend {
        display: none;
        /* 在小屏幕上隐藏图例，改用tooltip */
    }

    .chart-section::after {
        content: "点击图表查看详细信息";
        display: block;
        font-size: 11px;
        color: var(--gray-color);
        text-align: center;
        margin-top: 8px;
    }
}

/* 版本卡片响应式样式 */
@media (max-width: 768px) {
    .version-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .version-card-header h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .version-legend {
        gap: 10px;
    }

    .version-legend-item {
        font-size: 13px;
        padding: 2px 4px;
    }

    .version-legend-color {
        width: 12px;
        height: 12px;
    }

    .version-legend-stats {
        font-size: 11px;
        padding: 4px 6px;
    }
}

@media (max-width: 480px) {
    .version-legend {
        gap: 8px;
    }

    .version-legend-item {
        font-size: 12px;
        padding: 2px 3px;
    }

    .version-legend-color {
        width: 10px;
        height: 10px;
    }

    .version-legend-stats {
        font-size: 10px;
        padding: 3px 5px;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .view-toggle {
        display: flex;
        order: -1;
        /* 在搜索控件前面显示 */
        margin-bottom: 10px;
    }

    /* 在移动端可以选择隐藏表格，只显示卡片 */
    .table-view #clients-table {
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }

    .table-view #clients-table th,
    .table-view #clients-table td {
        padding: 8px 6px;
        font-size: 12px;
        min-width: 80px;
    }

    .table-view #clients-table th:first-child,
    .table-view #clients-table td:first-child {
        position: sticky;
        left: 0;
        background: var(--white-color);
        z-index: 1;
        min-width: 120px;
    }

    .table-view #clients-table th:first-child {
        background: var(--light-color);
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    .client-card-details {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .client-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .client-card {
        padding: 12px;
    }

    /* 在小屏幕上默认使用卡片视图 */
    .view-toggle {
        display: none;
    }

    #clients-table {
        display: none !important;
    }

    .clients-cards {
        display: flex !important;
    }
}

/* 更新日志模态框响应式样式 */
@media (max-width: 768px) {
    .changelog-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .changelog-body {
        max-height: 70vh;
        padding: 15px;
    }

    .changelog-version h4 {
        font-size: 15px;
    }

    .changelog-version li {
        font-size: 14px;
    }

    .changelog-button {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }

    .changelog-button svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .changelog-button {
        bottom: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .changelog-button svg {
        width: 18px;
        height: 18px;
    }
}