/**
 * 词频统计工具样式
 */

/* ==========================================
   1. 输入区域样式
   ========================================== */
.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.input-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    min-height: 150px;
}

.input-section textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

#charCount {
    font-size: 13px;
    color: #666;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

.btn-primary {
    padding: 10px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ==========================================
   2. 控制面板样式
   ========================================== */
#controlPanel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.switch-label,
.select-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
}

.switch-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.select-label select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.3s;
}

.select-label select:focus {
    outline: none;
    border-color: #4CAF50;
}

/* ==========================================
   3. 统计概览样式
   ========================================== */
#statsSection {
    margin-bottom: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.stat-card i {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin: 8px 0;
}

.stat-label {
    font-size: 13px;
    opacity: 0.9;
}

/* ==========================================
   4. 结果表格样式
   ========================================== */
#resultSection {
    margin-top: 20px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.result-table thead {
    background: #4CAF50;
    color: white;
}

.result-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.result-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.result-table tbody tr:last-child td {
    border-bottom: none;
}

.result-table tbody tr:hover {
    background: #f5f5f5;
}

.word-cell {
    font-weight: 600;
    color: #333;
}

/* 表格列宽度优化 */
.result-table th:nth-child(1),
.result-table td:nth-child(1) {
    width: 80px;
    text-align: center;
}

.result-table th:nth-child(2),
.result-table td:nth-child(2) {
    width: auto;
}

.result-table th:nth-child(3),
.result-table td:nth-child(3) {
    width: 120px;
    text-align: center;
}

.result-table th:nth-child(4),
.result-table td:nth-child(4) {
    width: 100px;
    text-align: center;
}

/* ==========================================
   5. 分页样式
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    color: #333;
}

.page-btn:hover:not(:disabled) {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

#pageInfo {
    font-size: 14px;
    color: #666;
    margin: 0 10px;
}

/* ==========================================
   6. 响应式设计
   ========================================== */
/* 平板端 */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动端 */
@media (max-width: 768px) {
    .input-section textarea {
        font-size: 13px;
        min-height: 120px;
    }

    .input-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .input-actions {
        width: 100%;
    }

    .btn-secondary,
    .btn-primary {
        flex: 1;
        justify-content: center;
    }

    #controlPanel {
        padding: 12px;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card i {
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-label {
        font-size: 12px;
    }

    .result-table {
        font-size: 13px;
    }

    .result-table th,
    .result-table td {
        padding: 8px;
    }

    /* 移动端表格列宽度调整 */
    .result-table th:nth-child(1),
    .result-table td:nth-child(1) {
        width: 50px;
    }

    .result-table th:nth-child(3),
    .result-table td:nth-child(3) {
        width: 80px;
    }

    .result-table th:nth-child(4),
    .result-table td:nth-child(4) {
        width: 70px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .page-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    #pageInfo {
        font-size: 13px;
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .result-table th,
    .result-table td {
        padding: 6px 4px;
        font-size: 12px;
    }

    .result-table th:nth-child(1),
    .result-table td:nth-child(1) {
        width: 40px;
    }
}
